/* ==========================================================================
   CSS PRINCIPAL: NEKTECH DESIGN SYSTEM (PREMIUM & MODERN)
   ========================================================================== */

/* VARIABLES & PALETA DE COLORES */
:root {
    /* Modo Claro (Default) */
    --bg-primary: #f6f8fc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-glass: rgba(255, 255, 255, 0.7);
    --border-color: #e4e9f2;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --primary: #4f46e5;         /* Indigo Premium */
    --primary-light: #818cf8;
    --primary-glow: rgba(79, 70, 229, 0.08);
    --accent: #0ea5e9;          /* Cyan */
    --accent-glow: rgba(14, 165, 233, 0.1);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.1);
    
    --sidebar-width: 260px;
    --header-height: 70px;
    /* Sombras sutiles (plano moderno, no glows) */
    --shadow-premium: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-hover: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
    /* Curva de salida fuerte para interacciones; transiciones solo de lo que cambia */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
    --font-family: 'Outfit', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* ===== Superficies planas — SIN desenfoque (rendimiento) =====
       Se conservan los nombres --glass-* para no reescribir cada regla. */
    --glass-bg: var(--bg-card);
    --glass-bg-strong: var(--bg-card);
    --glass-blur: none;
    --glass-blur-strong: none;
    --glass-border: 1px solid var(--border-color);
    /* Sombra transparente: mantiene válidas las listas box-shadow existentes. */
    --glass-highlight: 0 0 0 0 rgba(0, 0, 0, 0);
    --glass-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --glass-sheen: none;
}

[data-theme="dark"] {
    /* Modo Oscuro */
    --bg-primary: #0a0e17;
    --bg-sidebar: #111622;
    --bg-card: #171d2c;
    --bg-card-glass: rgba(23, 29, 44, 0.7);
    --border-color: #242c3d;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-light: #a5b4fc;
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --shadow-premium: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 4px 10px -2px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.35);

    /* ===== Superficies planas en modo oscuro ===== */
    --glass-bg: var(--bg-card);
    --glass-bg-strong: var(--bg-card);
    --glass-border: 1px solid var(--border-color);
    --glass-highlight: 0 0 0 0 rgba(0, 0, 0, 0);
    --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.25);
    --glass-sheen: none;
}

/* RESET E INSTALACIÓN GENERAL */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fondo limpio (estilo plano moderno): sin capas de color ni desenfoques. */

/* ESTRUCTURA GENERAL DE LA APLICACIÓN */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* BARRA LATERAL (SIDEBAR) */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur-strong);
    -webkit-backdrop-filter: var(--glass-blur-strong);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 32px;
}

.brand-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.4), 0 0 20px rgba(14, 165, 233, 0.2);
    transition: var(--transition);
}

.brand-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.5), 0 0 30px rgba(14, 165, 233, 0.3);
}

.brand-icon i {
    width: 22px;
    height: 22px;
}

.brand-info h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
}

.nav-item i {
    width: 20px;
    height: 20px;
    transition: var(--transition);
}

.nav-item:hover {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(14, 165, 233, 0.05));
    color: var(--primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-glow), rgba(14, 165, 233, 0.08));
    color: var(--primary);
    font-weight: 600;
    box-shadow: inset 0 0 12px rgba(79, 70, 229, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 0 3px 3px 0;
}

.nav-item.active i {
    color: var(--primary);
    transform: scale(1.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.8; }
}

/* CONTENIDO PRINCIPAL */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-width: 0;
}

/* HEADER SUPERIOR */
.main-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur-strong);
    -webkit-backdrop-filter: var(--glass-blur-strong);
    border: var(--glass-border);
    padding: 0 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
    transition: var(--transition);
    position: relative;
    z-index: 50;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-bg);
    border: var(--glass-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    border-radius: 999px;
    width: 320px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-glow), 0 4px 12px rgba(79, 70, 229, 0.15);
    width: 380px;
    transform: translateY(-1px);
}

.header-search i {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-profile span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.theme-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(14, 165, 233, 0.05));
    transform: rotate(20deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* VISTAS (SPA) */
.content-view {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-view.active {
    display: block;
}

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

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.view-header.back-header {
    justify-content: space-between;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

