:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #4cc9f0;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --gray-color: #6c757d;
    --sidebar-width: 280px;
    --transition-speed: 0.3s;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: #2c3e50;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Loader moderno */
#loader-container {
    position: fixed;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Navbar mejorada */
.navbar {
    background: linear-gradient(135deg, var(--dark-color) 0%, #16213e 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    background: linear-gradient(90deg, var(--accent-color), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand i {
    font-size: 1.6rem;
}

/* Sidebar moderna */
#sidebar {
    background: linear-gradient(180deg, var(--dark-color) 0%, #16213e 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.1);
    min-height: calc(100vh - 70px);
    position: fixed;
    width: var(--sidebar-width);
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    padding-top: 1.5rem;
}

#sidebar .nav-item {
    margin: 0.3rem 1rem;
}

#sidebar .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    margin: 0.2rem 0;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

#sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(5px);
}

#sidebar .nav-link:hover::before {
    transform: scaleY(1);
}

#sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(67, 97, 238, 0.2), transparent);
    color: white;
    border-left: 4px solid var(--accent-color);
}

#sidebar .nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* Contenido principal */
main {
    padding: 2rem;
    min-height: calc(100vh - 70px);
}

/* Header del contenido */
.main-header {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.main-header h1 {
    color: var(--dark-color);
    font-weight: 700;
    font-size: 1.8rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-header h1 i {
    color: var(--primary-color);
}

/* Cards modernas */
.card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1.2rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    color: var(--dark-color);
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.card-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Badges para niveles */
.badge-admin {
    background: linear-gradient(90deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-operator {
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Botón toggle sidebar */
#sidebarToggle {
    background: var(--primary-color);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#sidebarToggle:hover {
    background: var(--secondary-color);
    transform: rotate(90deg);
}

/* Contenido dinámico */
.content-area {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    min-height: 400px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Reloj en tiempo real */
#date-time {
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(90deg, var(--dark-color), #2d3436);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 992px) {
    main {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    #sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }
    
    #sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100% - 70px);
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 1.2rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* Animaciones suaves */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--secondary-color), var(--primary-color));
}