/* --- MIGRATION: style.css contents --- */
/* ==========================================================================
   SIMULADOR CAP - HOJA DE ESTILOS PRINCIPAL
   ========================================================================== */

/* =========================================
   1. VARIABLES GLOBALES (PALETA)
   ========================================= */
:root {
    --bg-body: #f0f2f5;
    --bg-header: #1e293b;
    --card-bg: #ffffff;
    --text-main: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    --primary: #1c75bc;
    --primary-light: #3498db;
    --primary-hover: #155e96;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f59e0b;
    --info: #3498db;

    /* Variables de Botones */
    --btn-radius: 8px;
    --btn-border-width: 0px;
    --btn-border-color: transparent;
    --btn-primary-bg: var(--primary);
    --btn-danger-bg: var(--danger);
    --btn-success-bg: var(--success);
    --btn-warning-bg: var(--warning);
    --btn-secondary-bg: #64748b;

    --login-bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #2c3e50 100%);
    --btn-gradient-login: linear-gradient(135deg, #3498db 0%, #1c75bc 100%);
    --btn-shadow-login: 0 8px 18px rgba(28, 117, 188, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* =========================================
   2. RESETEO Y BASE
   ========================================= */
body,
html {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

/* Scrollbar Corporativo */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* =========================================
   3. UTILIDADES GLOBALES (Espaciados, Textos, Flex)
   ========================================= */
/* Display / Visibilidad */
.hidden,
.hidden-element {
    display: none !important;
}

.ws-nowrap,
.white-space-nowrap {
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.opacity-50 {
    opacity: 0.5;
}

/* Márgenes */
.m-0,
.margin-0 {
    margin: 0;
}

.mt-0,
.m-top-0 {
    margin-top: 0;
}

.mt-5,
.margin-t-5 {
    margin-top: 5px;
}

.mt-10,
.margin-t-10 {
    margin-top: 10px;
}

.mt-15,
.margin-t-15 {
    margin-top: 15px;
}

.mt-20,
.margin-t-20 {
    margin-top: 20px;
}

.mt-25,
.margin-t-25 {
    margin-top: 25px;
}

.mb-5,
.m-bottom-0 {
    margin-bottom: 5px;
}

/* Ajuste de nombre para consistencia */
.margin-b-15 {
    margin-bottom: 15px;
}

.margin-b-30 {
    margin-bottom: 30px;
}

/* Paddings */
.p-20 {
    padding: 20px;
}

.p-30 {
    padding: 30px;
}

.pl-10 {
    padding-left: 10px;
}

.padding-12 {
    padding: 12px;
}

/* Flexbox */
.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.flex-row {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-gap-10,
.gap-10 {
    display: flex;
    gap: 10px;
}

.justify-center {
    justify-content: center;
}

.flex-centro-gap {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Textos y Colores */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.align-middle,
.td-centro-vertical {
    vertical-align: middle;
    text-align: center;
}

.font-bold {
    font-weight: bold;
}

.fs-11 {
    font-size: 1.1em;
}

.fs-90 {
    font-size: 0.9em;
}

.fs-85 {
    font-size: 0.85em;
}

.fs-80 {
    font-size: 0.8em;
}

.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-info {
    color: var(--info);
}

/* --- DISTINTIVOS PREMIUM --- */
.badge-premium {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white !important;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 0.65em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
    position: relative;
    overflow: hidden;
    vertical-align: middle;
    margin-left: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    user-select: none;
    cursor: default;
}

.badge-premium::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -60%;
    width: 25%;
    height: 200%;
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(30deg);
    animation: shimmer-premium 4s infinite;
}

@keyframes shimmer-premium {
    0% {
        left: -60%;
    }

    15% {
        left: 140%;
    }

    100% {
        left: 140%;
    }
}


.text-main {
    color: var(--text-main);
}

/* Anchos */
.w-100 {
    width: 100%;
}

.w-50 {
    width: 50px;
}

.min-w-250 {
    min-width: 250px;
}

.min-w-150 {
    min-width: 150px;
}

.fixed-w-200 {
    width: 200px;
    flex-shrink: 0;
}

/* Misc */
.no-underline {
    text-decoration: none;
}

.link-fuerte {
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
}

.divisor-dashed {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 15px 0;
}

.border-l-info {
    border-left: 3px solid var(--info);
}

/* =========================================
   4. LAYOUT PRINCIPAL (Header y Container)
   ========================================= */
.top-bar {
    background-color: var(--bg-header);
    color: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

.nav-links a {
    color: #f8fafc;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.05em;
    transition: color 0.2s;
}

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

.nav-links a.active {
    color: #a7f3d0;
}

.container {
    width: 85%;
    max-width: 1600px;
    margin: 40px auto;
    padding: 35px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.container-ampliado {
    width: 95%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.layout-columnas {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.columna-derecha {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
}

/* Dropdown Navbar */
.nav-dropdown {
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
    margin-bottom: -15px;
}

.nav-dropbtn {
    background: transparent;
    color: #f8fafc;
    font-size: 1.05em;
    font-weight: bold;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.nav-dropdown:hover .nav-dropbtn {
    color: var(--info);
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-header);
    min-width: 200px;
    box-shadow: 0px 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    border-radius: 8px;
    top: 100%;
    left: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.nav-dropdown-content a {
    color: #f8fafc;
    padding: 14px 18px;
    display: block;
    font-size: 0.95em;
    transition: background 0.2s, padding-left 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-dropdown-content a:last-child {
    border-bottom: none;
}

.nav-dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary-light);
    padding-left: 24px;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
    animation: dropFade 0.2s ease-out;
}

@keyframes dropFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   5. BOTONES Y BADGES
   ========================================= */
.btn {
    padding: 12px 22px;
    border: var(--btn-border-width) solid var(--btn-border-color);
    border-radius: var(--btn-radius);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95em;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--btn-danger-bg);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-cancel {
    background-color: var(--text-muted);
    color: white;
}

.btn-cancel:hover {
    background: #475569;
}

.btn-warning {
    background-color: var(--btn-warning-bg);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-success {
    background: var(--btn-success-bg);
    color: white;
}

.btn-secondary {
    background-color: var(--btn-secondary-bg);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info-custom {
    background-color: #17a2b8;
    color: white;
    border: none;
}

.btn-purple {
    background: #8b5cf6;
    color: white;
}

.btn-small,
.btn-small-action {
    padding: 8px 15px;
    font-size: 0.9em;
    border-radius: var(--btn-radius);
    border: var(--btn-border-width) solid var(--btn-border-color);
    cursor: pointer;
}

.btn-secondary-small {
    background: var(--btn-secondary-bg);
    color: white;
    padding: 5px 10px;
    font-size: 0.8em;
    border: var(--btn-border-width) solid var(--btn-border-color);
    border-radius: var(--btn-radius);
    cursor: pointer;
    transition: 0.2s;
}

.btn-secondary-small:hover {
    background: #475569;
}

.btn-px {
    padding: 6px 15px;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.9em;
}

.btn-toggle-info {
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
    margin-top: 10px;
    transition: 0.2s;
}

.btn-toggle-info:hover {
    color: var(--primary);
}

.disabled-btn {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Botones full-width */
.btn-full-width {
    width: 100%;
    padding: 12px;
    font-weight: bold;
    box-sizing: border-box;
}

.btn-full-width-disabled {
    width: 100%;
    padding: 12px;
    font-weight: bold;
    box-sizing: border-box;
    opacity: 0.7;
}

/* Badges y Pills */
.badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
}

.badge-tipo {
    background-color: var(--bg-header);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7em;
    margin-left: 10px;
    vertical-align: middle;
}

.badge-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    color: white;
}

.badge-yes {
    background: var(--success);
}

.badge-no {
    background: var(--danger);
}

.badge-permiso {
    background: var(--bg-header);
    color: white;
}

.badge-premium-star {
    color: #f59e0b;
    font-weight: bold;
    margin-left: 5px;
}

.status-pill {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
}

.pill-alumno {
    background: #e0f2fe;
    color: #0369a1;
}

.pill-profe {
    background: #fef3c7;
    color: #92400e;
}

.badge-contador {
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9em;
}

.badge-profe {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.badge-alumno {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* =========================================
   6. FORMULARIOS E INPUTS
   ========================================= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.95em;
    background: var(--bg-body);
    color: var(--text-main);
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.input-color-custom {
    height: 42px;
    padding: 2px;
    cursor: pointer;
    width: 100%;
}

.input-file-sm {
    max-width: 250px;
    font-size: 0.85em;
    padding: 5px;
}

.input-disabled {
    background: var(--bg-body);
    cursor: not-allowed;
}

.form-group-separator {
    margin-top: 10px;
    border-top: 1px dashed var(--border-color);
    padding-top: 15px;
}

.form-section-title {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--border-color);
    margin-bottom: 8px;
}

.form-section-title h3 {
    font-size: 1em;
    margin: 0 0 15px 0;
    color: var(--primary);
}

.form-group-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

/* =========================================
   7. TABLAS, TOOLBARS Y FILTROS
   ========================================= */
.table-wrapper {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

th {
    background: var(--bg-body);
    padding: 18px 15px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

td {
    padding: 18px 15px;
    border-top: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

table tbody tr:hover td {
    background-color: var(--bg-body);
}

table tbody tr.selected {
    background-color: #e0f2fe !important;
    box-shadow: inset 4px 0 0 var(--primary);
}

table tbody tr.selected td {
    color: #0369a1;
}

.tabla-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.tabla-title {
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.empty-table-msg {
    padding: 40px;
    text-align: center;
}

.empty-table-warning {
    color: var(--warning);
    text-align: center;
}

/* Toolbars Modernizados */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.table-toolbar-boxed {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    background: var(--bg-body);
    color: var(--text-main);
    outline: none;
    transition: 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
}

.toolbar-actions {
    display: flex;
    flex: 3;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-actions .btn {
    flex: 1;
    min-width: 130px;
    text-align: center;
    white-space: nowrap;
    padding: 10px 5px;
}

.toolbar-actions-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.table-actions,
.table-actions-row {
    display: flex;
    gap: 10px;
}

/* Filtro Alfabético */
.alpha-filter,
#filtro-letras {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 4px;
    margin-bottom: 20px;
}

.alpha-btn {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 2px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    flex: 1 1 0;
    min-width: 30px;
    text-align: center;
    box-sizing: border-box;
}

#filtro-letras .alpha-btn:first-child {
    flex: 2 1 0;
    min-width: 70px;
}

.alpha-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.alpha-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

.select-filtro {
    min-width: 160px;
    cursor: pointer;
    background-color: var(--bg-body);
}

.select-filtro:focus {
    border-color: var(--primary);
    outline: none;
}

/* =========================================
   8. PÁGINA DE LOGIN
   ========================================= */
.login-body {
    background: #0f172a !important;
    /* Azul oscuro fijo */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.login-container {
    width: 90%;
    max-width: 420px;
}

.login-card {
    background: var(--card-bg);
    padding: 45px 35px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.login-header h2 {
    margin: 0 0 10px 0;
    color: var(--text-main);
    font-size: 1.85em;
    font-weight: 700;
}

.login-header p {
    margin: 0 0 35px 0;
    color: var(--text-muted);
    font-size: 1em;
}

.form-group-login {
    text-align: left;
    margin-bottom: 22px;
}

.form-group-login label {
    display: block;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.login-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 1.05em;
    transition: all 0.25s ease;
    background-color: var(--bg-body);
    color: var(--text-main);
}

.login-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
    outline: none;
    background-color: var(--card-bg);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: var(--btn-gradient-login);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.15em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: var(--btn-shadow-login);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-btn:hover {
    background: linear-gradient(135deg, #1c75bc 0%, #155e96 100%);
    box-shadow: 0 10px 22px rgba(28, 117, 188, 0.5);
    transform: translateY(-2px);
}

.login-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 10px rgba(28, 117, 188, 0.3);
}

.login-card-footer {
    margin-top: 25px;
    font-size: 0.8em;
    color: var(--text-muted);
    line-height: 1.5;
}

.login-copyright {
    margin-top: 35px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    font-size: 0.85em;
    color: var(--text-muted);
    opacity: 0.8;
}

.login-error {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid #fecaca;
}

/* =========================================
   9. DASHBOARD Y TARJETAS INFORMATIVAS
   ========================================= */
body .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 25px !important;
    margin-top: 20px !important;
    margin-bottom: 30px !important;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}

.dashboard-grid-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-grid-modos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.grid-secciones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.stat-card-animated,
.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.stat-card-wrapper {
    /* Animación delegada */
}

.stat-card-animated {
    -webkit-animation: simpleFadeIn 0.4s ease-in-out both;
    animation: simpleFadeIn 0.4s ease-in-out both;
}

.stat-card-animated:hover,
.stat-card:hover {
    transform: translateY(-8px) scale(1.03) !important;
    box-shadow: 0 25px 35px -10px rgba(0, 0, 0, 0.15) !important;
    border-color: var(--primary) !important;
    z-index: 10;
}

.stat-card-animated::before,
.stat-card::before {
    content: attr(data-icon);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20em;
    opacity: 0.04;
    filter: blur(5px);
    pointer-events: none;
    z-index: 0;
    transition: transform 0.8s ease, opacity 0.8s ease;
}

.stat-card-animated:hover::before,
.stat-card:hover::before {
    transform: translate(-50%, -50%) scale(1.15) rotate(15deg);
    opacity: 0.08;
}

/* Asegurar que el contenido de la tarjeta esté por encima del fondo */
.stat-card>* {
    position: relative;
    z-index: 1;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-val {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary);
}

.stat-val-success {
    font-size: 2em;
    font-weight: bold;
    color: var(--success);
}

.dashboard-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.info-box-dashboard {
    text-align: center;
    margin-bottom: 30px;
}

.info-box-dashboard h1 {
    margin: 0;
}

.info-box-dashboard p {
    color: var(--text-muted);
}

/* Efecto Hover en cajas generales (Mis preguntas, Historial) */
main.container>div[style*="border-radius: 16px"] {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

main.container>div[style*="border-radius: 16px"]:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Tarjetas de Sección BD */
.card-seccion {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, border-color 0.2s;
}

.card-seccion:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.card-seccion-title {
    background: rgba(52, 152, 219, 0.08);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85em;
    text-align: center;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.15);
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-seccion-content {
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.total-numero {
    font-size: 1.8em;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.total-texto {
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* Contenedores de Secciones (Historial, Favoritas...) */
.seccion-dashboard-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary);
    border-right: 5px solid var(--primary);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 40px;
}

.seccion-titulo-toggle {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.badge-toggle {
    font-size: 0.8em;
    color: var(--text-muted);
    padding: 5px 10px;
    background: var(--bg-body);
    border-radius: 8px;
    font-weight: normal;
}

/* Alertas Dashboard */
.msg-vacio {
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    padding: 10px;
}

.aviso-warning {
    font-size: 0.85em;
    color: var(--warning);
    font-weight: bold;
    background: #fffbeb;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #fde68a;
    margin-top: 15px;
}

.aviso-limite-diario {
    background-color: #fef2f2;
    border: 2px solid #f87171;
    color: #b91c1c;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.aviso-limite-diario h3 {
    margin-top: 0;
    font-size: 1.4em;
}

.aviso-limite-diario p {
    margin-bottom: 0;
    font-size: 1.05em;
}

.test-guardado-alerta {
    background-color: #fffbeb;
    border: 2px dashed #f59e0b;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.alerta-titulo-warning {
    margin-top: 0;
    color: #d97706;
    margin-bottom: 5px;
}

.alerta-nombre-examen {
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: bold;
    color: var(--text-main);
    font-size: 1.1em;
}

.btn-continuar-test {
    display: inline-block;
    width: 100%;
    max-width: 400px;
    padding: 12px;
    font-weight: bold;
    box-sizing: border-box;
    white-space: normal;
}

.sin-fallos-badge {
    display: block;
    width: 100%;
    background: var(--bg-body);
    padding: 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: bold;
    text-align: center;
    box-sizing: border-box;
}

.pregunta-fav-item {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.pregunta-fav-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Fila interactiva Exámenes Oficiales */
.row-examen-oficial {
    cursor: pointer;
    transition: 0.2s;
}

.row-examen-oficial:hover {
    background: rgba(52, 152, 219, 0.05) !important;
}

.row-examen-oficial.selected-row {
    background: rgba(52, 152, 219, 0.15) !important;
    border-left: 4px solid var(--primary) !important;
}

/* =========================================
   10. SIMULADOR DE TEST (gestion_test.php y Resultados)
   ========================================= */
#contenedor-test {
    width: 92%;
    max-width: 1400px;
    margin: 10px auto;
    padding: 0 15px;
}

.cabecera-test {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 10px;
}

/* Indicadores de arriba (Aciertos, Fallos, Tiempo) */
.caja-indicador {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    border-radius: 12px;
    min-width: 180px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.caja-indicador .titulo-caja {
    font-size: 0.9em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    padding: 8px;
    color: white;
    text-align: center;
}

.caja-indicador .valor-caja {
    font-size: 2em;
    font-weight: bold;
    font-family: monospace;
    line-height: 1;
    padding: 10px 15px;
    text-align: center;
    color: var(--text-main);
    background-color: var(--card-bg);
}

.caja-azul {
    border-color: #3b82f6;
}

.caja-azul .titulo-caja {
    background-color: #3b82f6;
}

.caja-verde {
    border-color: #10b981;
}

.caja-verde .titulo-caja {
    background-color: #10b981;
}

.caja-roja {
    border-color: #ef4444;
}

.caja-roja .titulo-caja {
    background-color: #ef4444;
}

.caja-naranja {
    border-color: #f59e0b;
}

.caja-naranja .titulo-caja {
    background-color: #f59e0b;
}

.botones-der {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.botones-der .fila-superior {
    display: flex;
    gap: 8px;
}

.txt-total-container {
    font-size: 0.6em;
    opacity: 0.8;
}

.btn-imprimir {
    background: #8b5cf6;
    color: white;
    font-size: 0.85em;
    flex: 1;
    padding: 8px;
}

.btn-guardar {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    font-size: 0.85em;
    flex: 1;
    padding: 8px;
}

.btn-finalizar-cabecera {
    width: 100%;
    font-size: 1.05em;
    font-weight: bold;
    padding: 12px;
}

.btn-volver-res-cabecera {
    width: 100%;
    font-weight: bold;
    padding: 12px;
}

/* Tarjeta Pregunta */
.pregunta-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: relative;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.pregunta-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.meta-acciones {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
}

.btn-icon-copiar {
    font-size: 1.2em;
}

.btn-icon-fav {
    font-size: 1.8em;
    line-height: 1;
    outline: none;
}

.enunciado {
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-main);
    margin-bottom: 15px;
}

/* Opciones de Respuesta */
.opciones-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opcion {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--bg-body);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    font-size: 1em;
}

.opcion:hover:not(.bloqueado) {
    border-color: var(--primary);
    background: var(--card-bg);
}

.letra-opcion {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #334155;
    color: white;
    border-radius: 50%;
    margin-right: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.opcion.seleccionada {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.15);
}

.opcion.seleccionada .letra-opcion {
    background: #facc15;
    color: #1e293b;
}

.opcion.acertada {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.05);
}

.opcion.acertada .letra-opcion {
    background: #22c55e;
}

.opcion.fallada {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.opcion.fallada .letra-opcion {
    background: #ef4444;
}

.opcion.bloqueado {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.8;
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.btn-nav {
    padding: 10px 20px;
}

.label-auto-avance {
    cursor: pointer;
    font-size: 0.9em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.chk-auto-avance {
    transform: scale(1.2);
}

/* Panel Inferior (Botonera 1-100) */
.panel-inferior {
    background: var(--card-bg);
    padding: 10px 10px 5px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.grid-numeros {
    display: grid;
    grid-template-columns: repeat(25, minmax(0, 34px));
    gap: 4px;
    justify-content: center;
    margin: 0 auto 5px auto;
    width: 100%;
}

.btn-n {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s;
}

.btn-n.btn-especifica {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.btn-n.btn-comun {
    background: #bae6fd;
    color: #0c4a6e;
    border-color: #7dd3fc;
}

.btn-n.sin-contestar {
    background: #cbd5e1 !important;
    color: #475569 !important;
    border-color: #94a3b8 !important;
    opacity: 1 !important;
}

.btn-n.actual {
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.5);
    transform: scale(1.1);
    z-index: 2;
    border-color: #f39c12;
}

.btn-n.respondida {
    background: #fefce8 !important;
    color: #713f12 !important;
    border-color: #facc15 !important;
    opacity: 1 !important;
}

.btn-n.bien {
    background: #22c55e !important;
    color: white !important;
    border-color: #16a34a !important;
    opacity: 1 !important;
}

.btn-n.mal {
    background: #ef4444 !important;
    color: white !important;
    border-color: #dc2626 !important;
    opacity: 1 !important;
}

/* Leyenda del Test */
.leyenda-zonas {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 600;
    flex-wrap: wrap;
    margin-top: 5px;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cuadrado-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.c-especifica {
    background: #3498db;
    border: 1px solid #2980b9;
}

.c-comun {
    background: #bae6fd;
    border: 1px solid #7dd3fc;
}

.c-sin-contestar {
    background: #cbd5e1;
    border: 1px solid #94a3b8;
}

/* Pantalla de Resultados Finales */
.pantalla-resultados {
    padding: 20px;
}

.res-titulo-principal {
    text-align: center;
    color: var(--text-main);
    font-size: 2.5em;
    margin-bottom: 15px;
}

.res-contenedor-tarjeta {
    max-width: 700px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.res-header {
    margin-bottom: 30px;
}

.res-apto-texto {
    font-size: 3.5em;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.res-nota-texto {
    margin: 15px 0 0 0;
    color: var(--text-main);
    font-size: 1.6em;
}

.res-nota-valor {
    font-weight: bold;
    color: #3498db;
    font-size: 1.5em;
}

.res-nota-total {
    font-size: 0.7em;
    color: var(--text-muted);
}

.res-separador {
    border: 0;
    border-top: 2px dashed var(--border-color);
    margin: 30px 0;
}

.res-grid-estadisticas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 35px;
}

.res-tarjeta {
    padding: 20px 10px;
    border-radius: 16px;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.res-tarjeta:hover {
    transform: translateY(-5px);
}

.res-tarjeta.aciertos {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.3);
}

.res-tarjeta.fallos {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.3);
}

.res-tarjeta.blancos {
    background: var(--bg-body);
    border-color: var(--border-color);
}

.res-tarjeta.tiempo {
    background: rgba(52, 152, 219, 0.05);
    border-color: rgba(52, 152, 219, 0.3);
}

.res-valor {
    font-size: 2.5em;
    font-weight: bold;
    line-height: 1;
}

.res-valor.tiempo {
    font-size: 2em;
    line-height: 1.25;
    color: #3498db;
}

.res-valor.aciertos {
    color: var(--success);
}

.res-valor.fallos {
    color: var(--danger);
}

.res-valor.blancos {
    color: var(--text-main);
}

.res-etiqueta {
    font-size: 0.9em;
    text-transform: uppercase;
    margin-top: 10px;
    font-weight: bold;
}

.res-etiqueta.aciertos {
    color: var(--success);
}

.res-etiqueta.fallos {
    color: var(--danger);
}

.res-etiqueta.blancos {
    color: var(--text-muted);
}

.res-etiqueta.tiempo {
    color: #3498db;
}

.res-penalizacion {
    font-size: 0.85em;
    color: var(--danger);
    margin-top: 5px;
    font-weight: bold;
    opacity: 0.8;
}

.res-acciones {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.res-btn-accion {
    padding: 15px 30px;
    font-size: 1.1em;
    flex: 1;
    border-radius: 12px;
    font-weight: bold;
    transition: transform 0.2s;
    color: white;
}

.res-btn-accion:hover {
    transform: scale(1.02);
}

.btn-revisar {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-volver-menu {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.error-historial {
    padding: 40px;
    text-align: center;
    font-family: sans-serif;
}

.error-fatal {
    background: #fef2f2;
    color: #b91c1c;
    padding: 30px;
    margin: 20px;
    border-radius: 10px;
    font-family: sans-serif;
}


.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.btn-mapa {
    background: #3b82f6;
    color: white;
    white-space: nowrap;
    font-size: 1.05em;
    padding: 10px 20px;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

/* Editor Header Box */
.editor-header-box {
    background: var(--bg-body);
    border: 2px solid var(--primary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.editor-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.editor-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    color: var(--text-main);
    margin: 0;
}

.editor-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.counter-highlight {
    color: var(--warning);
    font-size: 1.2em;
    font-weight: bold;
}

.scroll-editor {
    max-height: 400px;
    overflow-y: auto;
}

.search-preguntas-box {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* PDFs y Archivos */
.pdf-adjunto-box {
    background: var(--card-bg);
    border: 1px dashed var(--primary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pdf-info h4 {
    margin: 0 0 5px 0;
    color: var(--text-main);
}

.pdf-info p {
    margin: 0;
    font-size: 0.85em;
    color: var(--text-muted);
}

.btn-pdf-view {
    background: #10b981;
    color: white;
    text-decoration: none;
}

/* Contadores y Listas */
.examenes-counter {
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--card-bg);
    padding: 12px 18px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    display: inline-block;
    font-weight: 500;
}

.examenes-counter strong {
    color: var(--primary);
    font-size: 1.05rem;
}

/* Estilos de Importación (Extractor PDF) */
.import-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.textarea-pdf {
    width: 100%;
    height: 250px;
    background: var(--bg-body);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    font-family: monospace;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.textarea-pdf:focus {
    border-color: var(--primary);
}

.q-row {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.q-row:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.q-num {
    font-weight: bold;
    width: 40px;
    color: var(--primary);
}

.q-text {
    flex: 1;
    font-size: 0.9em;
    line-height: 1.4;
}

.q-text-warning {
    color: var(--warning);
    font-weight: bold;
}

.q-text-normal {
    color: var(--text-main);
    font-weight: normal;
}

.q-enlace-ok {
    color: var(--success);
    font-size: 0.85em;
    margin-top: 5px;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85em;
    white-space: nowrap;
}

.status-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-fail {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.resultado-modal-item {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: 0.2s;
}

.resultado-modal-item:hover {
    border-color: var(--primary);
}

.pdf-upload-zone {
    background: rgba(52, 152, 219, 0.05);
    border: 2px dashed var(--primary);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    transition: 0.3s;
}

.pdf-upload-zone:hover {
    background: rgba(52, 152, 219, 0.1);
}

.pdf-input {
    display: none;
}

.pdf-label {
    cursor: pointer;
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
}

.q-actions-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.q-actions-mini {
    display: flex;
    gap: 4px;
}

.btn-mini {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    font-size: 0.85em;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}

.btn-mini:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-delete-row {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-cambiar {
    background: var(--bg-header);
    color: white;
    padding: 6px 12px;
    font-size: 0.85em;
    width: 100%;
}

.btn-buscar-manual {
    padding: 6px 12px;
    font-size: 0.85em;
    width: 100%;
}

.filtro-pendientes-container {
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed var(--warning);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.filtro-pendientes-label {
    cursor: pointer;
    font-weight: bold;
    color: var(--warning);
    font-size: 0.9em;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ajuste específico para la tabla de Editor de Exámenes */
#tabla-preguntas-añadidas table td,
#tabla-preguntas-añadidas table th {
    padding: 6px 10px !important;
}

#tabla-preguntas-añadidas .btn {
    padding: 4px 8px !important;
    font-size: 0.85em !important;
}


/* =========================================
   12. MODALES Y TOASTS
   ========================================= */
.modal-overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

/* --- ANALYTICS CATEGORIES --- */
.analytics-category-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-body);
}

.analytics-category-header {
    background: var(--card-bg);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.85em;
    color: var(--primary);
    transition: background-color 0.2s;
}

.analytics-category-header:hover {
    background: #f1f5f9;
}

.analytics-category-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8em;
}

.analytics-category-content {
    display: none;
    padding: 10px;
    background: var(--bg-body);
    border-top: 1px solid var(--border);
}

.analytics-category-content.active {
    display: block;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg);
    padding: 35px;
    border-radius: 15px;
    width: 90%;
    max-width: 750px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    z-index: 100000;
}

.modal-sm,
.modal-small {
    max-width: 400px;
}

.modal-wrapper {
    max-width: 450px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: var(--text-main);
}

.modal-body {
    overflow-y: auto;
}

.btn-close-modal {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--danger);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

.btn-close-modal:hover {
    background: var(--danger);
    color: white;
}

.modal-finalizar-content {
    max-width: 450px;
    text-align: center;
    padding: 40px;
}

.modal-icono {
    font-size: 3.5em;
    margin-bottom: 20px;
}

.modal-titulo {
    color: var(--primary);
    margin-top: 0;
}

.modal-texto {
    color: var(--text-main);
    font-size: 1.1em;
    line-height: 1.5;
    margin-bottom: 25px;
}

.modal-acciones-flex {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Modales de Confirmación Destructiva */
.modal-confirm {
    max-width: 450px !important;
    text-align: center;
}

.modal-icon-danger {
    font-size: 3.5em;
    margin-bottom: 10px;
}

.modal-text-confirm {
    margin: 20px 0;
    font-size: 1.1em;
    color: var(--text-main);
    line-height: 1.5;
}

.texto-confirmacion-eliminar {
    color: var(--text-muted);
    font-size: 1.05em;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-actions-confirm {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.warning-box {
    font-size: 0.85em;
    color: var(--warning);
    font-weight: bold;
    background: #fffbeb;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #fde68a;
}

/* Toasts de Notificación */
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    width: 90%;
    max-width: 420px;
}

.toast {
    padding: 16px 25px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    margin-top: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #333;
    /* Fondo por defecto para evitar invisibilidad */
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Sincronización con las clases generadas por JS */
.toast.toast-success,
.toast.success {
    background: var(--success, #27ae60) !important;
}

.toast.toast-error,
.toast.toast-danger,
.toast.error,
.toast.danger {
    background: var(--danger, #e74c3c) !important;
}

.toast.toast-info,
.toast.toast-primary,
.toast.info,
.toast.primary {
    background: var(--primary, #3498db) !important;
}

.toast.toast-warning,
.toast.warning {
    background: #f39c12 !important;
}

.toast.warning {
    background: var(--warning);
}

/* Por si lo usas */


/* Variante para tarjetas destacadas/peligrosas */
.stat-card.tipo-importante {
    border-color: var(--danger);
    border-width: 2px;
    background-color: rgba(231, 76, 60, 0.05);
}

.stat-card.tipo-importante:hover {
    border-color: var(--danger) !important;
    box-shadow: 0 12px 20px -3px rgba(231, 76, 60, 0.2), 0 4px 6px -2px rgba(231, 76, 60, 0.1) !important;
}

/* Modo Oscuro para la tarjeta importante */
body.dark-mode .stat-card.tipo-importante {
    border-color: #b91c1c;
    background-color: rgba(185, 28, 28, 0.05);
}

/* =========================================
   13. COMPONENTES EXTRA (Mapa, Drag&Drop, Tablón, Chat Fijo)
   ========================================= */

/* Mapa interactivo y Leyenda */
.tarjeta-tabla {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.mapa-wrapper {
    flex: 1;
    min-width: 400px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#mapa-tooltip {
    display: none;
    position: absolute;
    background: var(--text-main);
    color: var(--bg-body);
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.comunidad-interactiva {
    fill: var(--bg-body);
    stroke: var(--text-muted);
    stroke-width: 50;
    cursor: pointer;
    transition: fill 0.2s ease, stroke 0.2s ease, transform 0.2s;
    transform-origin: center;
}

.comunidad-interactiva.con-examenes {
    fill: #93c5fd;
}

.comunidad-interactiva.sin-examenes {
    fill: #fca5a5;
}

.comunidad-interactiva:hover {
    fill: var(--primary) !important;
    stroke: var(--text-main) !important;
}

.comunidad-interactiva.activa {
    fill: #22c55e !important;
    stroke: var(--text-main) !important;
}

.mapa-leyenda {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-main);
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.color-box.examenes {
    background-color: #93c5fd;
}

.color-box.sin-examenes {
    background-color: #fca5a5;
}

.color-box.seleccionada {
    background-color: #22c55e;
}

/* Drag & Drop */
.draggable-row {
    transition: background-color 0.2s, border-top 0.2s;
    background-color: var(--card-bg);
}

.draggable-row.dragging {
    opacity: 0.4;
    background-color: var(--border-color);
}

.draggable-row.drag-over {
    border-top: 3px solid var(--primary);
}

.drag-handle {
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Tablón Animado */
@keyframes avisoTablon {
    0% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0px transparent;
    }

    50% {
        opacity: 0.5;
        transform: scale(1.02);
        box-shadow: 0 0 0px var(--warning);
        border-color: var(--warning);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0px transparent;
    }
}

.tablon-novedad {
    animation: avisoTablon 1.2s ease-in-out infinite;
}

/* =========================================
   ESTILOS TABLÓN DE ANUNCIOS (CORCHO Y NOTA)
   ========================================= */

#modalTablon.modal-overlay {
    background: transparent !important;
    backdrop-filter: none !important;
    pointer-events: none;
    /* No bloquear interacción de fondo */
}

#tablon-card {
    pointer-events: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid #1e293b;
    border-radius: 20px;
    padding: 0 !important;
    background: #020617 !important;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
}

body.dark-mode #tablon-card {
    border-color: #000;
}

.tablon-header-minimal {
    background: #334155 !important;
    /* Claramente más claro que #1e293b */
    cursor: move;
    padding: 4px 20px !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #475569;
    min-height: 0 !important;
}

.tablon-header-minimal h2 {
    color: #ffffff !important;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin: 0 !important;
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
}

.tablon-corcho-bg {
    background: #0f172a;
    padding: 30px !important;
    position: relative;
    min-height: 500px;
}

.tablon-nota-gigante {
    background: #1e293b;
    color: #f1f5f9;
    padding: 35px;
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    line-height: 1.8;
    text-align: justify;
    box-shadow: var(--shadow-md);
    border-radius: 16px;
    border: 1px solid #334155;
    border-left: 8px solid var(--primary);
    margin: 0 auto 40px auto;
    max-width: 100%;
    position: relative;
}

.tablon-nota-gigante::before {
    content: '📌';
    position: absolute;
    top: -15px;
    left: 20px;
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.tablon-cincheta {
    display: none;
}

/* Sistema Multi-Notas */
.tablon-grid-notas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 0;
    align-items: stretch;
}

.tablon-nota-individual {
    position: relative;
    color: #f1f5f9;
    padding: 25px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    background: #1e293b;
    box-shadow: var(--shadow-sm);
    min-height: 150px;
    border-radius: 16px;
    border: 1px solid #334155;
    border-top: 6px solid var(--primary);
    word-break: break-word;
    text-align: justify;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.tablon-nota-individual:hover {
    transform: translateY(-8px);
    background: #232f42;
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.nota-amarilla {
    border-top-color: #facc15;
}

.nota-verde {
    border-top-color: #22c55e;
}

.nota-rosa {
    border-top-color: #ec4899;
}

.nota-azul {
    border-top-color: #3b82f6;
}

.nota-naranja {
    border-top-color: #f97316;
}

/* Asegurarnos de que el texto puro (nota principal) no rompa el diseño si hay notas separadas */
.tablon-nota-principal {
    margin-bottom: 40px;
}

/* Corrección Chat Fijo */
#chat-widget,
.chat-container {
    position: fixed !important;
    top: 80px !important;
    bottom: 20px !important;
    max-height: calc(100vh - 100px) !important;
    height: auto !important;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

#chat-widget .contactos-lista,
#chat-widget .mensajes-lista,
.chat-container .contactos-lista,
.chat-container .mensajes-lista {
    overflow-y: auto !important;
}

/* =========================================
   14. MODO OSCURO (DARK MODE)
   ========================================= */
body.dark-mode {
    --bg-body: #0f172a;
    --bg-header: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

body.dark-mode .welcome-box,
body.dark-mode .stat-card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .stat-card h3 {
    color: var(--text-main);
}

body.dark-mode table tbody tr.selected {
    background-color: #0c4a6e !important;
    box-shadow: inset 4px 0 0 #38bdf8;
}

body.dark-mode table tbody tr.selected td {
    color: #e0f2fe !important;
}

/* Sombras Profundas y Resaltes */
body.dark-mode .stat-card,
body.dark-mode .pregunta-fav-item,
body.dark-mode main.container>div[style*="border-radius: 16px"] {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .stat-card:hover,
body.dark-mode .pregunta-fav-item:hover,
body.dark-mode main.container>div[style*="border-radius: 16px"]:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.9), 0 4px 6px -2px rgba(0, 0, 0, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Opciones de Test Oscuras */
body.dark-mode .letra-opcion {
    background: #475569;
    color: #f8fafc;
}

body.dark-mode .opcion.seleccionada .letra-opcion {
    background: #facc15;
    color: #1e293b;
}

body.dark-mode .btn-n.respondida {
    background: #422006 !important;
    color: #facc15 !important;
    border-color: #facc15 !important;
    opacity: 1 !important;
}

body.dark-mode .opcion.acertada .letra-opcion {
    background: #22c55e;
}

body.dark-mode .opcion.fallada .letra-opcion {
    background: #ef4444;
}

body.dark-mode input[type="date"] {
    color-scheme: dark;
}

body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
    /* Quitamos el invert para que el navegador lo pinte clarito por defecto */
    cursor: pointer;
    opacity: 0.8;
    /* Un pelín de transparencia para que quede más elegante */
}

/* Mapa Test Oscuro */
body.dark-mode .btn-n.btn-especifica {
    background: #0284c7;
    color: #f0f9ff;
    border-color: #0369a1;
}

body.dark-mode .btn-n.btn-comun {
    background: #075985;
    color: #e0f2fe;
    border-color: #0c4a6e;
}

body.dark-mode .btn-n.sin-contestar {
    background: #334155 !important;
    color: #94a3b8 !important;
    border-color: #1e293b !important;
}

body.dark-mode .c-especifica {
    background: #0284c7;
    border-color: #0369a1;
}

body.dark-mode .c-comun {
    background: #075985;
    border-color: #0c4a6e;
}

body.dark-mode .c-sin-contestar {
    background: #334155;
    border-color: #1e293b;
}

/* Botones y Alertas */
body.dark-mode .btn-warning {
    background-color: #9a3412;
    color: #ffffff;
    border: 1px solid #7c2d12;
}

body.dark-mode .btn-warning:hover {
    background-color: #7c2d12;
}

body.dark-mode .test-guardado-alerta {
    background-color: #2d1d00;
    border-color: #9a3412;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .test-guardado-alerta h3 {
    color: #fbbf24 !important;
}

/* Scroll y Botón Flotante */
body.dark-mode ::-webkit-scrollbar-track {
    background: var(--bg-header);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #0284c7;
}

#btn-dark-mode {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #1e293b;
    color: #f8fafc;
    border: 2px solid #3b82f6;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.3s;
}

#btn-dark-mode:hover {
    transform: scale(1.1);
}

body.dark-mode #btn-dark-mode {
    background: #f59e0b;
    border-color: #d97706;
    color: #0f172a;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Mapa Oscuro (Regiones) */
body.dark-mode .comunidad-interactiva {
    fill: #1e293b;
    stroke: #475569;
}

body.dark-mode .comunidad-interactiva.con-examenes {
    fill: #1e3a8a;
}

body.dark-mode .comunidad-interactiva.sin-examenes {
    fill: #7f1d1d;
}

body.dark-mode .comunidad-interactiva:hover {
    fill: var(--primary) !important;
    stroke: #f1f5f9 !important;
}

body.dark-mode .comunidad-interactiva.activa {
    fill: #22c55e !important;
    stroke: #f1f5f9 !important;
}

body.dark-mode .color-box.examenes {
    background-color: #1e3a8a;
}

body.dark-mode .color-box.sin-examenes {
    background-color: #7f1d1d;
}


/* =========================================
   PERFIL: SUBIDA DE FOTO Y TOGGLE PREMIUM
   ========================================= */

/* Subida de foto cuadrada */
.profile-upload-container {
    position: relative;
    width: 145px;
    height: 145px;
    border-width: 2px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--border-color);
    border: 3px dashed var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.05);
}

.profile-upload-container:hover {
    border-color: var(--primary);
    background: rgba(52, 152, 219, 0.05);
}

.profile-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.profile-upload-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    background-size: cover;
    background-position: center;
    transition: 0.2s;
}

.profile-upload-preview.has-image {
    border: none;
}

.profile-upload-preview.has-image .upload-icon,
.profile-upload-preview.has-image .upload-text {
    opacity: 0;
    /* Oculta el texto si hay imagen */
    transition: 0.2s;
}

.profile-upload-container:hover .profile-upload-preview.has-image::after {
    content: "Cambiar";
    position: absolute;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.upload-icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.upload-text {
    font-size: 0.8em;
    font-weight: bold;
}

/* Tarjeta Premium Toggle */
.premium-card-toggle input {
    display: none;
}

.premium-card-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-body);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px 12px;

}

.premium-card-content .premium-icon {
    font-size: 1.4em;
    filter: grayscale(1);
    transition: 0.3s;
}

.premium-card-content .premium-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.premium-card-content .premium-text strong {
    color: var(--text-main);
    font-size: 1.05em;
    transition: 0.3s;
}

.premium-card-content .premium-text span {
    font-size: 0.8em;
    color: var(--text-muted);
}

.premium-switch {
    width: 45px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.premium-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Forzamos 3 columnas en algunos sitios */
    gap: 12px;
}

/* Estado Activado (Premium) */
.premium-card-toggle input:checked+.premium-card-content {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.02));
    border-color: #f59e0b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}

.premium-card-toggle input:checked+.premium-card-content .premium-icon {
    filter: grayscale(0);
    transform: scale(1.1);
}

.premium-card-toggle input:checked+.premium-card-content .premium-text strong {
    color: #d97706;
}

.premium-card-toggle input:checked+.premium-card-content .premium-switch {
    background: #f59e0b;
}

.premium-card-toggle input:checked+.premium-card-content .premium-switch::after {
    left: 24px;
}


/* =========================================
   15. RESPONSIVE Y MEDIA QUERIES (Siempre al final)
   ========================================= */

@media print {
    .no-print {
        display: none !important;
    }
}

/* 📱 TABLETS (PANTALLAS MEDIANAS: 769px - 1024px) */
@media (max-width: 1024px) {

    /* Contenedores Principales */
    .container {
        width: 96% !important;
        padding: 25px;
        margin: 25px auto;
    }

    /* Grids */
    body .dashboard-grid,
    .dashboard-grid-stats,
    .dashboard-grid-modos {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    /* Barras de herramientas */
    .table-toolbar,
    .table-toolbar-boxed {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-input {
        max-width: 100%;
        width: 100%;
    }

    .table-actions-row,
    .toolbar-actions,
    .toolbar-actions-col {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-end;
        align-items: flex-end;
        flex-direction: row;
    }

    /* Editor de Exámenes */
    .editor-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Tablas y Test */
    th,
    td {
        padding: 12px 10px;
        font-size: 0.9em;
    }

    .grid-numeros {
        grid-template-columns: repeat(25, minmax(0, 32px));
        gap: 3px;
        width: 100%;
        margin: 0 auto;
    }

    #contenedor-test {
        width: 95%;
    }
}

/* 📱 MÓVILES (PANTALLAS PEQUEÑAS: HASTA 768px) */
@media (max-width: 768px) {

    /* Layout Base */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .container {
        width: 95% !important;
        padding: 15px;
        margin: 10px auto;
    }

    /* Header ultra compacto */
    .top-bar {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }

    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .nav-links a {
        padding: 6px 10px;
        font-size: 0.9em;
    }

    .user-info {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 8px;
        font-size: 0.85em;
    }

    .user-info span[style*="margin: 0 10px"] {
        display: none !important;
    }

    /* Modales adaptados al móvil */
    .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 90vh;
    }

    .modal-acciones-flex {
        flex-direction: column;
        gap: 10px;
    }

    /* Botones y formularios en bloque */
    .toolbar-actions .btn {
        width: 100% !important;
    }

    .form-group-inline {
        flex-direction: column;
        align-items: stretch;
    }

    /* Ocultar elementos innecesarios durante el examen (gestion_test.php) */
    body.page-test .top-bar {
        display: none !important;
    }

    body.page-test #btn-dark-mode {
        display: none !important;
    }

    body.page-test #btn-toggle-chat,
    body.page-test #chat-widget,
    body.page-test .chat-container,
    body.page-test #chat-flotante {
        display: none !important;
    }

    /* Layout Test Móvil */
    body.page-test #contenedor-test {
        margin-top: 5px;
        padding: 0 5px;
        width: 100%;
    }

    .cabecera-test {
        flex-direction: row;
        padding: 8px;
        gap: 8px;
    }

    .caja-indicador {
        flex: 1;
        min-width: 45%;
        margin-bottom: 0;
    }

    .caja-indicador .valor-caja {
        font-size: 1.3em !important;
        padding: 5px !important;
    }

    .botones-der {
        width: 100%;
        flex-direction: row;
        gap: 8px;
    }

    .botones-der .btn {
        flex: 1;
        padding: 10px;
        font-size: 0.9em;
    }

    .test-guardado-alerta .btn {
        box-sizing: border-box;
        white-space: normal;
        height: auto;
        line-height: 1.4;
    }
}

/* =========================================
   25. SISTEMA DE AYUDA PREMIUM CAP
   ========================================= */
.btn-ayuda {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    gap: 8px;
    padding: 10px 18px;
    margin: 0 10px;
    border-radius: 50px;
    font-size: 0.9em;
    z-index: 5;
    display: inline-flex;
    align-items: center;
}

.btn-ayuda:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.modal-ayuda-content {
    max-width: 1400px;
    width: 85%;
    background: var(--card-bg);
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
}

.modal-ayuda-header {
    background: linear-gradient(135deg, var(--bg-header) 0%, #334155 100%);
    color: white;
    padding: 25px 35px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-ayuda-icono {
    font-size: 2em;
}

.modal-ayuda-titulo {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
}

.modal-ayuda-cerrar {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.modal-ayuda-cerrar:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-ayuda-pregunta {
    padding: 25px 35px 15px 35px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.5;
}

/* =========================================
   CONTENEDOR RESPUESTA CORRECTA (BLINDADO)
   ========================================= */
.modal-ayuda-correcta {
    padding: 0 35px 25px 35px !important;
    display: flex !important;
    flex-direction: column !important;
    /* Fuerza estrictamente a que se apilen de arriba a abajo */
    align-items: flex-start !important;
    /* Alinea todo a la izquierda */
    gap: 8px !important;
    /* La separación exacta entre el label y la respuesta verde */
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Primera línea: "Respuesta correcta:" */
.label-correcta {
    font-size: 0.9em !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

/* Segunda línea: El texto de la respuesta */
.valor-correcta {
    color: var(--success) !important;
    font-weight: 800 !important;
    font-size: 1.1em !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    white-space: normal !important;
    /* Evita que textos largos rompan la caja */
}

.modal-ayuda-sep {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

.modal-ayuda-cuerpo {
    padding: 30px 35px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 1.05em;
    line-height: 1.7;
}

.ayuda-etiqueta {
    display: block;
    font-weight: 800;
    font-size: 0.8em;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 15px;
    margin-bottom: 5px;
}

.modal-ayuda-footer {
    padding: 20px 35px;
    background: var(--bg-body);
    display: flex;
    justify-content: center;
    gap: 15px;
}

.ayuda-loading,
.ayuda-sin-teoria {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.ayuda-premium-msg {
    text-align: center;
    padding: 20px;
    background: rgba(245, 158, 11, 0.05);
    border: 2px dashed var(--warning);
    border-radius: 16px;
}

.dark-mode .modal-ayuda-content {
    background: #1e293b;
    border-color: #334155;
}

.dark-mode .modal-ayuda-pregunta {
    color: #f1f5f9;
}

.dark-mode .modal-ayuda-cuerpo {
    color: #cbd5e1;
}

.dark-mode .modal-ayuda-footer {
    background: #0f172a;
}

/* Fuentes y Tags en Ayuda */
.modal-ayuda-fuentes {
    padding: 0 35px 15px 35px;
}

.lista-fuentes {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.lista-fuentes li {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.lista-fuentes li:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary-light);
}

.fuente-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.fuente-link-directo {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95em;
    flex-grow: 1;
    transition: color 0.2s;
}

.fuente-link-directo:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.fuente-texto-simple {
    flex-grow: 1;
    font-size: 0.95em;
    color: var(--text-main);
}

.fuente-aviso {
    font-size: 0.75em;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 5px;
    opacity: 0.8;
}

.modal-ayuda-tags {
    padding: 0 35px 25px 35px;
}



.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ayuda-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

/* Dark Mode Fuentes/Tags */
.dark-mode .lista-fuentes li {
    background: rgba(255, 255, 255, 0.05);
    border-color: #334155;
}

.dark-mode .fuente-texto {
    color: #cbd5e1;
}

.dark-mode .ayuda-tag {
    background: #334155;
    color: #cbd5e1;
    border-color: #475569;
}

/* =========================================
   15. ANIMACIONES DE ENTRADA (FADE IN SIMPLE)
   ========================================= */
@-webkit-keyframes simpleFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes simpleFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Todas las tarjetas sin retraso escalonado */
.dashboard-grid .stat-card-wrapper .stat-card-animated {
    -webkit-animation-delay: 0s !important;
    animation-delay: 0s !important;
}

/* Animaciones de página principal y cabeceras */
.page-header {
    -webkit-animation: simpleFadeIn 0.4s ease-in-out both !important;
    animation: simpleFadeIn 0.4s ease-in-out both !important;
    -webkit-animation-delay: 0s !important;
    animation-delay: 0s !important;
}

.card-progresion {
    -webkit-animation: simpleFadeIn 0.4s ease-in-out both !important;
    animation: simpleFadeIn 0.4s ease-in-out both !important;
    -webkit-animation-delay: 0s !important;
    animation-delay: 0s !important;
}

.card {
    -webkit-animation: simpleFadeIn 0.4s ease-in-out both !important;
    animation: simpleFadeIn 0.4s ease-in-out both !important;
    -webkit-animation-delay: 0s !important;
    animation-delay: 0s !important;
}

/* =========================================
   16. FONDO DINÁMICO (MESH GRADIENT) - VISIBILIDAD V5
   ========================================= */
html,
body,
.app-main-layout,
.main-shell,
.content-canvas {
    background: transparent !important;
}

.dynamic-bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: #e2e8f0 !important;
    /* Fondo gris estático claro */
    overflow: hidden;
    pointer-events: none;
}

/* Modo Oscuro - Manteniendo la elegancia */
.dark-mode .dynamic-bg-wrapper {
    background-color: #1e293b !important;
}

/* --- MIGRATION: app_v2.css contents (Takes Precedence) --- */
:root {
    --app-bg: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --surface: #ffffff;
    --border: #e2e8f0;
    --primary: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --app-bg: #020617;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #3b82f6;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --surface: #0f172a;
    --border: #1e293b;
    --primary: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--app-bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    transition: background 0.3s ease, color 0.3s ease;
}

body.modal-open {
    overflow: hidden !important;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text, white);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 0 25px 30px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo-sq {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-item {
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-nav-item, inherit);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95em;
    font-weight: 500;
    border-left: 4px solid transparent;
    text-decoration: none;
    opacity: 0.8;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: inherit;
    opacity: 1;
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: inherit;
    opacity: 1;
    border-left-color: var(--sidebar-active);
}

/* Notificación de Novedad en el Tablón */
.nav-item.tablon-novedad {
    color: #fcd34d !important;
    /* Ámbar/Oro */
    font-weight: 700;
    animation: tablonPulse 2s infinite;
}

@keyframes tablonPulse {
    0% {
        background: transparent;
        transform: scale(1);
    }

    50% {
        background: rgba(245, 158, 11, 0.15);
        transform: scale(1.02);
    }

    100% {
        background: transparent;
        transform: scale(1);
    }
}

.sidebar-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.login-logo {
    width: 200px;
    /* Cambia este valor al tamaño que desees */
    height: auto;
    margin-bottom: 20px;
}

/* --- MAIN CONTENT --- */
.main-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--app-bg);
}

.top-bar {
    height: 64px;
    background: var(--topbar-bg, var(--surface));
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 30px;
    justify-content: space-between;
    color: var(--topbar-text, var(--text-main));
}

.content-canvas {
    flex: 1;
    padding: 30px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- COMPONENTS --- */
.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 1.6em;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    margin-bottom: 25px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 25px;
}

/* DataGrid Style */
.datagrid-container {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow-x: auto;
}

.datagrid {
    width: 100%;
    border-collapse: collapse;
}

.datagrid th {
    text-align: left;
    padding: 12px 20px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--app-bg);
    border-bottom: 1px solid var(--border);
}

.datagrid td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
    vertical-align: middle;
    line-height: 1.4;
}

.datagrid tr:last-child td {
    border-bottom: none;
}

.datagrid tr:hover td {
    background: var(--app-bg);
}

.datagrid tr.selected td {
    background: rgba(37, 99, 235, 0.05);
    border-bottom-color: rgba(37, 99, 235, 0.2);
    color: var(--primary);
}

.datagrid tr.selected {
    box-shadow: inset 4px 0 0 var(--primary);
}

/* Alpha Filter (A-Z) */
.alpha-filter {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding: 10px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.alpha-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.75em;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.alpha-btn:hover {
    background: var(--app-bg);
    color: var(--primary);
}

.alpha-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.alpha-btn:first-child {
    min-width: 60px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--btn-radius, 10px);
    font-weight: 600;
    cursor: pointer;
    border: var(--btn-border-width, 1px) solid var(--btn-border-color, var(--border));
    background: var(--surface);
    color: var(--text-main);
    font-size: 0.9em;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--btn-primary-bg, var(--primary));
    color: white;
    border-color: var(--btn-primary-bg, var(--primary));
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-success {
    background: var(--btn-success-bg, var(--success));
    color: white;
    border-color: var(--btn-success-bg, var(--success));
}

.btn-danger {
    background: var(--btn-danger-bg, var(--danger));
    color: white;
    border-color: var(--btn-danger-bg, var(--danger));
}

.btn-warning {
    background: var(--btn-warning-bg, var(--warning));
    color: white;
    border-color: var(--btn-warning-bg, var(--warning));
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 8px;
}

.btn-cancel {
    background: var(--app-bg);
    border-color: var(--border);
    color: var(--text-muted);
}

.btn-cancel:hover {
    background: var(--border);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-close-modal {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    padding: 0;
    background: var(--app-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-close-modal:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    transform: rotate(90deg);
}

.modal-header-premium {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #334155 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.modal-header-premium h2 {
    margin: 0;
    color: white !important;
}

.modal-close-premium {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: var(--transition);
    z-index: 10;
}

.modal-close-premium:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Forms */
.form-control {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95em;
    outline: none;
    transition: var(--transition);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

select.form-control {
    cursor: pointer;
}

input.form-control, textarea.form-control, select.form-control,
.modal-content input, .modal-content textarea {
    -webkit-user-select: auto !important;
    user-select: auto !important;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 10px;
    overflow-y: auto;
    z-index: 10000;
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalSlide {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    background: #1e293b;
    color: white;
    border-radius: 14px;
    font-size: 0.95em;
    font-weight: 600;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- DASHBOARD SPECIFIC --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    padding: 30px 25px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.stat-card h3 {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 15px 0 10px 0;
    font-weight: 800;
}

.enunciado {
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-main);
    margin-bottom: 15px;
    text-align: justify;
}

.modal-ayuda-titulo,
.modal-ayuda-pregunta,
.modal-ayuda-cuerpo {
    text-align: justify;
}

.stat-val {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.badge-premium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.6em;
    padding: 3px 8px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 5px;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}

/* --- UTILITIES --- */
.w-full {
    width: 100% !important;
}

.h-full {
    height: 100% !important;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-5 {
    gap: 5px;
}

.gap-8 {
    gap: 8px;
}

.gap-10 {
    gap: 10px;
}

.gap-12 {
    gap: 12px;
}

.gap-15 {
    gap: 15px;
}

.gap-20 {
    gap: 20px;
}

.gap-25 {
    gap: 25px;
}

.m-0 {
    margin: 0 !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-5 {
    margin-top: 5px !important;
}

.mt-10 {
    margin-top: 10px !important;
}

.mt-15 {
    margin-top: 15px !important;
}

.mt-20 {
    margin-top: 20px !important;
}

.mt-25 {
    margin-top: 25px !important;
}

.mt-30 {
    margin-top: 30px !important;
}

.mt-40 {
    margin-top: 40px !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-5 {
    margin-bottom: 5px !important;
}

.mb-10 {
    margin-bottom: 10px !important;
}

.mb-15 {
    margin-bottom: 15px !important;
}

.mb-20 {
    margin-bottom: 20px !important;
}

.mb-25 {
    margin-bottom: 25px !important;
}

.mb-30 {
    margin-bottom: 30px !important;
}

.ml-5 {
    margin-left: 5px !important;
}

.ml-10 {
    margin-left: 10px !important;
}

.p-0 {
    padding: 0 !important;
}

.p-10 {
    padding: 10px !important;
}

.p-15 {
    padding: 15px !important;
}

.p-20 {
    padding: 20px !important;
}

.p-30 {
    padding: 30px !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

.font-normal {
    font-weight: 400 !important;
}

.font-medium {
    font-weight: 500 !important;
}

.font-semibold {
    font-weight: 600 !important;
}

.font-bold {
    font-weight: 700 !important;
}

.font-black {
    font-weight: 800 !important;
}

.text-xs {
    font-size: 0.7em !important;
}

.text-sm {
    font-size: 0.85em !important;
}

.text-base {
    font-size: 1em !important;
}

.text-lg {
    font-size: 1.1em !important;
}

.text-xl {
    font-size: 1.2em !important;
}

.text-2xl {
    font-size: 1.5em !important;
}

.text-3xl {
    font-size: 2em !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-white {
    color: white !important;
}

.bg-success-soft {
    background: rgba(16, 185, 129, 0.1) !important;
}

.bg-soft-primary {
    background: rgba(37, 99, 235, 0.1) !important;
}

.bg-soft-success {
    background: rgba(16, 185, 129, 0.1) !important;
}

.bg-soft-warning {
    background: rgba(245, 158, 11, 0.1) !important;
}

.bg-soft-danger {
    background: rgba(239, 68, 68, 0.1) !important;
}

.border-t {
    border-top: 1px solid var(--border) !important;
}

.cursor-pointer {
    cursor: pointer !important;
}

.no-border {
    border: none !important;
}

.rounded-8 {
    border-radius: 8px !important;
}

.rounded-12 {
    border-radius: 12px !important;
}

/* Custom components */
.alert-warning-soft {
    border-left: 5px solid var(--warning);
    border-right: 5px solid var(--warning);
    background: rgba(245, 158, 11, 0.15);
}

.icon-orange {
    stroke: #fb923c;
}

.text-exit {
    color: #fca5a5 !important;
}

.text-change {
    color: #38bdf8 !important;
}

/* Sidebar & Header Specific */
.sidebar-header-main {
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}

.sidebar-logo-container {
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-logo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-logo-sq {
    background: var(--primary);
    color: white;
    border-radius: 12px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2em;
    flex-shrink: 0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.sidebar-academia-name {
    font-weight: 800;
    letter-spacing: -0.5px;
    font-size: 1.05em;
    color: white;
    line-height: 1.3;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-section-title {
    padding: 20px 25px 10px 25px;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: inherit;
    font-weight: 800;
    opacity: 0.5;
}

.sidebar-footer-btns {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-btns-row {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.sidebar-footer-btn {
    flex: 1;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: #94a3b8;
    font-size: 1.2em;
    padding: 0;
    text-decoration: none;
    position: relative;
}

.sidebar-footer-btn:hover {
    background: var(--sidebar-hover);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 5px 0;
}

.sidebar-footer-btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.85em;
    font-weight: 700;
    transition: var(--transition);
}

.sidebar-footer-btn-logout:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar-sq {
    width: 36px;
    height: 36px;
    background: #e2e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    border: 1px solid var(--border);
}

.chat-badge-style {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1e293b;
}

.breadcrumb-label {
    font-size: 0.85em;
    color: inherit;
    opacity: 0.7;
}

.breadcrumb-separator {
    margin: 0 8px;
    opacity: 0.3;
}

.breadcrumb-active {
    font-weight: 700;
    color: inherit;
}

.opacity-60 {
    opacity: 0.6 !important;
}

.text-black {
    color: #000 !important;
}

.lh-1-2 {
    line-height: 1.2 !important;
}

.lh-1-4 {
    line-height: 1.4 !important;
}

.lh-1-5 {
    line-height: 1.5 !important;
}

.lh-1-6 {
    line-height: 1.6 !important;
}

.tracking-0-5 {
    letter-spacing: 0.5px !important;
}

.tracking-1 {
    letter-spacing: 1px !important;
}

.whitespace-nowrap {
    white-space: nowrap !important;
}

.flex-1 {
    flex: 1 !important;
}

.flex-2 {
    flex: 2 !important;
}

.flex-shrink-0 {
    flex-shrink: 0 !important;
}

.min-w-150 {
    min-width: 150px !important;
}

.min-w-200 {
    min-width: 200px !important;
}

.max-w-400 {
    max-width: 400px !important;
}

.max-w-450 {
    max-width: 450px !important;
}

.max-w-500 {
    max-width: 500px !important;
}

.max-w-600 {
    max-width: 600px !important;
}

.max-w-900 {
    max-width: 900px !important;
}

.max-h-500 {
    max-height: 500px !important;
}

.max-h-90vh {
    max-height: 90vh !important;
}

.overflow-hidden {
    overflow: hidden !important;
}

.overflow-y-auto {
    overflow-y: auto !important;
}

.uppercase {
    text-transform: uppercase !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

.border-2 {
    border-width: 2px !important;
}

.p-10-15 {
    padding: 10px 15px !important;
}

.p-20-25 {
    padding: 20px 25px !important;
}

.p-15-25 {
    padding: 15px 25px !important;
}

.p-25 {
    padding: 25px !important;
}

.p-40 {
    padding: 40px !important;
}

.grid {
    display: grid !important;
}

.grid-cols-1 {
    grid-template-columns: 1fr !important;
}

.grid-cols-2 {
    grid-template-columns: 1fr 1fr !important;
}

.grid-fit-200 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
}

.relative {
    position: relative !important;
}

.absolute {
    position: absolute !important;
}

.m-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.mb-10-auto {
    margin: 0 auto 15px auto !important;
}

.block {
    display: block !important;
}

.inline-block {
    display: inline-block !important;
}

.opacity-30 {
    opacity: 0.3 !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

.p-4-8 {
    padding: 4px 8px !important;
}

.p-5-10 {
    padding: 5px 10px !important;
}

.p-10-30 {
    padding: 10px 30px !important;
}

.p-12 {
    padding: 12px !important;
}

.border-white-20 {
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.no-decoration {
    text-decoration: none !important;
}

.lh-normal {
    line-height: normal !important;
}

.mx-5 {
    margin-left: 5px !important;
    margin-right: 5px !important;
}

.mx-8 {
    margin-left: 8px !important;
    margin-right: 8px !important;
}

.my-30 {
    margin-top: 30px !important;
    margin-bottom: 30px !important;
}

.bg-app {
    background: var(--app-bg) !important;
}

.transition-0-2 {
    transition: 0.2s !important;
}

.rounded-6 {
    border-radius: 6px !important;
}

.text-inherit {
    color: inherit !important;
}

.p-8-15 {
    padding: 8px 15px !important;
}

.p-5 {
    padding: 5px !important;
}

.legend-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-especifica {
    background: #3b82f6;
}

.legend-comun {
    background: #94a3b8;
}

.legend-blanco {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}

.test-title-floating {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.bg-primary-pure {
    background: var(--primary) !important;
    color: white !important;
}

.bg-success-pure {
    background: var(--success) !important;
    color: white !important;
}

.bg-success {
    background: var(--success) !important;
    color: white !important;
}

.bg-danger {
    background: var(--danger) !important;
    color: white !important;
}

.section-header-compact {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.text-slate-400 {
    color: #94a3b8 !important;
}

.max-h-80 {
    max-height: 80px !important;
}

.max-h-400 {
    max-height: 400px !important;
}

.min-h-150 {
    min-height: 150px !important;
}

.h-250 {
    height: 250px !important;
}

.z-9999 {
    z-index: 9999 !important;
}

.p-10-0-5-5 {
    padding: 10px 0 5px 5px !important;
}

.font-inherit {
    font-family: inherit !important;
}

.pre-wrap {
    white-space: pre-wrap !important;
}

.min-w-250 {
    min-width: 250px !important;
}

.min-w-140 {
    min-width: 140px !important;
}

.w-16 {
    width: 16px !important;
}

.h-16 {
    height: 16px !important;
}

.w-140 {
    width: 140px !important;
}

.w-160 {
    width: 160px !important;
}

.min-h-100 {
    min-height: 100px !important;
}

.bg-amber-50 {
    background: #fffcf0 !important;
}

.border-amber-100 {
    border-color: #fef3c7 !important;
}

.text-amber-800 {
    color: #92400e !important;
}

.text-amber-700 {
    color: #b45309 !important;
}

.bg-indigo-500 {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
}

.opacity-0 {
    opacity: 0;
}

.opacity-0-3 {
    opacity: 0.3 !important;
}

.transition-opacity-0-5 {
    transition: opacity 0.5s;
}

.tracking-tight-1 {
    letter-spacing: -0.5px !important;
}

.bg-success-dark {
    background: #1e7e34 !important;
}

.table-fixed {
    table-layout: fixed !important;
}

.align-top {
    vertical-align: top !important;
}

.text-xxl {
    font-size: 1.3em !important;
}

.text-amber-500 {
    color: #f59e0b !important;
}

.h-450 {
    height: 450px !important;
}

.min-h-300 {
    min-height: 300px !important;
}

.rounded-full {
    border-radius: 9999px !important;
}

.items-center {
    align-items: center !important;
}

.px-10 {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* --- RESPONSIVE DESIGN --- */

/* Sidebar Toggle Button (Hidden on Desktop) */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
    padding: 5px;
    margin-right: 10px;
}

.sidebar-overlay-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 998;
}

.sidebar-overlay-mobile.visible {
    display: block;
}

@media (max-width: 1023px) {

    body,
    .app-main-layout,
    .main-shell {
        overflow: visible !important;
        height: auto !important;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 260px;
        height: 100vh !important;
        display: flex;
        flex-direction: column;
    }

    .sidebar.visible {
        left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .top-bar {
        padding: 0 15px;
        position: sticky;
        top: 0;
        z-index: 900;
    }

    .content-canvas {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .breadcrumb-label {
        display: none;
    }

    .main-shell {
        min-width: 100%;
    }
}

/* Tablet Adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .top-bar-user .text-right {
        display: none;
    }
}

/* Scoped to test page */
@media (max-width: 768px) {
    body.page-test {
        flex-direction: column !important;
        overflow: auto !important;
        height: auto !important;
    }

    body.page-test .content-canvas {
        padding: 8px !important;
    }

    /* Cabecera compacta vertical - Dani */
    body.page-test .cabecera-test {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px !important;
        gap: 12px !important;
        margin-bottom: 15px !important;
    }

    body.page-test .caja-indicador {
        width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
    }

    body.page-test .caja-indicador .titulo-caja {
        font-size: 0.85em !important;
        padding: 8px !important;
        letter-spacing: 1px !important;
    }

    body.page-test .caja-indicador .valor-caja {
        font-size: 1.6em !important;
        padding: 10px !important;
    }

    body.page-test .botones-der {
        width: 100% !important;
        min-width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        margin-top: 10px !important;
    }

    body.page-test .botones-der .fila-superior {
        width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    body.page-test .btn-imprimir,
    body.page-test .btn-guardar,
    body.page-test .btn-finalizar-cabecera,
    body.page-test .btn-volver-res-cabecera {
        width: 100% !important;
        flex: none !important;
        padding: 12px 15px !important;
        font-size: 0.9em !important;
        text-align: center !important;
        justify-content: center !important;
        display: flex !important;
        border-radius: 10px !important;
    }

    /* Enunciado y opciones */
    body.page-test .pregunta-card {
        padding: 15px !important;
        margin-bottom: 12px !important;
    }

    body.page-test .enunciado {
        font-size: 1.1em !important;
        margin-bottom: 15px !important;
        line-height: 1.5 !important;
    }

    body.page-test .opciones-grid .opcion {
        padding: 12px !important;
        font-size: 0.9em !important;
    }

    body.page-test .letra-opcion {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.95em !important;
    }

    /* Botones de navegación */
    body.page-test .nav-buttons {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        margin-top: 20px !important;
    }

    body.page-test .nav-arrow {
        display: inline !important;
    }

    body.page-test .btn-nav {
        width: 100% !important;
        padding: 14px !important;
        font-size: 0.95em !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    body.page-test #btn-prev {
        order: 1;
    }

    body.page-test #btn-next {
        order: 2;
    }

    body.page-test .btn-ayuda {
        order: 3;
        width: 100% !important;
        padding: 14px !important;
        font-size: 0.95em !important;
    }

    body.page-test .label-auto-avance {
        order: 4;
        width: 100% !important;
        justify-content: center !important;
        margin-top: 5px !important;
        background: var(--bg-body);
        border: 1px solid var(--border-color);
        padding: 12px;
        border-radius: 10px;
        font-size: 0.9em !important;
        display: inline-flex !important;
    }

    /* Grid de números inferior táctil - Dani */
    body.page-test .panel-inferior {
        padding: 15px 10px !important;
    }

    body.page-test .grid-numeros {
        display: grid !important;
        grid-template-columns: repeat(25, 32px) !important;
        gap: 6px !important;
        justify-content: start !important;
        width: max-content !important;
        margin: 0 auto !important;
    }

    body.page-test .btn-n {
        width: 100% !important;
        height: 32px !important;
        font-size: 0.85em !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        transition: all 0.2s ease !important;
    }

    body.page-test .btn-n:active {
        transform: scale(0.9) !important;
    }

    /* Leyenda de zonas */
    body.page-test .leyenda-zonas-wrap {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 15px !important;
        background: var(--card-bg) !important;
        border-radius: 12px !important;
        border: 1px solid var(--border-color) !important;
        margin-top: 15px !important;
    }

    body.page-test .leyenda-item {
        font-size: 0.85em !important;
        font-weight: 600 !important;
    }

    /* Modales de test adaptados a UI vertical táctil - Dani */
    body.page-test .modal-finalizar-content {
        padding: 25px 20px !important;
    }

    body.page-test .modal-finalizar-content .modal-actions,
    body.page-test .modal-finalizar-content .modal-acciones-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        width: 100% !important;
    }

    body.page-test .modal-finalizar-content .modal-actions .btn,
    body.page-test .modal-finalizar-content .modal-acciones-flex .btn {
        width: 100% !important;
        padding: 14px !important;
        font-size: 0.95em !important;
        border-radius: 10px !important;
    }

    /* Dashboard: Alerta Test en Proceso */
    .alert-warning-soft .card-body {
        flex-direction: column !important;
        text-align: center;
        gap: 15px !important;
    }

    .alert-warning-soft .btn {
        width: 100%;
        justify-content: center;
    }

    /* Dashboard: Ajustes de Tabla de Exámenes */
    .datagrid-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    @media (max-width: 600px) {

        .datagrid th:nth-child(2),
        .datagrid td:nth-child(2),
        .datagrid th:nth-child(4),
        .datagrid td:nth-child(4) {
            display: none !important;
        }

        .datagrid th:nth-child(1) {
            width: 60% !important;
        }

        .datagrid th:nth-child(3) {
            width: 40% !important;
        }
    }

    /* Dashboard: Ajuste Favoritas para evitar desbordamiento */
    #lista-favoritas {
        max-width: 100%;
        overflow-x: hidden;
    }

    .pregunta-fav-item {
        word-break: break-word;
    }

    /* Resultados: Tabla de resultados */
    @media (max-width: 600px) {
        .page-resultados .page-header {
            text-align: center;
            align-items: center !important;
        }

        .page-resultados .flex.items-center {
            flex-direction: column !important;
            align-items: center !important;
            gap: 10px !important;
        }

        .page-resultados .card-header {
            justify-content: center !important;
            text-align: center;
        }

        .page-resultados .datagrid th:nth-child(3),
        .page-resultados .datagrid td:nth-child(3),
        .page-resultados .datagrid th:nth-child(4),
        .page-resultados .datagrid td:nth-child(4) {
            display: none !important;
        }

        .page-resultados .datagrid th:nth-child(1) {
            width: 25% !important;
        }

        .page-resultados .datagrid th:nth-child(2) {
            width: 45% !important;
        }

        .page-resultados .datagrid th:nth-child(5) {
            width: 15% !important;
        }

        .page-resultados .datagrid th:nth-child(6) {
            width: 15% !important;
        }

        .page-resultados .datagrid td {
            padding: 12px 10px !important;
            font-size: 0.8em !important;
        }
    }
}

/* ==========================================================================
   MODAL AYUDA TEÓRICA (Fiel reflejo de style.css para coherencia total)
   ========================================================================== */
.modal-ayuda-content {
    max-width: 1400px;
    width: 85%;
    background: var(--surface);
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
}

.modal-ayuda-header {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #334155 100%);
    color: white;
    padding: 25px 35px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-ayuda-icono {
    font-size: 2em;
}

.modal-ayuda-titulo {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
    color: white !important;
}

.modal-ayuda-cerrar {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.modal-ayuda-cerrar:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-ayuda-pregunta {
    padding: 25px 35px 15px 35px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.5;
}

.modal-ayuda-correcta {
    padding: 0 35px 25px 35px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.ayuda-etiqueta {
    display: block;
    font-weight: 800;
    font-size: 0.8em;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 15px;
    margin-bottom: 5px;
}

.valor-correcta {
    color: var(--success) !important;
    font-weight: 800 !important;
    font-size: 1.1em !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    white-space: normal !important;
}

.modal-ayuda-sep {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

.modal-ayuda-cuerpo {
    padding: 30px 35px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 1.05em;
    line-height: 1.7;
    color: var(--text-main);
}

.modal-ayuda-footer {
    padding: 20px 35px;
    background: var(--app-bg);
    display: flex;
    justify-content: center;
    gap: 15px;
}

.ayuda-loading,
.ayuda-sin-teoria {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.modal-ayuda-tags {
    padding: 0 35px 25px 35px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ayuda-tag {
    background: var(--app-bg);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid var(--border);
}

/* MODO OSCURO ESPECÍFICO */
.dark-mode .modal-ayuda-content {
    background: var(--surface);
    border-color: var(--border);
}

.dark-mode .modal-ayuda-pregunta {
    color: var(--text-main);
}

.dark-mode .modal-ayuda-cuerpo {
    color: var(--text-main);
}

.dark-mode .modal-ayuda-footer {
    background: var(--app-bg);
}

.dark-mode .ayuda-tag {
    background: var(--app-bg);
    color: var(--text-muted);
    border-color: var(--border);
}

@media (max-width: 600px) {
    .modal-ayuda-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-ayuda-header {
        padding: 15px 20px;
    }

    .modal-ayuda-pregunta,
    .modal-ayuda-cuerpo,
    .modal-ayuda-correcta,
    .modal-ayuda-footer {
        padding: 15px 20px !important;
    }
}

/* --- LOGIN & INDEX --- */
.login-success {
    background-color: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid #bbf7d0;
}

.login-copyright-link {
    color: var(--text-main);
    font-size: 0.95em;
    text-decoration: underline;
    margin-top: 10px;
    display: inline-block;
    font-weight: 600;
}

/* --- POLÍTICA DE PRIVACIDAD --- */
.privacy-body {
    padding: 15px;
    box-sizing: border-box;
}

.privacy-card {
    background: var(--card-bg);
    max-width: 800px;
    width: 100%;
    margin: 40px auto;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    line-height: 1.6;
}

.privacy-card h1 {
    color: var(--primary);
    margin-bottom: 25px;
    text-align: center;
}

.privacy-card h2 {
    font-size: 1.25em;
    color: var(--text-main);
    margin-top: 30px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
}

.privacy-card p {
    margin-bottom: 15px;
    font-size: 0.95em;
    color: var(--text-muted);
}

.privacy-card ul {
    margin-bottom: 15px;
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 0.95em;
}

.privacy-card li {
    margin-bottom: 8px;
}

.btn-volver {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
}

.btn-volver:hover {
    text-decoration: underline;
}

.privacy-scroll-area {
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body);
    margin-bottom: 20px;
}

.privacy-logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.privacy-logo {
    max-height: 60px;
}

.privacy-footer-actions {
    text-align: center;
    margin-top: 20px;
}

.privacy-btn-aceptar {
    display: inline-block;
    padding: 10px 30px;
    text-decoration: none;
}

@media (max-width: 600px) {
    .privacy-card {
        padding: 25px;
        margin: 20px auto;
    }
}

/* --- REGISTRO / LOGIN REFINEMENTS --- */
.login-container {
    max-width: 420px;
    transition: max-width 0.3s ease;
    margin: 20px auto;
}

.login-card {
    max-height: 95vh;
    overflow-y: auto;
    padding: 20px 25px;
}

.form-group-login {
    margin-bottom: 8px !important;
}

.login-header h2 {
    margin-bottom: 5px;
}

.login-header {
    margin-bottom: 10px;
}

.logo-top-left {
    display: none;
}

/* Obsoleto */

.required-star {
    color: #ef4444;
    margin-left: 3px;
}

#user-status,
#dni-status {
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 5px;
}

/* --- REGISTRO LAYOUT --- */
.login-card {
    position: relative;
    padding-top: 20px !important;
}

.registro-logo-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.registro-logo {
    max-height: 80px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.login-header {
    margin-top: 10px;
    margin-bottom: 25px;
    text-align: center;
}

.login-header h2 {
    font-size: 1.4em;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .login-card {
        padding-top: 25px !important;
    }

    .registro-logo-container {
        position: static;
        text-align: center;
        margin-bottom: 20px;
    }

    .registro-logo {
        max-height: 60px;
    }

    .login-logo {
        width: 150px;
        /* Reducido un 25% respecto a los 200px originales */
    }

    .login-header {
        padding-left: 0;
        text-align: center;
    }
}

@media (min-width: 992px) {
    .registro-container-wide {
        max-width: 850px;
    }

    .registro-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 5px 20px;
        /* Reducido de 10px a 5px en vertical */
        text-align: left;
    }

    .full-width {
        grid-column: span 2;
    }
}

/* --- LA BATIDORA (IMPORTADOR PDF) --- */
.pdf-upload-zone {
    border: 2px dashed var(--border);
    padding: 40px;
    text-align: center;
    border-radius: 16px;
    background: var(--app-bg);
    transition: var(--transition);
    margin-bottom: 25px;
}

.pdf-upload-zone:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.pdf-input {
    display: none;
}

.pdf-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 15px;
    transition: var(--transition);
}

.pdf-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.textarea-pdf {
    width: 100%;
    height: 180px;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85em;
    resize: vertical;
    margin-bottom: 15px;
}

.scroll-container-bordered {
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 550px;
    overflow-y: auto;
    background: var(--surface);
}

.q-row {
    display: grid;
    grid-template-columns: 60px 1fr 140px 160px;
    gap: 20px;
    padding: 15px 25px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.q-row:hover {
    background: var(--app-bg);
}

.q-num {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.1em;
}

.q-text-normal {
    font-weight: 500;
    line-height: 1.4;
}

.q-text-warning {
    color: var(--warning);
    font-weight: 700;
    font-style: italic;
}

.q-enlace-ok {
    font-size: 0.85em;
    color: var(--success);
    margin-top: 6px;
    font-weight: 600;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.7em;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    text-align: center;
}

.status-ok {
    background: var(--success-soft);
    color: var(--success);
}

.status-fail {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.q-actions-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.q-actions-mini {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.btn-mini {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.85em;
    transition: var(--transition);
}

.btn-mini:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filtro-pendientes-container {
    padding: 15px 25px;
    background: rgba(245, 158, 11, 0.05);
    border-bottom: 1px solid var(--border);
}

.spinner-icon {
    display: inline-block;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.anim-pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.resultado-modal-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.resultado-modal-item:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

.opciones-colapsables.hidden {
    display: none;
}

/* --- AJUSTES VISUALES MÓVILES PARA MÓDULOS --- */
@media (max-width: 768px) {

    /* Ajustes generales de espaciado */
    .content-canvas {
        padding: 10px !important;
    }

    .card-body {
        padding: 15px !important;
    }

    /* Buscador Global: Apilar campos y centrar */
    .card-body>div[style*="flex-wrap: wrap"] {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 15px !important;
    }

    .card-body>div>div[style*="flex: 1"],
    .card-body>div>div[style*="flex: 1.5"] {
        width: 100% !important;
        min-width: 0 !important;
    }

    .card-body button[onclick*="buscar"] {
        width: 100% !important;
        padding: 15px !important;
        margin-top: 10px;
    }

    /* Mapa de Comunidades: Ajustar directorio */
    .directory-card .card-header {
        flex-direction: column !important;
        gap: 10px !important;
        text-align: center;
    }

    .mapa-leyenda {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* Tablas (DataGrids): Mejorar scroll y legibilidad */
    .datagrid-container {
        border-radius: 8px !important;
    }

    .datagrid th,
    .datagrid td {
        padding: 10px 8px !important;
        font-size: 0.8em !important;
    }

    /* Cabeceras de página compactas */
    .page-header {
        text-align: center;
        align-items: center !important;
        margin-bottom: 15px !important;
    }

    .page-header h1 {
        font-size: 1.4em !important;
    }

    .page-header .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .page-header>div:last-child {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

/* Estilo para preguntas saltadas (visitadas pero no contestadas) */
body.page-test .btn-n.visitada {
    background: #94a3b8 !important;
    /* Gris medio */
    color: white !important;
    border-color: #64748b !important;
    opacity: 0.7;
}


/* --- SECCIN ANALTICA --- */
:root {
    --heatmap-empty: #e2e8f0;
}

body.dark-mode {
    --heatmap-empty: #1e293b;
}

.analytics-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

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

.analytics-title {
    font-size: 1.8em;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.analytics-subtitle {
    color: var(--text-muted);
    margin-top: 5px;
}

.analytics-status-badge {
    background: var(--surface);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.analytics-status-label {
    font-size: 0.8em;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.analytics-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.analytics-status-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

.analytics-status-text {
    font-weight: 800;
    color: var(--text-main);
}

.analytics-card {
    background: var(--surface);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

.analytics-card.compact {
    padding: 30px;
    margin-bottom: 0;
}

.analytics-card-title {
    font-size: 1em;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-card-title.critical {
    color: #ef4444;
    margin-bottom: 25px;
}

.analytics-heatmap-container {
    display: grid;
    grid-template-rows: repeat(7, 14px);
    grid-template-columns: repeat(13, 1fr);
    gap: 4px;
    padding: 15px;
    background: var(--app-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
    box-sizing: border-box;
}

.heatmap-toggle-icon {
    opacity: 0.5;
    transition: transform 0.3s ease;
    font-size: 0.8em;
    display: inline-block;
    transform: rotate(180deg); /* Flecha hacia arriba ▲ por defecto en desktop */
}

.analytics-heatmap-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.analytics-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.7em;
    color: var(--text-muted);
    font-weight: 700;
}

.analytics-heatmap-box {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.analytics-grid-row {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

.analytics-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analytics-advice-card {
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
    color: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.analytics-advice-label {
    margin: 0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.analytics-advice-text {
    margin-top: 15px;
    font-size: 0.95em;
    line-height: 1.5;
    font-weight: 500;
    text-align: justify;
}

.analytics-advice-tip {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 10px;
    text-align: justify;
}

/* Clases para elementos dinmicos */
.analytics-item-card {
    background: var(--app-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

.analytics-item-header {
    padding: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-item-progress-bg {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

.analytics-item-progress-fill {
    height: 100%;
    background: linear-gradient(to right, #ef4444, #f87171);
    border-radius: 10px;
}

.analytics-item-toggle {
    text-align: center;
    font-size: 0.7em;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 10px;
    letter-spacing: 0.5px;
}

.analytics-detail-container {
    display: none;
    padding: 0 15px 15px;
    border-top: 1px dashed var(--border);
    background: var(--surface);
}

.analytics-detail-content {
    padding-top: 15px;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 5px;
}

.analytics-question-row {
    margin-bottom: 20px;
    border-left: 3px solid #ef4444;
    padding-left: 12px;
}

.analytics-question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.analytics-question-tag {
    font-size: 0.7em;
    background: #fee2e2;
    color: #ef4444;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    margin-left: 10px;
    white-space: nowrap;
}

body.dark-mode .analytics-question-tag {
    background: rgba(239, 68, 68, 0.2);
}

.analytics-correct-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px;
    margin-top: 5px;
}

body.dark-mode .analytics-correct-box {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.analytics-correct-label {
    font-size: 0.65em;
    font-weight: 800;
    color: #166534;
    text-transform: uppercase;
    margin-bottom: 4px;
}

body.dark-mode .analytics-correct-label {
    color: #10b981;
}

.analytics-correct-text {
    font-size: 0.8em;
    color: #166534;
}

body.dark-mode .analytics-correct-text {
    color: #34d399;
}


/* --- OVERRIDES FOR TEST EN PROCESO --- */
.alert-proceso-test {
    background: rgba(37, 99, 235, 0.85);
    /* Azul muy opaco */
    border-left: 5px solid #1e3a8a;
    border-right: 5px solid #1e3a8a;
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.alert-proceso-test h3,
.alert-proceso-test p {
    color: #ffffff !important;
}

.alert-proceso-test .btn {
    background: #ffffff;
    color: #1e40af;
    border: none;
    font-weight: 700;
}

.alert-proceso-test .btn:hover {
    background: #f1f5f9;
}

@media (max-width: 768px) {

    /* Dashboard: Alerta Test en Proceso */
    .alert-proceso-test .card-body {
        flex-direction: column !important;
        text-align: center;
        gap: 15px !important;
    }

    .alert-proceso-test .btn {
        width: 100%;
        justify-content: center;
    }
}


/* --- OVERRIDES FOR BTN-AYUDA --- */
.btn.btn-ayuda {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

.btn.btn-ayuda:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.6) !important;
    transform: translateY(-2px) !important;
}


/* --- OVERRIDES FOR IMPRIMIR Y GUARDAR --- */
.btn.btn-imprimir,
.btn.btn-guardar {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2) !important;
}

.btn.btn-imprimir:hover,
.btn.btn-guardar:hover {
    background: #1d4ed8 !important;
    /* Un azul un poco mas oscuro para el hover */
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3) !important;
    transform: translateY(-2px) !important;
}


/* --- TOP BAR SYNC WITH SIDEBAR --- */
.top-bar {
    background: var(--sidebar-bg) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

.top-bar .breadcrumb-label {
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 0.85em;
    font-weight: 500;
}

.top-bar .breadcrumb-separator {
    color: rgba(255, 255, 255, 0.3) !important;
    margin: 0 8px;
}

.top-bar .breadcrumb-active {
    color: #ffffff !important;
    font-weight: 700;
}

.top-bar .text-main {
    color: #ffffff !important;
}

.top-bar .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

.top-bar .sidebar-toggle {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.top-bar .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.top-bar .user-avatar-sq {
    border: 1px solid rgba(255, 255, 255, 0.1);
}


/* --- FIX: HIDE SIDEBAR TOGGLE ON DESKTOP --- */
.top-bar .sidebar-toggle {
    display: none !important;
}

@media (max-width: 1024px) {
    .top-bar .sidebar-toggle {
        display: flex !important;
    }
}


/* --- MOBILE DASHBOARD GRID FIX: 1 COLUMN --- */
@media (max-width: 768px) {
    body .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}


/* --- MOBILE TOP BAR REFINEMENT --- */
@media (max-width: 768px) {
    .top-bar {
        padding: 0 8px !important;
        /* Casi pegado al borde */
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 64px !important;
    }

    .top-bar .sidebar-toggle {
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: flex !important;
        order: -1;
        /* Forzar a la izquierda absoluta */
    }

    .top-bar-user {
        margin-left: auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .top-bar-user .text-right {
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin-top: 0 !important;
    }

    /* Aseguramos que el badge premium no empuje hacia abajo */
    .top-bar-user span.rounded {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 2px 6px !important;
        font-size: 0.7em !important;
    }
}


/* --- AGGRESSIVE MOBILE ALIGNMENT --- */
@media (max-width: 768px) {
    .top-bar {
        justify-content: flex-start !important;
        /* Forzar inicio */
    }

    .top-bar>div:first-child {
        margin-left: 0 !important;
        padding-left: 0 !important;
        display: flex !important;
        align-items: center !important;
    }

    .top-bar .sidebar-toggle {
        margin-left: 0 !important;
        position: relative !important;
        left: 0 !important;
    }

    .top-bar-user {
        margin-left: auto !important;
        /* Esto empuja al usuario a la derecha y deja el resto a la izquierda */
    }
}


/* --- FINAL ATTEMPT AT MOBILE TOP BAR ALIGNMENT --- */
@media (max-width: 1024px) {
    .top-bar {
        background: var(--sidebar-bg) !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 10px !important;
        height: 64px !important;
    }

    .top-bar>div:first-child {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
    }

    .top-bar .sidebar-toggle {
        display: flex !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 40px !important;
        height: 40px !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .top-bar .breadcrumb-label {
        display: none !important;
    }

    .top-bar-user {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin-left: auto !important;
        flex: 0 0 auto !important;
    }
}

/* =========================================
   🎓 MÓDULO: EXÁMENES DE ACADEMIA
   ========================================= */
.crear-examen-container {
    background: #f8fafc;
    border-radius: 24px;
    padding: 20px;
    margin-top: 10px;
}

.question-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.question-card.selected {
    background: linear-gradient(to right, #f0f9ff, #fff);
    border-color: var(--primary);
    border-left-width: 5px;
}

.zona-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.bg-soft-primary {
    background-color: rgba(37, 99, 235, 0.1);
}

.text-xxs {
    font-size: 0.65rem;
}

.random-box {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Dark Mode Adjustments for Academy Exams */
.dark-mode .question-card {
    background: #1e293b;
    border-color: #334155;
}

.dark-mode .question-card.selected {
    background: linear-gradient(to right, #1e3a8a, #1e293b);
    border-color: #3b82f6;
}

.dark-mode .crear-examen-container {
    background: #0f172a;
}

/* =========================================
   FINANCIAL MODULE & CUSTOM GRADIENTS
   ========================================= */
.bg-primary-gradient {
    background: linear-gradient(135deg, #1c75bc 0%, #1e293b 100%) !important;
}

.bg-dark-blue-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1c75bc 100%) !important;
}

.bg-dark-red-gradient {
    background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 100%) !important;
}

.bg-dark-yellow-gradient {
    background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%) !important;
}

.card-kpi {
    border: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.card-kpi:hover {
    transform: translateY(-5px);
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.font-black {
    font-weight: 900;
}

.grid-fit-250 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.bg-white-10 {
    background-color: rgba(255, 255, 255, 0.1);
}

.border-white-20 {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.min-w-100 {
    min-width: 100px;
}

/* --- BOTN PREMIUM TOPBAR --- */
.btn-premium-topbar {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: #000;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: 99px;
    border: none;
    cursor: pointer;
    margin-right: 5px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    animation: pulse-premium-wow 2s infinite;
    white-space: nowrap;
}

@keyframes pulse-premium-wow {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    }
}

.btn-premium-topbar:hover {
    transform: translateY(-2px) scale(1.08);
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

/* --- BOTÓN PREMIUM TOPBAR --- */
.btn-premium-topbar {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    color: #000;
    font-weight: 900;
    font-size: 0.7rem;
    padding: 6px 16px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    margin-right: 5px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse-premium-wow 2.5s infinite;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-premium-topbar::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: rotate(25deg);
    transition: none;
    animation: shine-premium 4s infinite;
}

@keyframes shine-premium {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

@keyframes pulse-premium-wow {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(245, 158, 11, 0.7);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5);
    }
}

.btn-premium-topbar:hover {
    transform: translateY(-3px) scale(1.1);
    filter: brightness(1.2);
    box-shadow: 0 12px 30px rgba(245, 158, 11, 0.6);
}

.btn-premium-topbar:active {
    transform: translateY(-1px) scale(0.95);
}

/* --- REVISIN DE TEORA --- */
.aviso-revision {
    background: #fff3cd;
    color: #856404;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ffeeba;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-revision-teoria {
    background: var(--bg-app, #f8fafc);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-revision-teoria:hover {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.btn-revision-teoria.active {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* ==========================================================================
   MIGRADOS Y AGREGADOS: AJUSTES RESPONSIVOS DE ALTA CALIDAD - DANI
   ========================================================================== */

/* Ajustes globales de tabletas (ancho <= 1024px) */
@media (max-width: 1024px) {
    /* Modales en tabletas */
    .modal-content, 
    .modal-wrapper,
    #modalConfigTest .modal-content, 
    #modalAvisoTest .modal-content, 
    #modalConfirmarQuitarFav .modal-content,
    #modalHotmailWarning .modal-content,
    #modalMiPerfil .modal-content,
    #modalOnline .modal-content,
    #modalTablon .modal-content,
    #modalBienvenidaPremium .modal-content {
        max-height: 90vh !important;
        overflow-y: auto !important;
        width: 90% !important;
        max-width: 650px !important;
    }

    /* Ajustes responsivos para el panel de analíticas - Dani */
    .analytics-grid-row {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .analytics-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }
}

/* Ajustes globales de móviles (ancho <= 768px) */
@media (max-width: 768px) {
    /* Blindaje universal de modales para evitar recortes en pantallas táctiles */
    .modal-content, 
    .modal-wrapper,
    #modalConfigTest .modal-content, 
    #modalAvisoTest .modal-content, 
    #modalConfirmarQuitarFav .modal-content,
    #modalHotmailWarning .modal-content,
    #modalMiPerfil .modal-content,
    #modalOnline .modal-content,
    #modalTablon .modal-content,
    #modalBienvenidaPremium .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 15px auto !important;
        padding: 20px 15px !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
        border-radius: 16px !important;
    }

    /* Modales específicos del tablón */
    .tablon-modal-ajuste {
        width: 95% !important;
        max-width: 95% !important;
    }

    /* Rediseño y simplificación del Topbar en móviles para evitar colisiones */
    .top-bar {
        height: 60px !important;
        padding: 0 10px !important;
    }

    .top-bar-user {
        gap: 6px !important;
    }

    /* Botón premium más compacto en cabecera de móviles */
    .btn-premium-topbar {
        padding: 4px 10px !important;
        font-size: 0.65rem !important;
        letter-spacing: 0.3px !important;
        gap: 4px !important;
    }

    .btn-premium-topbar::after {
        display: none !important; /* Desactivar shimmer para ahorrar GPU en móviles */
    }

    /* Reducir el tamaño de los badges de Premium en la cabecera en móviles */
    .top-bar-user span[style*="font-size: 0.75em"] {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }

    /* Flujo vertical para filtros del Dashboard - Dani */
    #contenedor-oficiales .flex-wrap, 
    #contenedor-academia .flex-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    #contenedor-oficiales .form-control,
    #contenedor-oficiales .btn,
    #contenedor-academia .form-control,
    #contenedor-academia .btn {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        box-sizing: border-box !important;
    }

    /* Asegurar scroll suave en contenedores datagrid - Dani */
    .datagrid-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 12px !important;
        border: 1px solid var(--border-color) !important;
        margin-bottom: 15px !important;
    }

    .datagrid {
        min-width: 600px !important; /* Fuerza a que haya scroll horizontal si no cabe */
        width: 100% !important;
    }
}

/* Ajustes para móviles muy pequeños (ancho <= 480px) */
@media (max-width: 480px) {
    /* Ocultar textos no esenciales para evitar colisión con el toggle del menú lateral */
    .breadcrumb-label {
        display: none !important;
    }

    .top-bar-user span[style*="font-size: 0.75em"] {
        max-width: 95px !important;
    }
}

/* ==========================================================================
   AJUSTES RESPONSIVOS ADICIONALES: BUSCADOR DE PREGUNTAS EN MÓVILES - DANI
   ========================================================================== */
@media (max-width: 768px) {
    /* Desactivar contenedores rígidos de tablas para permitir tarjetas flex */
    body .datagrid-container {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    /* Ocultar las cabeceras de la tabla */
    body table.datagrid-buscador thead {
        display: none !important;
    }

    /* Convertir tabla en lista de bloques (tarjetas) */
    body table.datagrid-buscador,
    body table.datagrid-buscador tbody,
    body table.datagrid-buscador tr.pregunta-row {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Estilo de tarjeta premium para cada pregunta */
    body table.datagrid-buscador tr.pregunta-row {
        background: var(--surface) !important;
        border: 1px solid var(--border) !important;
        border-radius: 16px !important;
        margin-bottom: 20px !important;
        padding: 20px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
        box-sizing: border-box !important;
        transition: transform 0.2s, box-shadow 0.2s !important;
    }

    /* Quitar paddings y bordes de celdas por defecto */
    body table.datagrid-buscador td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Referencia (Número): arriba a la izquierda */
    body table.datagrid-buscador td:nth-child(1) {
        display: inline-block !important;
        width: auto !important;
        vertical-align: middle !important;
        margin-bottom: 10px !important;
    }

    /* Especialidad (Badge): arriba junto al número */
    body table.datagrid-buscador td:nth-child(2) {
        display: inline-block !important;
        width: auto !important;
        vertical-align: middle !important;
        margin-left: 10px !important;
        margin-bottom: 10px !important;
    }

    /* Enunciado de la pregunta: cuerpo principal */
    body table.datagrid-buscador td:nth-child(3) {
        margin-top: 5px !important;
        margin-bottom: 15px !important;
        clear: both !important;
    }

    /* Botones de acción: alineados abajo en fila táctil */
    body table.datagrid-buscador td:nth-child(4) {
        display: flex !important;
        justify-content: flex-end !important;
        border-top: 1px solid var(--border) !important;
        padding-top: 15px !important;
        margin-top: 5px !important;
        width: 100% !important;
    }

    /* Espaciar botones de acción en móviles */
    body table.datagrid-buscador td:nth-child(4) div {
        width: 100% !important;
        justify-content: space-around !important;
    }

    /* Formulario de búsqueda adaptado a móviles */
    body .buscador-form-container {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px !important;
        gap: 15px !important;
    }
    
    body .buscador-form-container > div {
        width: 100% !important;
        flex: none !important;
        min-width: 0 !important;
    }

    body .buscador-form-container div[style*="padding-top: 25px"] {
        padding-top: 5px !important;
        width: 100% !important;
    }

    body .buscador-form-container div[style*="padding-top: 25px"] button {
        width: 100% !important;
        padding: 14px !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        justify-content: center !important;
        display: flex !important;
        border-radius: 12px !important;
    }

    /* Ocultar el título de página duplicado en móviles (ya que se muestra en el top-bar) */
    body .page-header-buscador {
        display: none !important;
    }

    /* Ocultar el badge verde estático de Nivel de Preparación en móviles */
    body .analytics-status-badge {
        display: none !important;
    }

    /* Ocultar el mapa de calor por defecto en móviles (se desplegará al pulsar) */
    body #heatmapWrapper {
        display: none;
    }

    /* La flecha apunta hacia abajo ▼ inicialmente en móviles (colapsado) */
    body .heatmap-toggle-icon {
        transform: rotate(0deg) !important;
    }

    /* Blindaje contra desbordamiento horizontal y márgenes asimétricos */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    body .app-main-layout, 
    body .main-shell {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        width: 100% !important;
    }

    /* Ajustar elementos del Topbar para evitar empujar la pantalla en móviles muy pequeños */
    @media (max-width: 600px) {
        body .cap-selector-wrapper select {
            padding: 6px 8px !important;
            font-size: 0.72rem !important;
            max-width: 110px !important;
        }

        body .top-bar-user span[style*="font-size: 0.75em"] {
            max-width: 85px !important;
            font-size: 0.6rem !important;
            padding: 2px 4px !important;
        }
    }
}

/* ==========================================================================
   TARJETA DE PROBABILIDAD DE APROBADO - ESPECÍFICA PARA DASHBOARD
   ========================================================================== */
.contenedor-probabilidad-aprobado-dashboard {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 135px !important;
    margin-bottom: 25px !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 20px !important;
    overflow: visible !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-md) !important;
    position: relative !important;
    z-index: 9999 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.contenedor-probabilidad-aprobado-dashboard:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.cuerpo-probabilidad-aprobado-dashboard {
    padding: 20px 25px 30px 25px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 100px !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   PANEL AISLADO PROBABILIDAD (SOLO PARA DASHBOARD - A PETICION DEL USUARIO)
   ========================================================================== */
.panel-aislado-prob-dash {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 135px !important;
    margin-bottom: 25px !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 20px !important;
    overflow: visible !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-md) !important;
    position: relative !important;
    z-index: 9999 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.panel-aislado-prob-dash:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.cuerpo-aislado-prob-dash {
    padding: 20px 25px 35px 25px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 100px !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   TARJETA DE PROBABILIDAD DE APROBADO - ESPECÍFICA PARA RESULTADOS
   ========================================================================== */
.contenedor-probabilidad-aprobado-resultados {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 135px !important;
    margin-bottom: 25px !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 20px !important;
    overflow: visible !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-md) !important;
    position: relative !important;
    z-index: 9999 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.contenedor-probabilidad-aprobado-resultados:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.cuerpo-probabilidad-aprobado-resultados {
    padding: 20px 25px 30px 25px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 100px !important;
    box-sizing: border-box !important;
}