:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --border-color: #e2e8f0;
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --dark: #0f172a;
    --radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease-in-out;
}

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

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    width: 100%;
}

.app-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

/* Header */
header {
    margin-bottom: 2rem;
}



header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
}

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

/* Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    color: var(--text-muted);
    transition: var(--transition);
}

.step.active {
    color: var(--primary);
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: var(--transition);
}

.step.active .step-icon {
    background: #eff6ff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.step-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.progress-bar-container {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 33%;
    transition: width 0.3s ease;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active {
    display: block;
}

.view-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

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

.animate-in {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

/* Option Cards */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.option-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.option-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.option-card.selected {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.option-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.option-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-select {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--card-bg);
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em 1.5em;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Buttons */
.actions {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

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

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f1f5f9;
}

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

.btn-dark:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Summary Card */
.summary-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: #f8fafc;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
}

.summary-header h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.summary-content {
    padding: 1.25rem;
}

.summary-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-icon {
    color: var(--text-muted);
    margin-top: 2px;
}

.summary-text {
    display: flex;
    flex-direction: column;
}

.summary-text strong {
    font-weight: 600;
    color: var(--text-main);
}

.summary-text span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Info Card */
.info-card {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.info-icon {
    font-size: 1.5rem;
}

.info-text h4 {
    color: #065f46;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.info-text p {
    color: #047857;
    font-size: 0.875rem;
}

/* Exam View */
.exam-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
}

.exam-materia {
    background: #eff6ff;
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
}

.question-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.question-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
    transition: var(--transition);
}

.option-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.option-btn.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.option-btn.correct {
    border-color: var(--success);
    background: var(--success-bg);
    color: #065f46;
}

.option-btn.incorrect {
    border-color: var(--danger);
    background: var(--danger-bg);
    color: #991b1b;
}

.option-btn:disabled {
    cursor: default;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.option-btn.selected .option-letter {
    background: var(--primary);
    color: white;
}

.option-btn.correct .option-letter {
    background: var(--success);
    color: white;
}

.option-btn.incorrect .option-letter {
    background: var(--danger);
    color: white;
}

.feedback-alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.feedback-alert.correct {
    background: var(--success-bg);
    border: 1px solid #a7f3d0;
}

.feedback-alert.incorrect {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
}

.feedback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
}

.feedback-alert.correct .feedback-icon {
    background: var(--success);
}

.feedback-alert.incorrect .feedback-icon {
    background: var(--danger);
}

.feedback-content h4 {
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.feedback-alert.correct h4 { color: #065f46; }
.feedback-alert.incorrect h4 { color: #991b1b; }

.feedback-content p {
    font-size: 0.875rem;
}

.feedback-alert.correct p { color: #047857; }
.feedback-alert.incorrect p { color: #7f1d1d; }

.hidden {
    display: none !important;
}

/* Results View */
.results-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--primary);
    margin-bottom: 1rem;
}

.score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 24px;
    margin: 2rem 0;
    box-shadow: 0 10px 25px -5px rgba(34, 197, 94, 0.2);
}

.score-card.rejected {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.2);
}

.score-circle {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.score-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-main);
}

.score-max {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.score-text {
    font-weight: 600;
    color: #166534;
}

.score-card.rejected .score-text {
    color: #991b1b;
}

.admission-status {
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color);
}

.admission-status h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.status-admitido {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.status-rechazado {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.requirement-text {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

@media (max-width: 600px) {
    html, body {
        height: 100%;
        height: 100dvh;
        overflow: hidden; /* Prevent body scroll */
    }
    
    .app-container {
        margin: 0;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        padding: 1rem;
        display: flex;
        flex-direction: column;
    }
    
    header {
        margin-bottom: 0.5rem;
    }
    
    header h1 {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
    }
    
    header p {
        font-size: 0.85rem;
    }
    
    .stepper {
        margin-bottom: 0.5rem;
    }
    
    .progress-bar-container {
        margin-bottom: 1rem;
    }
    
    #main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto; /* Allow internal scroll only if absolutely necessary on tiny screens */
    }
    
    .view {
        flex: 1;
        display: none;
        flex-direction: column;
    }
    
    .view.active {
        display: flex;
    }
    
    .view-title {
        margin-bottom: 1rem;
        font-size: 1.15rem;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-group label {
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
    
    .form-select {
        padding: 0.5rem 0.75rem;
    }
    
    .actions {
        margin-top: auto; /* Push buttons to the very bottom */
        padding-top: 1rem;
    }
}
