/* ==========================================================================
   1. VARIABLES GLOBALES (Paleta RFN Control)
   ========================================================================== */
:root {
    /* --- Dimensiones --- */
    --sidebar-width: 260px;
    --navbar-height: 70px;
    /* --- Colores RFN CONTROL --- */
    --brand-red: #B01E44; /* Rojo principal (Acciones, Botones, Foco) */
    --brand-red-dark: #8a1735; /* Rojo más oscuro para hover */
    --brand-gold: #9FAB48; /* Dorado/Oliva secundario (Acentos) */
    --brand-dark: #2C2C2C; /* Gris oscuro (Texto principal, títulos) */
    --brand-gray: #545454; /* Gris medio (Subtítulos, iconos inactivos) */
    /* --- Fondos y Estructura --- */
    --bg-body: #f4f5f7; /* Fondo general de la app interna */
    --bg-login: #1a1a1a; /* Fondo OSCURO para Login (Estilo CrossLink) */
    --bg-surface: #ffffff; /* Blanco puro */
    --border-color: #e2e8f0; /* Bordes suaves */
    /* --- Textos --- */
    --text-main: #1e293b;
    --text-muted: #64748b;
    /* --- Estados --- */
    --hover-bg: rgba(176, 30, 68, 0.05); /* Fondo rojizo muy suave al pasar mouse */
    --active-border: var(--brand-red); /* Borde activo */
}

/* ==========================================================================
   2. ESTILOS GENERALES
   ========================================================================== */
html, body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--brand-red);
    transition: color 0.2s;
}

    a:hover {
        color: var(--brand-red-dark);
    }

/* ==========================================================================
   3. ESTRUCTURA PRINCIPAL (LAYOUT DASHBOARD)
   ========================================================================== */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ==========================================================================
   4. SIDEBAR (Restaurado y ajustado a colores RFN)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
}

/* Cabecera del Sidebar */
.sidebar-header {
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

    /* ¡ESTA CLASE ARREGLA EL LOGO GIGANTE! */
    .sidebar-header .logo-image {
        height: 32px;
        width: auto;
        margin-right: 12px;
    }

    /* Títulos del logo en el sidebar */
    .sidebar-header .logo-text-container {
        display: flex;
        flex-direction: column;
        line-height: 1.1;
    }

    .sidebar-header .logo-title {
        font-size: 1.1rem;
        font-weight: 800;
        color: var(--brand-dark); /* Antes era navy, ahora gris oscuro RFN */
        letter-spacing: -0.5px;
    }

    .sidebar-header .logo-subtitle {
        font-size: 0.75rem;
        color: var(--brand-gold); /* Detalle dorado RFN */
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

/* Navegación */
.sidebar-nav {
    list-style: none;
    padding: 1.5rem 1rem;
    margin: 0;
    overflow-y: auto;
}

    .sidebar-nav li {
        margin-bottom: 4px;
    }

        .sidebar-nav li a {
            display: flex;
            align-items: center;
            padding: 0.75rem 1rem;
            color: var(--text-muted);
            font-weight: 500;
            font-size: 0.95rem;
            border-radius: 8px;
            transition: all 0.2s ease;
            position: relative;
        }

            .sidebar-nav li a .icon, .sidebar-nav li a i {
                font-size: 1.25rem;
                margin-right: 12px;
                color: #94a3b8;
                transition: color 0.2s;
                display: flex;
                align-items: center;
                justify-content: center;
                width: 24px;
            }

            /* Estados Hover y Active (Con Rojo RFN) */
            .sidebar-nav li a:hover,
            .sidebar-nav li a.active {
                background-color: var(--hover-bg);
                color: var(--brand-red);
            }

                .sidebar-nav li a:hover .icon,
                .sidebar-nav li a.active .icon,
                .sidebar-nav li a:hover i,
                .sidebar-nav li a.active i {
                    color: var(--brand-red);
                }

                /* Indicador lateral rojo */
                .sidebar-nav li a.active::before {
                    content: '';
                    position: absolute;
                    left: 0;
                    top: 50%;
                    transform: translateY(-50%);
                    height: 20px;
                    width: 4px;
                    background-color: var(--brand-red);
                    border-radius: 0 4px 4px 0;
                }

/* ==========================================================================
   5. NAVBAR SUPERIOR (Restaurado)
   ========================================================================== */
.top-navbar {
    height: var(--navbar-height);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--brand-dark);
    margin: 0;
}

.navbar-left, .navbar-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.navbar-center {
    flex: 2;
    text-align: center;
}

.navbar-right {
    justify-content: flex-end;
}

.user-info {
    color: var(--text-muted);
    padding: 8px;
    border-radius: 50%;
    transition: color 0.2s;
}

    .user-info:hover {
        background-color: var(--hover-bg);
        color: var(--brand-red);
    }

/* ==========================================================================
   6. CONTENIDO PRINCIPAL Y UTILIDADES
   ========================================================================== */
main[role="main"] {
    padding: 2rem;
    flex: 1;
}

.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border-radius: 12px;
    background: #fff;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Botones genéricos actualizados a Rojo RFN */
.btn-primary {
    background-color: var(--brand-red);
    border-color: var(--brand-red);
}

    .btn-primary:hover {
        background-color: var(--brand-red-dark);
        border-color: var(--brand-red-dark);
    }

.form-control:focus, .form-select:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(176, 30, 68, 0.15);
}

/* ==========================================================================
   7. ESTILOS ESPECÍFICOS DEL LOGIN (Aislados)
   ========================================================================== */
/* Solo aplica cuando el body tiene la clase .login-page */
body.login-page {
    background-color: var(--bg-login) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Evita scrolls innecesarios en login */
}

.login-card {
    background: var(--bg-surface);
    width: 100%;
    max-width: 450px;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-logo-img {
    max-height: 80px;
    width: auto;
    margin-bottom: 1.5rem;
}

.login-title {
    color: var(--brand-dark);
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--brand-gray);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.login-input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

    .login-input-group label {
        display: block;
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--brand-dark);
        margin-bottom: 0.6rem;
    }

.input-wrapper {
    position: relative;
}

    .input-wrapper i {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: #a0aec0;
        font-size: 1.2rem;
        transition: color 0.3s ease;
        z-index: 2;
    }

    .input-wrapper .form-control {
        padding-left: 50px;
        height: 52px;
        border-radius: 10px;
        border: 2px solid var(--border-color);
        background-color: #f8fafc;
    }

        .input-wrapper .form-control:focus {
            background-color: #fff;
            border-color: var(--brand-red);
            box-shadow: 0 0 0 4px rgba(176, 30, 68, 0.15);
        }

            .input-wrapper .form-control:focus + i {
                color: var(--brand-red);
            }

.btn-rfn-primary {
    background-color: var(--brand-red);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 14px;
    border-radius: 10px;
    border: none;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(176, 30, 68, 0.2);
}

    .btn-rfn-primary:hover {
        background-color: var(--brand-red-dark);
        transform: translateY(-2px);
        box-shadow: 0 7px 14px rgba(176, 30, 68, 0.3);
    }

.login-footer {
    margin-top: 2.5rem;
    font-size: 0.95rem;
    color: var(--brand-gray);
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

    .login-footer a, .forgot-link {
        color: var(--brand-dark);
        font-weight: 600;
    }

/* =========================================
   8. AJUSTES ESPECÍFICOS MÓVIL (Toggles y Sidebar)
   ========================================= */
@media (max-width: 991.98px) {
    /* 1. Ocultar el sidebar desplazándolo hacia la izquierda por defecto */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: none;
    }

        /* 2. Clase dinámica que agregará jQuery para mostrar el sidebar */
        .sidebar.show {
            transform: translateX(0);
            box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15); /* Sombra un poco más fuerte para separar del fondo */
        }

    /* 3. El contenido principal debe ocupar toda la pantalla */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* 4. Ajuste para el botón hamburguesa (navbar) con los colores de Refine */
    #sidebarToggle {
        padding: 0.35rem 0.5rem;
        border-color: transparent;
        color: var(--brand-dark); /* Usamos el gris oscuro principal */
        background: transparent;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

        #sidebarToggle:hover,
        #sidebarToggle:active,
        #sidebarToggle:focus {
            background-color: var(--hover-bg); /* Fondo rojizo suave */
            color: var(--brand-red); /* Rojo principal de Refine */
            outline: none;
        }

    /* Opcional: Reducir un poco el padding superior/inferior del navbar en móviles */
    .top-navbar {
        padding: 0 1rem;
    }
}
/* ========================================
   TARJETAS SELECCIONABLES (Reutilizable)
   ======================================== */
.card-selectable {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 2px solid transparent !important;
    background-color: #fff;
}

    .card-selectable:hover {
        background-color: rgba(176, 30, 68, 0.04) !important;
        border-color: rgba(176, 30, 68, 0.2) !important;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    }

    .card-selectable.selected {
        background-color: rgba(176, 30, 68, 0.08) !important;
        border-color: var(--brand-red) !important;
        box-shadow: 0 2px 8px rgba(176, 30, 68, 0.15) !important;
    }
