/* =========================================
   SISTEMA DE DISENO PREMIUM - VISTA VISION
   ========================================= */

:root {
    --primary: #51408f;
    --primary-alt: #6d5dc0;
    --primary-deep: #2c2450;
    --accent: #57b8f2;
    --accent-strong: #2795e4;
    --accent-glow: rgba(87, 184, 242, 0.28);
    --accent-light: #edf8ff;
    --secondary: #62708a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-app: #f4f8ff;
    --bg-card: #ffffff;
    --text-main: #25324a;
    --text-muted: #6d7992;
    --border: #dbe6f2;
    --border-focus: #8dbde3;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 8px 18px -14px rgba(55, 75, 110, 0.35);
    --shadow-lg: 0 18px 35px -18px rgba(54, 75, 111, 0.35);
    --shadow-premium: 0 30px 60px -32px rgba(63, 87, 129, 0.32);
    --tr: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 16px;
}

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

body {
    font-family: var(--font-main);
    background:
        radial-gradient(circle at top left, rgba(87, 184, 242, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(109, 93, 192, 0.14), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg-app) 42%, #eef4ff 100%);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--font-title); }
a { text-decoration: none; color: inherit; transition: var(--tr); }

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 280px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0)),
        linear-gradient(180deg, #5f50aa 0%, #4e408d 48%, #322854 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: var(--tr);
}

.sidebar-logo {
    display: block;
    margin-bottom: 3rem;
    padding: 0 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-logo-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    padding: 0.9rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 30px -24px rgba(15, 23, 42, 0.65);
}

.nav-menu { flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.9rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: rgba(235, 242, 255, 0.8);
    font-size: 0.95rem;
}

.nav-item i { width: 22px; font-size: 1.2rem; transition: var(--tr); }

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.nav-item:hover i { transform: translateX(3px); }

.nav-item.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(237,248,255,0.88));
    color: var(--primary-deep);
    font-weight: 700;
    box-shadow: 0 18px 30px -18px rgba(23, 32, 56, 0.65);
}

.nav-item.active i { color: var(--accent-strong); }
.nav-item.logout { margin-top: auto; color: #fecaca; }
.nav-item.logout:hover { background: rgba(239, 68, 68, 0.12); }

.main-wrapper {
    flex: 1;
    margin-left: 280px;
    padding: 3rem;
    width: calc(100% - 280px);
    transition: var(--tr);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
}

.page-header h1 { font-size: 2.75rem; color: var(--primary); letter-spacing: -0.5px; }
.page-header p {
    color: var(--accent-strong);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 4rem;
}

.kpi-card,
.action-card,
.form-card,
.table-wrapper,
.report-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,249,255,0.94));
}

.kpi-card {
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--tr);
}

.kpi-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(87, 184, 242, 0.55); }

.kpi-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.kpi-card .data h3 { font-size: 2rem; line-height: 1; margin-bottom: 0.4rem; font-weight: 700; color: var(--primary); }
.kpi-card .data p { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--secondary); }

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.action-card {
    padding: 2.25rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: var(--tr);
}

.action-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: rgba(87, 184, 242, 0.45); }

.action-card .icon-box {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(87,184,242,0.16), rgba(109,93,192,0.14));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary-alt);
    transition: var(--tr);
}

.action-card h4 { font-size: 1.3rem; color: var(--primary); }
.action-card p { font-size: 0.95rem; color: var(--secondary); line-height: 1.5; }

.form-card {
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    border: 1px solid var(--border);
    max-width: 900px;
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.form-group { margin-bottom: 2rem; }
.form-group.full-width { grid-column: span 2; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: rgba(244, 248, 255, 0.9);
    transition: var(--tr);
}

.form-control:focus {
    outline: none;
    background: white;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

textarea.form-control { min-height: 120px; resize: vertical; }
.btn-block { width: 100%; justify-content: center; padding: 1.25rem; font-size: 1rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.75rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: var(--tr);
    box-shadow: 0 12px 26px -18px rgba(57, 70, 102, 0.6);
}

.btn i { font-size: 1rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-alt), var(--primary));
    color: white;
    box-shadow: 0 16px 30px -18px rgba(81, 64, 143, 0.9);
}

.btn-primary:hover,
.btn-gold:hover,
.btn-accent:hover { transform: translateY(-2px); }

.btn-primary:active { transform: scale(0.98); }

.btn-gold,
.btn-accent {
    background: linear-gradient(135deg, #7fd4ff, var(--accent));
    color: var(--primary-deep);
    box-shadow: 0 18px 30px -18px rgba(42, 144, 223, 0.85);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.72);
    border: 2px solid var(--border);
    color: var(--secondary);
}

.btn-outline:hover { border-color: var(--accent-strong); color: var(--primary); background: var(--accent-light); }

.table-wrapper {
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table { width: 100%; border-collapse: collapse; }

.table th {
    padding: 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    background: #eef5ff;
    color: var(--primary-alt);
    letter-spacing: 1px;
}

.table td { padding: 1.5rem; border-top: 1px solid var(--border); font-size: 0.95rem; vertical-align: middle; }
.table tr:hover td { background: #f6faff; }

.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-primary { background: linear-gradient(135deg, rgba(87,184,242,0.12), rgba(109,93,192,0.1)); color: var(--primary); border: 1px solid rgba(87, 184, 242, 0.3); }
.badge-danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

.report-card {
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--border);
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.data-row:last-child { border-bottom: none; }

.public-body { display: block; }
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(circle at top right, #7cbef1, #51408f 48%, #2c2450 100%); }
.login-card { width: 100%; max-width: 440px; padding: 3.5rem; }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(24, 32, 56, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,249,255,0.96));
    border-radius: 24px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content form { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.modal-header { padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); flex-shrink: 0; position: relative; }
.modal-header h3 { font-size: 1.35rem; font-family: var(--font-title); margin: 0; padding-right: 30px; color: var(--primary); }

.btn-close, .close-btn {
    background: var(--bg-app);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: var(--tr);
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
}

.btn-close:hover, .close-btn:hover { background: var(--danger); color: white; }
.modal-body { padding: 2rem; overflow-y: auto; flex: 1; }
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.modal-footer { padding: 1.5rem 2rem; border-top: 1px solid var(--border); background: #f3f8ff; flex-shrink: 0; }
.modal-content .form-control { padding: 0.75rem 1rem; font-size: 0.9rem; }
.modal-content .info-label { margin-bottom: 0.5rem; font-size: 0.7rem; }

@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.alert {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2.5rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    animation: fadeIn 0.4s ease-out;
    box-shadow: var(--shadow-sm);
}

.alert-success { background-color: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger { background-color: #fef2f2; color: #991b1b; border-color: #fecaca; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.95rem;
}

.brand-logo-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.brand-mark.light .brand-logo-image {
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.brand-logo-sidebar {
    width: 100%;
    max-width: 180px;
    max-height: 68px;
    margin: 0 auto;
    filter: none !important;
}

.brand-logo-navbar {
    width: clamp(128px, 11vw, 170px);
    max-height: 46px;
}

.brand-logo-hero {
    width: min(42vw, 260px);
    max-height: 120px;
    margin: 0 auto;
}

.brand-mark.compact { gap: 0.7rem; }

.brand-mark-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.9), rgba(237,248,255,0.82)),
        linear-gradient(135deg, var(--accent), var(--primary-alt));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        0 18px 28px -18px rgba(30, 71, 119, 0.7);
    position: relative;
    overflow: hidden;
}

.brand-mark-icon::before {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(87,184,242,0.15), rgba(109,93,192,0.18));
}

.brand-mark-icon i {
    position: relative;
    z-index: 1;
    font-size: 1.6rem;
    color: var(--primary-alt);
}

.brand-mark-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-mark-title {
    font-family: var(--font-title);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.brand-mark-subtitle {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--accent-strong);
    margin-top: 0.3rem;
}

.brand-mark.light .brand-mark-title,
.brand-mark.light .brand-mark-subtitle { color: white; }

.brand-mark.light .brand-mark-subtitle { color: rgba(209, 237, 255, 0.82); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1.1rem;
    border-radius: 18px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(87, 184, 242, 0.18);
    box-shadow: 0 18px 32px -26px rgba(63, 87, 129, 0.45);
}

.user-info strong {
    display: block;
    color: var(--primary);
}

.user-info span { margin-top: 0.35rem; }

@media (max-width: 1024px) {
    .sidebar { width: 85px; padding: 2.5rem 1rem; left: 0; }
    .sidebar-logo .brand-mark-text, .nav-item span { display: none; }
    .main-wrapper { margin-left: 85px; width: calc(100% - 85px); padding: 2rem; }
    .kpi-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: auto; }
    .brand-logo-sidebar { max-width: 56px; max-height: 56px; }
    .sidebar-logo-card { min-height: 72px; padding: 0.45rem; border-radius: 16px; }
}

@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        left: -260px;
        padding: 1rem;
        z-index: 1050;
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
        transition: left 0.3s ease;
    }

    .sidebar.mobile-open { left: 0; }
    .sidebar-logo .brand-mark-text, .nav-item span { display: inline-block !important; }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 1.5rem 1rem;
    }

    .brand-logo-sidebar {
        max-width: 150px;
        max-height: 58px;
    }

    .sidebar-logo-card {
        min-height: 84px;
        padding: 0.75rem;
    }

    .brand-logo-navbar {
        width: 124px;
        max-height: 38px;
    }

    .brand-logo-hero {
        width: min(64vw, 220px);
        max-height: 92px;
    }

    .modal-content { max-height: 95vh; border-radius: 16px; margin: 10px; width: calc(100% - 20px); }
    .modal-body { padding: 1.5rem; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .page-header h1 { font-size: 1.7rem; }

    .header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-actions .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .mobile-toggle {
        display: flex !important;
        align-items: center;
        gap: 10px;
        background: linear-gradient(135deg, var(--primary-alt), var(--primary));
        color: #dff3ff;
        border: none;
        padding: 0.7rem 1.2rem;
        border-radius: 12px;
        font-weight: 800;
        font-size: 1rem;
        cursor: pointer;
        margin-bottom: 0;
        box-shadow: 0 12px 24px -16px rgba(44, 36, 80, 0.9);
    }

    .main-header-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .kpi-grid { grid-template-columns: 1fr !important; gap: 1rem; margin-bottom: 1.5rem; }
    .action-grid { grid-template-columns: 1fr; gap: 1rem; }

    .table-card, .table-responsive {
        width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem;
        box-shadow: inset -10px 0 10px -10px rgba(0,0,0,0.1);
    }

    .table { min-width: 650px; }
    .table th, .table td { white-space: nowrap; font-size: 0.85rem; padding: 1rem 0.5rem; }

    .form-card { padding: 1.2rem; }
    .form-group { margin-bottom: 1.25rem; }

    .navbar-public .container {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .navbar-public .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .hero-text h1 { font-size: 2.5rem !important; }
    .hero-text p { font-size: 1rem !important; }
    .hero-btns { display: flex; flex-direction: column; gap: 1rem; }
    .hero-btns .btn { width: 100%; margin-left: 0 !important; text-align: center; justify-content: center; }

    .inventory-tabs, .tabs-container {
        display: flex;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .inventory-tabs::-webkit-scrollbar, .tabs-container::-webkit-scrollbar { display: none; }
    .tab-link, .tab-btn { flex: 0 0 auto; padding: 1rem 1.5rem !important; }
}
