/* E-SCHOLAR Foundation Styles */

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

/* Welcome Modal */
.welcome-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.welcome-modal.show {
    display: flex;
}

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

.welcome-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    margin: 20px;
}

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

.welcome-modal-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    padding: 30px 30px 25px;
    border-radius: 20px 20px 0 0;
    text-align: center;
}

.welcome-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    animation: gentle-pulse 3s ease-in-out infinite;
}

.welcome-modal-header h2 {
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
}

.welcome-modal-body {
    padding: 30px;
    line-height: 1.8;
    color: #333;
}

.welcome-modal-body p {
    font-size: 1.05em;
    margin-bottom: 15px;
    color: #555;
}

.welcome-modal-body p:last-of-type {
    margin-bottom: 0;
    margin-top: 10px;
    font-style: italic;
    color: #666;
}

.welcome-modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.btn-welcome {
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
    text-transform: none;
    letter-spacing: 0.5px;
}

.btn-welcome:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.4);
}

.btn-welcome:active {
    transform: translateY(0);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
.header {
    position: relative;
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    padding: 60px 40px 50px;
    text-align: center;
    overflow: hidden;
}

.header-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    opacity: 0.6;
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 35px;
    gap: 30px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 48px;
    animation: gentle-pulse 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.logo-main {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
    text-transform: lowercase;
}

.logo-sub {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 2px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: rgba(255, 255, 255, 0.85);
    margin-top: -4px;
    text-transform: lowercase;
}

.tagline-main {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.main-headline {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-align: right;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.3;
    color: #ffffff;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    position: relative;
}

.main-headline::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    border-radius: 2px;
}

.tagline-section {
    position: relative;
    z-index: 2;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.tagline {
    font-size: 16px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.92);
    font-style: italic;
    font-weight: 300;
    letter-spacing: 0.5px;
    max-width: 900px;
    margin: 0 auto;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
}

@keyframes gentle-pulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.05) rotate(5deg);
        opacity: 0.9;
    }
}

/* Main Content */
.main-content {
    padding: 40px 30px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    color: #1e3a8a;
    font-size: 2em;
    margin-bottom: 15px;
}

.welcome-section p {
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
}

/* Selection Container */
.selection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.selection-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e9ecef;
}

.selection-card h3 {
    color: #1e3a8a;
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

/* Domain List */
.domain-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.domain-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    gap: 12px;
}

.domain-item:hover:not(.domain-item:has(.coming-soon)) {
    transform: translateX(5px);
    border-color: #1e3a8a;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.1);
}

.domain-item.active {
    border-color: #16a34a;
    background: #f0fdf4;
}

.domain-item.selected {
    border-color: #1e3a8a;
    background: #eff6ff;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

.domain-icon {
    font-size: 24px;
}

.domain-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.available {
    background: #16a34a;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.coming-soon {
    background: #9ca3af;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
}

.domain-item:has(.coming-soon) {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Level List */
.level-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.level-item {
    padding: 15px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.level-item:hover {
    transform: translateX(5px);
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.1);
}

.level-item.selected {
    border-color: #16a34a;
    background: #f0fdf4;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.level-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.level-icon {
    font-size: 24px;
}

.level-name {
    font-weight: 700;
    font-size: 1.1em;
    color: #1e3a8a;
}

.level-description {
    color: #666;
    font-size: 0.95em;
    margin-left: 34px;
}

/* Time Settings */
.time-settings {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 40px;
    border: 2px solid #e9ecef;
}

.time-settings h3 {
    color: #1e3a8a;
    font-size: 1.3em;
    margin-bottom: 20px;
    text-align: center;
}

.time-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.timer-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1.05em;
}

.timer-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.time-adjustment {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.05em;
}

.time-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #1e3a8a;
    background: white;
    color: #1e3a8a;
    border-radius: 50%;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-btn:hover {
    background: #1e3a8a;
    color: white;
    transform: scale(1.1);
}

.time-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

#timeDisplay {
    min-width: 120px;
    text-align: center;
    font-weight: 600;
    font-size: 1.2em;
    color: #1e3a8a;
}

.no-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-left: 20px;
}

.no-timer input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Start Section */
.start-section {
    text-align: center;
}

.btn-start {
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(30, 58, 138, 0.4);
}

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

.selection-status {
    margin-top: 15px;
    color: #666;
    font-style: italic;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    padding: 30px 20px 25px;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 5px 0;
    position: relative;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-links a:hover::after {
    width: 100%;
}

.footer p {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
}

/* Test Page Styles */
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    padding: 25px 30px;
}

.test-info h2 {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.test-meta {
    font-size: 0.95em;
    opacity: 0.9;
}

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

.timer-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.timer-display {
    font-size: 2.5em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.timer-display.warning {
    color: #fbbf24;
    animation: pulse 1s infinite;
}

.timer-display.danger {
    color: #ef4444;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.test-content {
    padding: 40px 30px;
}

.progress-bar {
    background: #e9ecef;
    height: 8px;
    border-radius: 10px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #1e3a8a 0%, #16a34a 100%);
    height: 100%;
    transition: width 0.3s ease;
}

.question-container {
    margin-bottom: 30px;
}

.question-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid #e9ecef;
    margin-bottom: 20px;
}

.question-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.question-number {
    background: #1e3a8a;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1em;
}

.question-text {
    flex: 1;
    font-size: 1.15em;
    color: #333;
    font-weight: 500;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.option-item:hover {
    border-color: #1e3a8a;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.1);
}

.option-item.selected {
    border-color: #16a34a;
    background: #f0fdf4;
}

.option-item input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-label {
    font-size: 1.05em;
    cursor: pointer;
    flex: 1;
}

.submit-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.btn-submit {
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.3);
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(30, 58, 138, 0.4);
}

/* Results Page */
.results-container {
    text-align: center;
    padding: 40px 30px;
}

.results-score {
    margin: 40px 0;
}

.score-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    box-shadow: 0 10px 40px rgba(30, 58, 138, 0.3);
}

.score-value {
    font-size: 4em;
    font-weight: 700;
}

.score-label {
    font-size: 1.2em;
    opacity: 0.9;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.stat-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 1.05em;
}

.results-message {
    background: #f0fdf4;
    border: 2px solid #16a34a;
    border-radius: 15px;
    padding: 25px;
    margin: 30px 0;
}

.results-message h3 {
    color: #1e3a8a;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.results-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 40px;
}

.btn-action {
    background: white;
    color: #1e3a8a;
    border: 2px solid #1e3a8a;
    padding: 15px 35px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action:hover {
    background: #1e3a8a;
    color: white;
    transform: translateY(-2px);
}

.btn-action.primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #16a34a 100%);
    color: white;
    border: none;
}

.btn-action.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.3);
}

/* Answer Review */
.review-container {
    padding: 40px 30px;
}

.review-question {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    border-left: 5px solid #e9ecef;
}

.review-question.correct {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.review-question.incorrect {
    border-left-color: #ef4444;
    background: #fef2f2;
}

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

.review-status {
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.review-status.correct {
    background: #16a34a;
    color: white;
}

.review-status.incorrect {
    background: #ef4444;
    color: white;
}

.review-status.skipped {
    background: #f59e0b;
    color: white;
}

.review-text {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
}

.review-answer {
    margin: 10px 0;
    padding: 12px;
    border-radius: 8px;
}

.review-answer.user-answer {
    background: #e0e7ff;
}

.review-answer.correct-answer {
    background: #dcfce7;
}

.review-explanation {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border: 1px solid #e9ecef;
}

.review-explanation strong {
    color: #1e3a8a;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 40px 25px 35px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 25px;
        margin-bottom: 25px;
    }
    
    .logo-section {
        width: 100%;
    }
    
    .logo-main {
        font-size: 28px;
    }
    
    .logo-sub {
        font-size: 16px;
    }
    
    .tagline-main {
        width: 100%;
        justify-content: flex-start;
    }
    
    .main-headline {
        font-size: 22px;
        text-align: left;
        max-width: 100%;
        letter-spacing: 1px;
    }
    
    .main-headline::after {
        left: 0;
        right: auto;
    }
    
    .tagline {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .selection-container {
        grid-template-columns: 1fr;
    }
    
    .time-adjustment {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .test-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .timer-container {
        text-align: center;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
    }
    
    .footer-links {
        gap: 15px;
    }
    
    .footer-links a {
        font-size: 0.85em;
    }
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #e9ecef;
    border-top: 4px solid #1e3a8a;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
