@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* VaultLine Design System */
    --color-primary: #1E3A5F;
    --color-primary-hover: #162D4A;
    --color-primary-soft: #F9F7F2;
    --color-secondary: #C49A2A;
    
    --color-success: #16A34A;
    --color-warning: #CA8A04;
    --color-danger: #DC2626;
    --color-info: #2563EB;
    
    --color-sidebar: #FFFFFF;
    --color-sidebar-active: #F1F5F9;
    --color-sidebar-text: #475569;
    
    --color-bg-body: #F4F4F5;
    --color-card-bg: #FFFFFF;
    
    --color-text-main: #1E293B;
    --color-text-muted: #475569;
    --color-border: #E2DFD5;
    
    --radius-none: 0px;
    --radius-sm: 4px;
    --radius-md: 6px;
    
    --shadow-subtle: 0 1px 3px rgba(30, 41, 59, 0.04), 0 1px 2px rgba(30, 41, 59, 0.02);
    --shadow-sm: 0 4px 8px rgba(30, 41, 59, 0.06), 0 2px 4px rgba(30, 41, 59, 0.03);
    --shadow-md: 0 8px 24px rgba(30, 41, 59, 0.08), 0 4px 8px rgba(30, 41, 59, 0.04);
    
    --sidebar-width: 265px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6, .card-title, .topbar-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-primary);
}

/* Layout */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--color-sidebar);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid var(--color-border);
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-header img {
    height: 32px !important;
    max-height: 32px !important;
    width: 32px !important;
    max-width: 32px !important;
    object-fit: contain !important;
    flex-shrink: 0;
}

.sidebar-header span {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.5rem;
    color: var(--color-sidebar-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.nav-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

.nav-link:hover {
    color: var(--color-primary);
    background-color: var(--color-bg-body);
}

.nav-link.active {
    background-color: var(--color-sidebar-active);
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
    font-weight: 600;
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: 70px;
    background-color: var(--color-card-bg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-info {
    text-align: right;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-main);
}

.user-role {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'IBM Plex Mono', monospace;
}

.avatar {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: 0px;
    border: 1px solid var(--color-primary);
}

.logout-link {
    color: var(--color-text-muted);
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.logout-link:hover {
    color: var(--color-danger);
    transform: translateX(3px);
}

.content-area {
    padding: 2.5rem; /* Más espacio */
}

/* UI Elements */
.card-panel {
    background: var(--color-card-bg);
    padding: 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-subtle);
    border: 1px solid var(--color-border);
    margin-bottom: 2.5rem;
    transition: box-shadow 0.2s ease;
}

.card-panel:hover {
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--color-text-main);
}

.card-title i {
    color: var(--color-primary);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.65rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-main);
    letter-spacing: 0.3px;
}

.form-control, select.form-control {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-card-bg);
    color: var(--color-text-main);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px;
    line-height: 1.4;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
    vertical-align: middle;
}

select.form-control {
    padding-right: 32px;
}

.form-control:hover {
    border-color: #9CA3AF;
}

.form-control:focus {
    border-color: var(--color-primary);
    background-color: #fff;
    box-shadow: var(--shadow-subtle);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    gap: 0.6rem;
    text-align: center;
}

.btn i {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #FFFFFF;
    box-shadow: var(--shadow-subtle);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    color: #FFFFFF;
}

.btn-outline {
    background-color: #FFFFFF;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary-hover);
    color: #FFFFFF;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-none);
}

th {
    text-align: left;
    padding: 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 15px;
    vertical-align: middle;
    color: var(--color-text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: var(--color-primary-soft);
}

/* Badges */
.badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
}

.badge.success { background: #F0FDF4; color: var(--color-success); }
.badge.pending { background: #FEFCE8; color: var(--color-warning); }
.badge.danger { background: #FEF2F2; color: var(--color-danger); }

/* Grid Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--color-card-bg);
    padding: 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.stat-icon {
    width: 55px;
    height: 55px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    border-radius: var(--radius-sm);
}

.stat-details h3 {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.stat-details .value {
    font-size: 30px;
    font-weight: 600;
    color: var(--color-text-main);
    letter-spacing: -0.02em;
}

/* Modals */
.modal-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 15, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

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

.modal-content {
    background: #fff;
    padding: 2.5rem;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
}

/* Status Monitor Texto Blanco */
#terminal-body div {
    color: #ffffff !important;
}

/* --- RESPONSIVE DESIGN (GLOBAL) --- */

/* Hamburguesa (Botón de menú) — oculto por defecto en Desktop */
.hamburger {
    display: none; /* Solo visible en móvil via media query */
    background: transparent;
    border: none;
    color: var(--color-text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.75rem;
    border-radius: 0px;
    transition: all 0.2s;
    align-items: center;
    justify-content: center;
}

.hamburger:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    display: none;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

/* TABLET & MOBILE BREAKPOINT (UNIFIED) */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -100%; /* Hidden off-screen */
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1001;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        visibility: hidden;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar.active {
        left: 0;
        visibility: visible;
    }

    /* Overlay se activa via JS toggleando .active en el div#overlay */
    .sidebar-overlay.active {
        display: block;
    }

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

    .hamburger {
        display: flex;
    }

    .topbar {
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 70px;
        padding: 0 1.25rem;
        z-index: 997;
        background: #fff;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .content-area {
        padding: 85px 0.75rem 2rem !important; /* Más espacio útil en móvil */
    }

    .card-panel {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .topbar-title {
        font-size: 1rem;
        max-width: 140px;
    }

    .user-info {
        display: none !important;
    }

    /* Grid layout simplified for mobile */
    .grid-cards, .stats-grid, .dashboard-grid, .express-grid, .checkout-horizontal-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Responsive Tables as Cards */
    .table-responsive {
        border: none;
    }

    table thead { display: none; }
    table tr { 
        display: block; 
        border-radius: 12px;
        border: 1px solid var(--color-border);
        margin-bottom: 1.25rem;
        padding: 1.25rem; 
        background: #fff; 
        box-shadow: var(--shadow-sm);
    }
    table td { 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        padding: 0.85rem 0; 
        border-bottom: 1px solid #f1f5f9; 
        text-align: right; 
        font-size: 0.95rem;
    }
    table td:last-child { border-bottom: none; flex-direction: column; align-items: stretch; gap: 0.75rem; padding-top: 1.25rem; }
    table td:last-child::before { margin-bottom: 0.75rem; }
    
    table td::before { 
        content: attr(data-label); 
        font-weight: 800; 
        color: var(--color-text-muted); 
        text-transform: uppercase; 
        font-size: 0.65rem; 
        letter-spacing: 0.5px;
        text-align: left;
    }

    /* Modales en móvil */
    .modal-content {
        padding: 1.5rem;
        width: 95%;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccd2db; }
::-webkit-scrollbar-thumb:hover { background: #b5bdc9; }
