/* =========================================================================
   STYLES.CSS - MIDNIGHT AURORA PREMIUM (High-End Dark Identity)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Paleta Abisal - Tema Oscuro (Alto contraste) */
    --bg-base: #000000;
    --bg-surface: #0a0a0a;
    --bg-surface-hover: #141414;
    --input-bg: #0f0f0f;

    /* Acentos - Manteniendo identidad púrpura premium */
    --accent-cyan: #00f5ff;
    --accent-violet: #a855f7;
    --accent-magenta: #ec4899;
    --primary: var(--accent-violet);
    --primary-glow: rgba(168, 85, 247, 0.4);

    /* Estados y Textos (Alto contraste absoluto) */
    --text-high: #ffffff;
    --text-med: #cccccc;
    --text-low: #888888;
    --border: #333333;
    --border-glow: var(--accent-violet);
    --danger: #ff4b4b;

    /* Geometría */
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition: all 0.3s ease;
}

:root[data-theme="light"] {
    --bg-base: #ffffff;
    --bg-surface: #fcfcfc;
    --bg-surface-hover: #f5f5f5;
    --input-bg: #ffffff;

    /* Textos negros absolutos en tema claro */
    --text-high: #000000;
    --text-med: #1a1a1a;
    --text-low: #444444;
    --border: #dddddd;
    --border-glow: var(--accent-violet);

    --glass-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-high);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Fondo Plano y Limpio */
.mesh-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--bg-base);
}

.container {
    max-width: 1000px;
    margin: 4rem auto;
    padding: 0 2rem;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cabecera Premium */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
    padding: 2.5rem 3rem;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--glass-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-top: -4rem;
    /* Compensar el margen del contenedor para que se pegue arriba */
    padding: 1.5rem 3rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 100%;
    transition: all 0.3s ease;
}

/* Connection Status Badge */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-med);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: var(--text-low);
}

.status-online .status-dot {
    background: #00ff88;
    box-shadow: 0 0 10px #00ff88;
}

.status-offline .status-dot {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.status-warning .status-dot {
    background: #ffaa00;
    box-shadow: 0 0 10px #ffaa00;
}

.status-online { border-color: rgba(0, 255, 136, 0.2); }
.status-offline { border-color: rgba(255, 75, 75, 0.2); }
.status-warning { border-color: rgba(255, 170, 0, 0.2); }

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 154px;
}

.logo-preview {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: var(--bg-base);
    cursor: pointer;
    transition: var(--transition);
}

.logo-preview:hover {
    border-color: var(--accent-violet);
    background: rgba(168, 85, 247, 0.05);
}

.logo-placeholder {
    font-size: 0.75rem;
    color: var(--text-low);
    text-align: center;
    padding: 0.5rem;
}

.file-input {
    width: 100%;
    font-size: 0.7rem;
    padding: 0.4rem;
    background: transparent;
    border: none;
}

.title-section {
    flex: 2;
}

.title-section h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(to right, #fff, var(--accent-violet));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-section p {
    color: var(--text-med);
    font-weight: 300;
    font-size: 1rem;
}

/* Tarjetas Midnight Glass */
.card,
.login-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    padding: 3.5rem 3rem;
    border: 1px solid var(--border);
    box-shadow: var(--glass-shadow);
    margin-bottom: 2.5rem;
    transition: var(--transition);
}

.card:hover,
.login-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-5px);
    box-shadow: 0 25px 60px rgba(168, 85, 247, 0.15);
}

.card-compact {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.card-compact:hover {
    border-color: var(--border-glow);
    background: var(--bg-surface-hover);
    transform: translateX(5px);
}

.card h2 {
    font-size: 1.6rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card h2::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--accent-violet);
    border-radius: 2px;
}

/* Formularios Elegantes */
.form-group {
    margin-bottom: 2rem;
}

.form-group.row {
    display: flex;
    gap: 2rem;
}

.col {
    flex: 1;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-med);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

input,
textarea,
select {
    width: 100%;
    padding: 1.1rem 1.25rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-high);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--accent-violet);
    background: rgba(168, 85, 247, 0.05);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

input::placeholder {
    color: var(--text-low);
}

/* Botones con Glow */
.btn-submit {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-magenta));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 99px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.3);
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-submit:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(236, 72, 153, 0.5);
    filter: brightness(1.1);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
}

.dashboard-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    padding: 3.5rem 2.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.dashboard-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent-cyan);
    transform: translateY(-10px);
    box-shadow: 0 30px 60px rgba(0, 245, 255, 0.15);
}

.dash-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
}

.dashboard-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.dashboard-card p {
    color: var(--text-med);
    font-size: 0.95rem;
    font-weight: 300;
}

/* Firma y Canvas con Estética Refinada */
.signature-container {
    background: #ffffff;
    border-radius: var(--radius-md);
    position: relative;
    padding: 12px;
    border: 3px solid var(--border);
    border-style: solid;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.signature-container::before {
    content: "FIRME AQUÍ";
    position: absolute;
    bottom: 5px;
    right: 15px;
    font-size: 0.65rem;
    font-weight: 800;
    color: #cccccc;
    letter-spacing: 0.2em;
    pointer-events: none;
}

canvas {
    width: 100%;
    height: 250px;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><circle cx="8" cy="8" r="4" fill="black"/></svg>') 8 8, crosshair;
    background: #ffffff;
}

/* Adaptación de Imágenes para tema oscuro (asegurar visibilidad) */
#institucionLogo,
#imagenPreview {
    background-color: #ffffff;
    /* Fondo blanco para logos que puedan tener texto negro o transparente */
    padding: 10px;
    border-radius: 8px;
    max-width: 100%;
}

.btn-clear {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-clear:hover {
    background: var(--danger);
}

/* Usuarios y Menú */
.user-info {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-violet);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
}

.user-dropdown-container {
    position: relative;
    z-index: 101;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 260px;
    padding: 0.75rem;
    box-shadow: var(--glass-shadow);
    z-index: 1000;
}

.dropdown-item {
    width: 100%;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-high);
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 1.5rem;
    color: var(--accent-cyan);
}

/* Tablas Premium */
.users-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

.users-table th {
    padding: 1rem;
    text-align: left;
    color: var(--text-low);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.users-table td {
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.users-table tr td:first-child {
    border-left: 1px solid var(--border);
    border-radius: 15px 0 0 15px;
}

.users-table tr td:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 15px 15px 0;
}

.users-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(168, 85, 247, 0.3);
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.admin {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge.user {
    background: rgba(0, 245, 255, 0.1);
    color: #22d3ee;
    border: 1px solid rgba(0, 245, 255, 0.2);
}

/* =========================================================================
   LOGIN PREMIUM (Glassmorphism & Animaciones Dinámicas)
   ========================================================================= */

/* Fondo dinámico animado exclusivo para el Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top right, #1a0b2e, #000000);
}

.login-container::before,
.login-container::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.5;
    animation: floatingOrbs 15s infinite alternate ease-in-out;
}

.login-container::before {
    background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.login-container::after {
    background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes floatingOrbs {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(50px, -50px) scale(1.1);
    }

    100% {
        transform: translate(-30px, 40px) scale(0.9);
    }
}

/* Tarjeta Glassmorphism */
.login-card {
    max-width: 420px;
    width: 100%;
    margin: 0 1rem;
    padding: 3.5rem 2.5rem;
    text-align: center;
    position: relative;
    z-index: 10;

    /* El truco del cristal premium */
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);

    animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card:hover {
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 0 30px 60px rgba(168, 85, 247, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.login-header {
    margin-bottom: 2.5rem;
}

.login-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.login-header p {
    color: var(--text-med);
    font-size: 0.95rem;
    font-weight: 300;
}

/* Floating Labels Inputs */
.input-floating {
    position: relative;
    margin-bottom: 2rem;
    text-align: left;
}

.input-floating input {
    width: 100%;
    padding: 1.2rem 1.2rem 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-high);
    font-size: 1.05rem;
    transition: all 0.3s ease;
}

.input-floating input:focus {
    background: rgba(168, 85, 247, 0.05);
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
}

.input-floating label {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-low);
    font-size: 1rem;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.2s ease-out;
    letter-spacing: normal;
    text-transform: none;
    margin: 0;
}

/* Estado activo/foco del label flotante */
.input-floating input:focus~label,
.input-floating input:not(:placeholder-shown)~label {
    top: 5px;
    transform: translateY(0);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-violet);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Botón Premium */
.btn-premium {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.4);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.btn-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    transition: all 0.5s ease;
}

.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(168, 85, 247, 0.6);
}

.btn-premium:hover::after {
    left: 150%;
}

.forgot-pass-link {
    display: inline-block;
    color: var(--text-med);
    font-size: 0.85rem;
    text-decoration: none;
    margin-top: 1.5rem;
    transition: color 0.2s ease;
}

.forgot-pass-link:hover {
    color: var(--accent-cyan);
}


/* =========================================================================
   MODALES PREMIUM (Centrado Perfecto y Animaciones)
   ========================================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    /* Centrado vertical */
    justify-content: center;
    /* Centrado horizontal */
    z-index: 9999;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 2rem 2.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(to right, var(--text-high), var(--accent-violet));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-body {
    padding: 0 2.5rem 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Ajustes específicos para el tema claro en modales */
:root[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.15);
}

:root[data-theme="light"] .modal-card {
    background: var(--bg-surface);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* =========================================================================
   MEDIA QUERIES - RESPONSIVE
   ========================================================================= */

@media (max-width: 768px) {
    .container {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }

    .app-header {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
        margin-bottom: 2rem;
    }

    .modal-card {
        padding: 1.5rem;
        max-width: 95%;
    }

    .form-group.row {
        flex-direction: column;
        gap: 1rem;
    }
}
/* =========================================================================
   ESTILOS ADICIONALES: TOASTS Y ESTADÍSTICAS
   ========================================================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    padding: 12px 20px;
    background: var(--bg-surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-high);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s ease-out forwards;
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--accent-violet);
    animation: toastProgress 4s linear forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

.toast.success { border-left: 5px solid #10b981; }
.toast.success::after { background: #10b981; }
.toast.error { border-left: 5px solid #ff4b4b; }
.toast.error::after { background: #ff4b4b; }
.toast.warning { border-left: 5px solid #ffaa00; }
.toast.warning::after { background: #ffaa00; }
.toast.info { border-left: 5px solid var(--accent-cyan); }
.toast.info::after { background: var(--accent-cyan); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-surface);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-violet);
    transform: translateY(-5px);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-high);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-med);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* =========================================================================
   SIDEBAR PREMIUM (Glassmorphism & Navigation)
   ========================================================================= */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar.collapsed { width: 80px; }

.brand {
    padding: 2.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    white-space: nowrap;
}

.brand-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--primary-glow);
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--accent-violet));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .brand-name { opacity: 0; }

.nav-menu {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-low);
    margin: 1.5rem 0 0.75rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: var(--text-med);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 0.25rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.15), transparent);
    color: #fff;
    border-left: 4px solid var(--accent-violet);
    box-shadow: inset 5px 0 15px rgba(168, 85, 247, 0.1);
}

.sidebar.collapsed .nav-item {
    padding: 0.9rem 0;
    justify-content: center;
    gap: 0;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-label { transition: opacity 0.3s ease; white-space: nowrap; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.sidebar-toggle {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: center;
}

.btn-toggle-sidebar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--text-med);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-sidebar:hover {
    background: var(--accent-violet);
    color: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
}

.content-area {
    flex: 1;
    margin-left: 280px;
    transition: margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.content-area.collapsed { margin-left: 80px; }

.main-layout { display: flex; width: 100%; }

.app-header {
    margin-top: 0 !important;
    border-radius: 0 !important;
    position: sticky !important;
    top: 0 !important;
}

/* =========================================================================
   ADAPTIVE NAVIGATION (Floating FAB & Adaptive Menu)
   ========================================================================= */

/* FAB - Botón Flotante Arrastrable */
.menu-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    cursor: grab;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--primary-glow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    -webkit-user-drag: none;
}

.menu-fab:active { cursor: grabbing; transform: scale(0.9); }
.menu-fab:hover { transform: scale(1.1); }

/* Menú Adaptativo Base */
.adaptive-menu {
    position: fixed;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2999;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* Modo Flotante */
.adaptive-menu.mode-floating {
    bottom: 100px;
    right: 30px;
    width: 300px;
    max-height: 0;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.adaptive-menu.mode-floating.active {
    max-height: 80vh;
    opacity: 1;
    pointer-events: all;
    transform: translateY(-10px);
}

/* Modo Fijo (Sidebar) */
.adaptive-menu.mode-fixed {
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    border-radius: 0;
    border-left: none;
    transform: translateX(-100%);
}

.adaptive-menu.mode-fixed.active {
    transform: translateX(0);
}

/* Elementos Internos del Menú */
.menu-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-minimal {
    font-weight: 800;
    font-size: 1.2rem;
    background: linear-gradient(to right, #fff, var(--accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-close-menu {
    background: none;
    border: none;
    color: var(--text-med);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.btn-close-menu:hover { color: #fff; }

.menu-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.menu-section {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-low);
    margin: 1.5rem 0 0.5rem 0.5rem;
    letter-spacing: 2px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    color: var(--text-med);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 4px;
}

.menu-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.menu-item.active {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.1), transparent);
    color: var(--accent-cyan);
    border-left: 3px solid var(--accent-cyan);
}

.menu-icon { font-size: 1.2rem; width: 24px; text-align: center; }

/* Panel de Personalización */
.custom-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.custom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-med);
}

.custom-row select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-high);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    outline: none;
}

/* RESET DE LAYOUT ANTERIOR */
.main-layout { display: block; }
.content-area { margin-left: 0 !important; width: 100%; transition: none; }
.sidebar { display: none !important; }

/* RE-CENTRAR CONTENEDORES */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Icon Sets Fixes via classes if needed */
.icon-modern .menu-icon { font-weight: bold; }
.icon-minimal .menu-icon { font-size: 1rem; opacity: 0.8; }
