/* ==========================================================================
   Panel de Administración — Tema "Azul Marino & Dorado"
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --admin-bg: #f3f1ea;
    --sidebar-bg: #0b1f3f;
    --sidebar-bg-deep: #081527;
    --sidebar-text: #9fb0cc;
    --sidebar-active: #c9a227;
    --card-bg: #ffffff;
    --text-color: #1c2740;
    --text-muted: #64748b;
    --border-color: #e7e2d4;
    --gold: #c9a227;
    --gold-light: #e7c766;
    --gold-deep: #8a6d1f;
    --navy: #0b1f3f;
    --navy-mid: #142c52;
    --primary-blue: #0b1f3f;
    --primary-hover: #142c52;
    --success-green: #1f7a4d;
    --danger-red: #b3432f;
    --warning-yellow: #a16207;
    --radius-sm: 6px;
    --radius-md: 12px;
    --shadow-sm: 0 2px 8px rgba(11, 31, 63, 0.08);
    --shadow-md: 0 10px 24px rgba(11, 31, 63, 0.14);
    --font-display: 'Playfair Display', Georgia, serif;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    font-family: var(--font);
    background-color: var(--admin-bg);
    color: var(--text-color);
    line-height: 1.5;
}

/* Pantalla de Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, var(--navy-mid) 0%, var(--sidebar-bg-deep) 70%);
    padding: 16px;
}

@keyframes cardRise {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
    border-top: 3px solid var(--gold);
    animation: cardRise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-header {
    text-align: center;
    margin-bottom: 26px;
}

.login-logo {
    max-height: 56px;
    margin-bottom: 12px;
}

.login-logo-placeholder {
    font-size: 38px;
    margin-bottom: 8px;
}

.login-header h2 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    color: var(--navy);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Layout general */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 900;
    border-right: 2px solid var(--gold);
}

.sidebar-header {
    padding: 26px 20px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.25);
    text-align: center;
}

.sidebar-logo {
    max-height: 48px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.sidebar-logo-placeholder {
    font-size: 32px;
}

.sidebar-header h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 2px;
    color: #fdfaf0;
}

.sidebar-header small {
    color: var(--gold);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar-nav a:hover {
    background-color: rgba(201, 162, 39, 0.1);
    color: #ffffff;
}

.sidebar-nav a.active {
    background-color: rgba(201, 162, 39, 0.16);
    color: var(--gold);
    border-left: 3px solid var(--gold);
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background-color: rgba(201, 162, 39, 0.25);
    margin: 12px 0;
}

.link-logout {
    color: #e08a76 !important;
}

/* Topbar y contenido principal */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.admin-topbar {
    background-color: #ffffff;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-icon-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--navy);
}

.topbar-user strong {
    color: var(--gold-deep);
}

.admin-content {
    padding: 26px;
    flex: 1;
}

.admin-footer {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Cards y tablas */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3, .card-header h2 {
    font-family: var(--font-display);
    color: var(--navy);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    background-color: var(--admin-bg);
    border-top: 1px solid var(--border-color);
}

/* Grilla de estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.icon-blue { background: #dbe6fa; color: var(--navy); }
.icon-purple { background: #ece3fb; color: #5b3a9e; }
.icon-orange { background: #f8e9d0; color: var(--gold-deep); }
.icon-green { background: #dcf1e4; color: var(--success-green); }

.stat-info h3 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--navy);
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Tablas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th {
    background-color: var(--admin-bg);
    color: var(--navy);
    font-weight: 700;
    text-align: left;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: rgba(201, 162, 39, 0.06);
}

.thumb-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.thumb-placeholder {
    width: 44px;
    height: 44px;
    background: var(--admin-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-info { background: #dbe6fa; color: var(--navy); }
.badge-success { background: #dcf1e4; color: var(--success-green); }
.badge-warning { background: #f8ecc9; color: var(--warning-yellow); }
.badge-danger { background: #f9e0da; color: var(--danger-red); }

/* Botones y campos */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: var(--sidebar-bg-deep); }
.btn-primary:hover { box-shadow: 0 8px 18px rgba(201, 162, 39, 0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-secondary:hover { background: var(--navy-mid); }
.btn-danger { background: var(--danger-red); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn-block { width: 100%; justify-content: center; }

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.form-control-color {
    width: 50px;
    height: 38px;
    padding: 2px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.form-row {
    display: flex;
    gap: 16px;
}

.col-4 { flex: 0 0 33.33%; }
.col-6 { flex: 0 0 50%; }
.col-8 { flex: 0 0 66.66%; }

/* Modal Admin */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 21, 39, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal.active {
    display: flex;
}

@keyframes modalRise {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog {
    background: #fff;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--gold);
    animation: modalRise 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-display);
    color: var(--navy);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--navy);
    transition: transform 0.2s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
    color: var(--gold-deep);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-danger { background: #f9e0da; color: #7a2c1a; }
.alert-success { background: #dcf1e4; color: #155c37; }

/* --------------------------------------------------------------------------
   Íconos (Lucide)
   -------------------------------------------------------------------------- */
.icon-inline {
    width: 1em;
    height: 1em;
    stroke-width: 2;
    vertical-align: -0.15em;
    display: inline-block;
}

.sidebar-nav a .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
}

.sidebar-nav a .icon-inline {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.sidebar-logo-placeholder .icon-inline,
.login-logo-placeholder .icon-inline {
    width: 34px;
    height: 34px;
    color: var(--gold);
}

.stat-icon .icon-inline {
    width: 24px;
    height: 24px;
}

.close-btn .icon-inline,
.btn-icon-mobile .icon-inline {
    width: 22px;
    height: 22px;
}

/* --------------------------------------------------------------------------
   Encabezados de página
   -------------------------------------------------------------------------- */
.page-container {
    padding-bottom: 20px;
}

.page-header,
.page-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}

.page-header h2,
.page-title h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 4px;
}

.page-header p,
.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-container {
    padding-bottom: 20px;
}

.quick-actions {
    margin-top: 26px;
}

.quick-actions h3 {
    font-family: var(--font-display);
    color: var(--navy);
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.actions-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* --------------------------------------------------------------------------
   Utilidades de espaciado
   -------------------------------------------------------------------------- */
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 16px; }
.my-2 { margin-top: 10px; margin-bottom: 10px; }
.my-4 { margin-top: 24px; margin-bottom: 24px; }
.p-3 { padding: 16px; }
.py-2 { padding-top: 10px; padding-bottom: 10px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }

/* --------------------------------------------------------------------------
   Utilidades de layout y texto
   -------------------------------------------------------------------------- */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.bg-light { background-color: var(--admin-bg); border-radius: var(--radius-sm); }

hr {
    border: none;
    border-top: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   Componentes reutilizados en formularios de admin
   -------------------------------------------------------------------------- */
.color-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.color-input-row span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.color-input-row code {
    background: var(--admin-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--navy);
}

.img-thumbnail {
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px;
    background: #fff;
    display: block;
    margin: 0 auto;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-color);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
    cursor: pointer;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--gold-deep);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    font-size: 0.9rem;
}

.btn-link:hover {
    text-decoration: underline;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.card-filter {
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 16px 20px;
}

.filter-row .form-group {
    flex: 1 1 200px;
    min-width: 160px;
}

.order-items-list {
    max-height: 320px;
    overflow-y: auto;
}

.order-items-list .cart-line-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.modal-content {
    display: block;
    width: 100%;
}

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
    }
    .admin-sidebar.open {
        transform: translateX(260px);
    }
    .btn-icon-mobile {
        display: block;
    }
    .form-row {
        flex-direction: column;
        gap: 8px;
    }
    .col-4, .col-6, .col-8 {
        flex: 1 1 100%;
    }
    .admin-content {
        padding: 16px;
    }
    .admin-topbar {
        padding: 0 16px;
        height: 58px;
    }
    .card-body {
        padding: 16px;
    }
    .card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .page-header, .page-title {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-row {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }
    .filter-row .form-group {
        flex: 1 1 100%;
        min-width: 0;
    }
    .action-buttons {
        justify-content: flex-start;
        width: 100%;
    }
    .action-buttons .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
    .table th, .table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    .modal-dialog {
        max-width: 100%;
        margin: 0 8px;
    }
    .modal-header, .modal-body, .modal-footer {
        padding: 14px 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .stat-card {
        padding: 14px;
        gap: 10px;
    }
    .stat-info h3 {
        font-size: 1.25rem;
    }
    .login-card {
        padding: 26px 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .card-footer, .modal-footer {
        flex-direction: column;
    }
    .card-footer .btn, .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
    .sidebar-header h3 {
        font-size: 1rem;
    }
}
