/* ==================== VARIABLES ==================== */
:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== HEADER ==================== */
.exam-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.exam-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.exam-header h1 i {
    margin-right: 12px;
    color: var(--secondary-color);
}

.exam-header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ==================== SECTIONS ==================== */
.section {
    display: none;
    padding: 40px 20px;
    min-height: calc(100vh - 120px);
}

.section.active {
    display: block;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
}

.card-header {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    padding: 25px;
    border-bottom: 2px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.card-header h2 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.card-header p {
    color: var(--text-light);
    margin: 0;
}

.card-body {
    padding: 30px;
}

/* ==================== FORM ==================== */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    /* display: block; */
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group label i {
    color: var(--primary-color);
    margin-right: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* ==================== INSTRUCTIONS BOX ==================== */
.instructions-box {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
}

.instructions-box h3 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 15px;
}

.instructions-box h3 i {
    margin-right: 8px;
}

.instructions-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-box li {
    padding: 8px 0;
    color: var(--text-dark);
    position: relative;
    padding-left: 25px;
}

.instructions-box li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* ==================== LEVEL SCALE ==================== */
.level-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
    font-style: italic;
}

.level-scale {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
}

.scale-label-side {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    flex-shrink: 0;
    max-width: 120px;
}

.scale-label-left {
    text-align: right;
}

.scale-label-right {
    text-align: left;
}

.scale-options {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
}

.scale-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.scale-option input[type="radio"] {
    appearance: none;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
}

.scale-option input[type="radio"]:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.scale-option input[type="radio"]:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.2);
}

.scale-option input[type="radio"]:checked + .scale-number {
    color: var(--primary-color);
    font-weight: 700;
}

.scale-number {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s ease;
}

/* Responsive: Una sola fila con etiquetas y flechas en móvil */
@media (max-width: 768px) {
    .level-scale {
        position: relative;
        flex-direction: column;
        gap: 10px;
        padding: 50px 15px 50px 15px; /* Espacio para etiquetas arriba/abajo */
    }
    
    .scale-label-side {
        position: absolute;
        max-width: 100%;
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    .scale-label-left {
        top: 10px;
        left: 15px;
        text-align: left;
    }
    
    /* Flecha apuntando abajo hacia el 0 */
    .scale-label-left::after {
        content: "↓";
        display: block;
        font-size: 1.2rem;
        color: var(--primary-color);
        margin-top: 2px;
    }
    
    .scale-label-right {
        bottom: 10px;
        right: 15px;
        text-align: right;
    }
    
    /* Flecha apuntando arriba hacia el 5 */
    .scale-label-right::before {
        content: "↑";
        display: block;
        font-size: 1rem;
        color: var(--primary-color);

        margin-bottom: 2px;
    }
    
    .scale-options {
        order: 0;
        flex-wrap: nowrap; /* Todo en una fila */
        justify-content: space-between;
        gap: 7px;
        overflow-x: auto; /* Por si es pantalla muy pequeña */
        padding-top: 10px;
    }
    
    .scale-option {
        flex: 0 0 auto;
        min-width: 45px;
    }
    
    .scale-option input[type="radio"] {
        width: 32px;
        height: 32px;
    }
    
    .scale-number {
        font-size: 0.8rem;
    }
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: inherit;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: #6b7280;
    color: var(--white);
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

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

.btn-warning:hover:not(:disabled) {
    background: #d97706;
}

.btn-large {
    width: 100%;
    padding: 15px 24px;
    font-size: 1.1rem;
    justify-content: center;
}

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

/* ==================== PROGRESS BAR ==================== */
.progress-container {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 20px;
}

/* ==================== QUESTION CARD ==================== */
.question-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.question-header {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    padding: 15px 25px;
    border-bottom: 2px solid var(--border-color);
}

.question-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-body {
    padding: 40px 30px;
}

.question-text {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 30px;
    line-height: 1.6;
}

/* ==================== OPTIONS ==================== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-item {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-item:hover {
    background: #f0f9ff;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.option-item.selected {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-color: var(--primary-color);
    border-width: 3px;
}

.option-radio {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.option-item.selected .option-radio {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.option-item.selected .option-radio:after {
    content: "✓";
    color: var(--white);
    font-weight: bold;
    font-size: 14px;
}

.option-key {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 8px;
}

.option-text {
    flex: 1;
    color: var(--text-dark);
    font-size: 1.05rem;
}

/* ==================== NAVIGATION ==================== */
.question-navigation {
    padding: 25px 30px;
    background: #f9fafb;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* ==================== RESULTS ==================== */
.results-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 50px 40px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.results-icon {
    font-size: 5rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
    animation: bounce 1s ease;
}

.results-title {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 40px;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    padding: 20px;
    background: var(--bg-light);
    border-radius: 10px;
}

.result-item.highlight {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 2px solid var(--primary-color);
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
}

.result-value.large {
    font-size: 2.2rem;
    color: var(--primary-color);
}

.results-progress {
    width: 100%;
    height: 20px;
    background-color: #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 30px;
}

.results-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    width: 0%;
    transition: width 1s ease;
    border-radius: 20px;
}

.results-message {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
}

.results-message p {
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: var(--white);
}

.loading-spinner i {
    font-size: 4rem;
    margin-bottom: 20px;
}

.loading-spinner p {
    font-size: 1.2rem;
}

/* ==================== ANIMATIONS ==================== */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

.question-card {
    animation: fadeIn 0.4s ease;
}

/* ==================== RESPONSIVE ==================== */

/* Tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .content-wrapper {
        gap: 30px;
    }

    .levels-grid {
        grid-template-columns: 1fr;
    }
}

/* Móviles */
@media (max-width: 768px) {
    /* Header más compacto */
    .exam-header {
        padding: 20px;
    }

    .exam-header h1 {
        font-size: 1.3rem;
    }

    .exam-header .subtitle {
        font-size: 0.85rem;
    }

    /* Container y secciones más compactas */
    .container {
        padding: 0 2px;
    }

    .section {
        padding: 15px;
        min-height: auto;
    }

    /* Cards más compactas */
    .card-header {
        padding: 15px;
    }

    .card-header h2 {
        font-size: 1.1rem;
    }

    .card-header p {
        font-size: 0.85rem;
    }

    .card-body {
        padding: 15px;
    }

    /* Form groups más compactos */
    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }

    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 0.9rem;
    }

    /* Instructions box compacta */
    .instructions-box {
        padding: 12px;
        margin: 15px 0;
        font-size: 0.85rem;
    }

    .instructions-box h3 {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    .instructions-box li {
        padding: 4px 0;
        padding-left: 20px;
        font-size: 0.8rem;
    }

    /* Botones más compactos */
    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .btn-large {
        padding: 12px 20px;
        font-size: 1rem;
    }

    /* Level scale más compacta */
    .level-description {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .level-scale {
        position: relative;
        flex-direction: column;
        gap: 10px;
        padding: 45px 15px 45px 15px;
    }
    
    .scale-label-side {
        position: absolute;
        max-width: 100%;
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .scale-label-left {
        top: 8px;
        left: 15px;
        text-align: left;
    }
    
    .scale-label-left::after {
        content: "↓";
        display: block;
        font-size: 1rem;
        color: var(--primary-color);
        margin-top: 2px;
    }
    
    .scale-label-right {
        bottom: 8px;
        right: 15px;
        text-align: right;
    }
    
    .scale-label-right::before {
        content: "↑";
        display: block;
        font-size: 1rem;
        color: var(--primary-color);
        margin-bottom: 2px;
    }
    
    .scale-options {
        order: 0;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 4px;
        overflow-x: auto;
    }
    
    .scale-option {
        flex: 0 0 auto;
        min-width: 40px;
    }
    
    .scale-option input[type="radio"] {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }
    
    .scale-number {
        font-size: 0.75rem;
        margin-top: 5px;
    }

    /* Progress más compacto */
    .progress-container {
        padding: 12px;
        margin-bottom: 15px;
    }

    .progress-info {
        font-size: 0.8rem;
    }

    .progress-bar {
        height: 8px;
    }

    /* Question card compacta */
    .question-header {
        padding: 10px 15px;
    }

    .question-number {
        font-size: 0.75rem;
    }

    .question-body {
        padding: 20px 15px;
    }

    .question-text {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    /* Options más compactas */
    .options-container {
        gap: 10px;
    }

    .option-item {
        padding: 12px 15px;
    }

    .option-text {
        font-size: 0.9rem;
    }

    /* Navigation compacta */
    .question-navigation {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }

    .nav-center {
        order: -1;
        margin-bottom: 10px;
    }

    .question-navigation .btn {
        width: 100%;
        justify-content: center;
    }

    /* Results compactas */
    .results-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .results-card {
        padding: 20px 15px;
    }

    .results-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    .results-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }

    .result-item {
        padding: 15px;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .result-value.large {
        font-size: 1.8rem;
    }

    .results-message {
        padding: 15px;
        margin-bottom: 20px;
    }

    /* Footer compacto */
    .page-footer {
        padding: 10px;
        font-size: 0.7rem;
    }

    /* Topics/Schedule sections */
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .topics-column {
        position: static;
    }

    .topics-image-container {
        min-height: 300px;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .levels-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .level-card {
        padding: 20px;
    }
}

/* ==================== INTL TEL INPUT OVERRIDES ==================== */
.iti {
    width: 100%;
}

.iti__flag-container {
    padding: 0;
}

/* ==================== PAGE FOOTER ==================== */
.page-footer {
    background-color: #1f2937;
    color: #9ca3af;
    padding: 15px 20px;
    text-align: center;
    font-size: 0.85rem;
}

.page-footer p {
    margin: 0;
}

.page-footer a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.page-footer a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* ==================== CUSTOM MODAL ==================== */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.custom-modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 35px 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.modal-icon.info {
    color: var(--primary-color);
}

.modal-icon.warning {
    color: var(--warning-color);
}

.modal-icon.error {
    color: var(--danger-color);
}

.modal-icon.success {
    color: var(--success-color);
}

.modal-content h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 25px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-buttons .btn {
    min-width: 110px;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 25px 20px;
        max-width: 95%;
    }

    .modal-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    .modal-content h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .modal-content p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .modal-buttons {
        /* flex-direction: column; */
        gap: 10px;
    }

    .modal-buttons .btn {
        display:table-cell;
        width: 100%;
    }
}