/* ==========================================================================
   CONFIGURACIÓN DE VARIABLES (Design Tokens)
   ========================================================================== */
:root {
    /* Paleta Corporativa Capital 7 */
    --brand-red: rgb(204, 0, 51);
    --brand-red-dark: #8d0801;
    --dark: rgb(74, 79, 84);
    --dark-soft: #4a4f54;
    --white: rgb(241, 241, 241);
    
    /* Escala de Grises */
    --grey-100: rgb(241, 241, 241);
    --grey-200: rgb(164, 164, 164);
    --grey-300: #b0b0b0;
    --grey-400: #999999;
    --grey-600: #6c757d;
    --grey-800: rgb(74, 79, 84);

    /* Semántica */
    --primary: var(--brand-red);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    /* Tokens de Diseño Pro */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --radius: 10px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & ESTILOS BASE
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    line-height: 1.6; 
    color: var(--grey-800); 
    background-color: var(--grey-100); 
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

/* ==========================================================================
   LAYOUT: NAV & CONTAINER
   ========================================================================== */
.navbar { 
    background-color: var(--dark); 
    padding: 0 2rem; 
    height: 70px;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--brand-red);
}

.navbar .brand { 
    font-size: 1.4rem; 
    font-weight: 900; 
    letter-spacing: -1px; 
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.navbar .brand span { color: var(--brand-red); }

/* Menú hamburguesa (Oculto en Desktop) */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.user-info {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a { 
    color: var(--grey-300); 
    text-decoration: none; 
    font-size: 0.9rem; 
    margin-left: 28px; 
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover { color: var(--white); }

.container { 
    max-width: 1150px; 
    margin: 3rem auto; 
    background: var(--white); 
    padding: 3rem; 
    border-radius: var(--radius); 
    box-shadow: var(--shadow-md); 
    border: 1px solid var(--grey-200);
}

/* ==========================================================================
   COMPONENTES: BOTONES & FORMULARIOS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { 
    background: var(--brand-red-dark); 
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(217, 4, 41, 0.3);
}

.btn-secondary { background: var(--grey-600); color: var(--white); }
.btn-secondary:hover { background: var(--dark); transform: translateY(-2px); }

.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 0.9rem; }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--grey-200);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--grey-100);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-red);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(217, 4, 41, 0.1);
}

/* ==========================================================================
   TABLAS & DATOS
   ========================================================================== */
.table-container { 
    background: var(--white);
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--grey-200);
}

table { 
    width: 100%; 
    min-width: 850px;
    border-collapse: collapse; 
}

th { 
    background: var(--dark);
    color: var(--white);
    text-align: left; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    padding: 15px; 
    letter-spacing: 1px;
}

td { 
    padding: 14px 15px; 
    border-bottom: 1px solid var(--grey-100); 
    font-size: 0.9rem; 
}

tr:hover td { background-color: rgba(204, 0, 51, 0.02); }

/* Etiquetas de Estado (Badges) */
.status-badge { 
    padding: 5px 12px; 
    font-size: 0.75rem; 
    font-weight: 700; 
    border-radius: 20px;
    display: inline-block;
}
.bg-completed { background: #d1fae5; color: #065f46; }
.bg-correction { background: #fee2e2; color: #b91c1c; }
.bg-following {
    background: #e8df2a;       /* Verde intenso */
    color: #423333;            /* Texto blanco para contraste */
    font-weight: 600;
    border-radius: 20px;       /* Mucho más redondo */
    padding: 6px 12px;         /* Espaciado interno uniforme */
    border: 1px solid #5a8f0f; /* Borde más oscuro para definición */
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Sombra ligera para resaltar */
}



/* ==========================================================================
   DROPDOWN MENU
   ========================================================================== */
.dropdown { position: relative; margin-left: 28px; }

.dropdown-btn {
    background: none; border: none; color: var(--grey-300);
    font-size: 0.9rem; font-weight: 500; cursor: pointer;
    padding: 5px 0; transition: var(--transition);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%; right: 0;
    background-color: var(--dark-soft);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    z-index: 1001;
}

.dropdown:hover .dropdown-content { display: block; }

.dropdown-content a {
    color: var(--grey-200);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
}

.dropdown-content a:hover { background-color: var(--brand-red); color: var(--white); }

/* ==========================================================================
   USUARIO & AUTH
   ========================================================================== */
.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    margin-left: 28px;
}

.user-greeting { font-size: 0.85rem; color: var(--grey-200) !important; font-weight: 500; }
.user-greeting strong { color: var(--white) !important; font-weight: 700; }

.logout-link-simple {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.login-container { max-width: 420px; margin: 5rem auto; padding: 0 1rem; }
.login-card { background: var(--white); padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--grey-200); }

/* Mensajes de Feedback */
.messages { list-style: none; margin: 1rem 0; }
.messages li {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 0.75rem;
    font-weight: 600; border-left: 5px solid transparent;
}
.messages .success { background: #d1fae5; color: #065f46; border-color: var(--success); }
.messages .error { background: #fee2e2; color: #b91c1c; border-color: var(--danger); }

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE)
   ========================================================================== */
@media (max-width: 992px) {
    .navbar { padding: 0 1.5rem; }
    .mobile-menu-btn { display: block; }
    
    .user-info {
        display: none; 
        position: absolute;
        top: 70px; left: 0; width: 100%;
        background-color: var(--dark);
        flex-direction: column;
        padding: 2rem;
        border-bottom: 3px solid var(--brand-red);
        z-index: 999;
    }

    .user-info.active { display: flex !important; }

    .nav-links {
        flex-direction: column;
        width: 100%;
        align-items: flex-start;
    }

    .nav-links a, .dropdown, .dropdown-btn {
        margin-left: 0;
        width: 100%;
        padding: 12px 0;
        text-align: left;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .dropdown-content { position: static; width: 100%; background: rgba(0,0,0,0.1); box-shadow: none; }

    .user-meta {
        align-items: flex-start;
        margin-left: 0;
        margin-top: 20px;
        padding-top: 15px;
        border-top: 1px solid rgba(255,255,255,0.1);
        width: 100%;
    }

    .container { padding: 1.5rem; margin: 1.5rem 1rem; }
}

@media (max-width: 576px) {
    .navbar { padding: 0 1rem; }
    .brand { font-size: 1.1rem; }
    .container { padding: 1.25rem; }
    .btn { width: 100%; }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.main-footer {
    flex-shrink: 0; /* Evita que el footer se encoja */
    padding: 30px 20px;
    text-align: center;
    color: var(--grey-400);
    font-size: 0.85rem;
    border-top: 1px solid var(--grey-200);
    background-color: var(--grey-100); /* Para que combine con el fondo */
}

/* ==========================================================================
   SUPER FIX LOGIN (Eliminar estiramiento)
   ========================================================================== */

/* 1. Resetear el contenedor padre si estamos en login */
.login-override {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0; /* Esto le da espacio arriba y abajo */
}

/* 2. Ocultar el marco blanco gigante del base.html cuando es login */
/* Esto busca al padre del login y le quita el fondo y sombra */
.container:has(.login-override) {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    margin-top: 0 !important;
}

/* 3. Estilo de la tarjeta de login */
.login-card {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border: 1px solid var(--grey-200);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-brand img {
    height: 90px;
    width: auto;
}

.login-title {
    color: var(--dark);
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 4. Inputs de Django (Forzar que se vean bien) */
.login-card input {
    width: 100% !important;
    display: block !important;
    padding: 14px !important;
    margin-top: 8px !important;
    margin-bottom: 20px !important;
    border: 2px solid var(--grey-200) !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    background-color: var(--grey-100) !important;
}

.login-card input:focus {
    border-color: var(--brand-red) !important;
    background-color: white !important;
    outline: none;
}

/* 5. El botón de Entrar */
.btn-login {
    width: 100% !important;
    padding: 16px !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    margin-top: 10px !important;
}

/* Responsive para pantallas muy pequeñas */
@media (max-width: 480px) {
    .login-override {
        width: 90%;
        top: 45%;
    }
    .login-card {
        padding: 1.5rem;
    }
}

/* ==========================================================================
   SOLO TABLA DE REPORTES
   ========================================================================== */


/* Solo para tablas que necesiten mucho espacio horizontal */
.table-report {
    min-width: 1500px !important; /* Fuerza a la tabla a ser ancha */
}

/* Opcional: Para que las celdas no intenten romper la línea */
.table-report th, .table-report td {
    white-space: nowrap; 
}

/* ==========================================================================
   FIX PARA INPUTS DE FECHA Y MES (Compatibilidad Chrome y Firefox)
   ========================================================================== */

/* 1. Icono del calendario visible en Chrome, Edge y Safari */
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    padding: 5px;
    filter: invert(0.4);
}

/* 2. Altura consistente para todos los navegadores */
input[type="month"], 
input[type="date"] {
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* 3. Asegurar fondo blanco en foco */
.form-control:focus {
    background-color: #ffffff !important;
}

/* 4. FIX ESPECÍFICO PARA FIREFOX (Porque no soporta type="month" nativo) */
@-moz-document url-prefix() {
    input[type="month"] {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666' class='bi bi-calendar' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 18px;
        cursor: pointer;
        padding-right: 40px; /* Espacio para que el texto no tape el icono */
    }
} /* <--- IMPORTANTE: Esta llave cierra el bloque de Firefox */

/* ==========================================================================
   TOOLTIPS DE AYUDA (ícono "?")
   ========================================================================== */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--grey-600);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
    cursor: help;
    position: relative;
    transition: var(--transition);
}

.help-icon:hover,
.help-icon:focus {
    background: var(--brand-red);
    color: #ffffff;
    text-decoration: none;
}

.help-icon[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--dark);
    color: #ffffff;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.help-icon[data-tip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--dark);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
    z-index: 1000;
}

.help-icon[data-tip]:hover::after,
.help-icon[data-tip]:focus::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.help-icon[data-tip]:hover::before,
.help-icon[data-tip]:focus::before {
    opacity: 1;
    visibility: visible;
}
