/* Interactive English Lesson: The Making of a Scientist - Main Styles */

/* ======= Base Styles ======= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a6572;
    --secondary-color: #334756;
    --accent-color: #f78361;
    --text-color: #333;
    --light-text: #fff;
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 6px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
    --card-radius: 16px;
    --input-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text-color);
    line-height: 1.6;
}

/* Navigation Menu */
.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-items {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-item {
    padding: 8px 16px;
    background: linear-gradient(135deg, #4a6572, #334756);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    border: none;
}

.nav-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.nav-item.active {
    background: linear-gradient(135deg, #f78361, #c06c84);
}

.nav-item:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 80px auto 20px;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0;
    background: rgba(255,255,255,0.1);
    border-radius: var(--card-radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    opacity: 0.5;
    z-index: -1;
    animation: pulse 8s infinite;
}

@keyframes pulse {
    0% { transform: translate(0, 0); }
    50% { transform: translate(5%, 5%); }
    100% { transform: translate(0, 0); }
}

.title {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.reprint {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

/* Progress Tracker */
.progress-container {
    background: white;
    border-radius: var(--card-radius);
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #c06c84);
    border-radius: 5px;
    transition: width 0.5s ease;
    text-align: right;
    font-size: 0.7rem;
    color: white;
    line-height: 10px;
    padding-right: 5px;
}

.progress-stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Module Styles */
.module {
    display: none;
    animation: fadeIn 0.5s;
}

.module.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Exercise Cards */
.exercise-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.exercise-title {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    color: var(--secondary-color);
    font-size: 1.5rem;
}

.exercise-icon {
    margin-right: 10px;
    font-size: 1.8rem;
}

.content-block {
    margin-bottom: 20px;
    line-height: 1.7;
}

.content-block p {
    margin-bottom: 15px;
}

/* Button Styles */
.button-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.interactive-btn {
    background: linear-gradient(135deg, var(--accent-color), #c06c84);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.interactive-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.interactive-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Activity Title */
.activity-title {
    background: #f1f5f9;
    padding: 10px 15px;
    border-left: 5px solid var(--accent-color);
    margin: 25px 0 15px;
    border-radius: 0 var(--input-radius) var(--input-radius) 0;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

/* Reflection Exercise */
.reflection-exercise {
    margin-top: 20px;
}

.reflection-exercise textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

.reflection-exercise textarea:focus {
    outline: 2px solid var(--accent-color);
    border-color: transparent;
}

/* Feedback Messages */
.feedback-message {
    padding: 10px 15px;
    border-radius: var(--input-radius);
    margin-top: 15px;
    display: none;
}

.feedback-message.show {
    display: block;
    animation: fadeIn 0.3s;
}

.feedback-message.success {
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.feedback-message.error {
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

.feedback-message.warning {
    background-color: #fff8e1;
    border: 1px solid #ffecb3;
    color: #ff6f00;
}

/* Story Reader Styles */
.story-reader {
    background: white;
    border-radius: var(--card-radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.section-title {
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary-color);
    font-size: 1.8rem;
}

.story-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.reading-mode-btn {
    background: #f1f5f9;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.reading-mode-btn:hover {
    background: #e2e8f0;
}

.story-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

.story-content p {
    margin-bottom: 20px;
    text-align: justify;
}

.story-content .note {
    font-size: 0.9rem;
    color: #666;
    background: #f9f9f9;
    padding: 10px;
    border-left: 3px solid #ddd;
    margin: 15px 0;
}

.story-content .author {
    text-align: right;
    font-weight: bold;
    margin-top: 30px;
}

/* Vocabulary Highlighting */
.highlight-vocab {
    position: relative;
    cursor: pointer;
    border-bottom: 1px dotted #999;
}

.highlight-vocab.active-highlight {
    background-color: #fff8e1;
    border-bottom: 1px solid var(--accent-color);
}

.vocab-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
}

.highlight-vocab:hover .vocab-tooltip,
.highlight-vocab.active-highlight .vocab-tooltip {
    display: block;
}

.vocabulary-note {
    display: none;
}

/* Narration Indicator */
.reading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 10px 20px;
    margin: 15px auto;
    gap: 10px;
    max-width: max-content;
    transition: opacity 0.3s;
}

.reading-indicator.fade-out {
    opacity: 0;
}

.reading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.stop-narration-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 5px 10px;
    margin-left: 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Audio Control */
.audio-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    box-shadow: var(--shadow-md);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.audio-btn:hover {
    transform: scale(1.1);
}

.audio-btn.muted {
    background: #f1f1f1;
    color: #999;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    text-align: center;
    transition: top 0.5s ease;
}

.achievement-popup.show {
    top: 90px;
    animation: bounce 0.5s;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateX(-50%) translateY(0);}
    40% {transform: translateX(-50%) translateY(-20px);}
    60% {transform: translateX(-50%) translateY(-10px);}
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--secondary-color);
}

.achievement-desc {
    font-size: 0.9rem;
    color: #666;
}

/* Comprehension Check */
.comprehension-check {
    background: #f1f5f9;
    border-radius: var(--input-radius);
    padding: 15px;
    margin-top: 30px;
}

.comprehension-check h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.comprehension-question {
    margin-bottom: 10px;
}

/* Story Navigation */
.story-navigation {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.story-nav-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.story-nav-btn.active {
    border-bottom: 3px solid var(--accent-color);
    font-weight: bold;
}

/* Question Styles */
.question-section {
    margin-top: 20px;
}

.question-section-title {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.question-set {
    margin-bottom: 30px;
}

.question-item {
    background: #f9f9f9;
    border-radius: var(--input-radius);
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.question-item.completed {
    border-left: 5px solid #4caf50;
}

.question-text {
    margin-bottom: 15px;
}

.question-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

/* Vocabulary Exercises */
.vocabulary-exercise {
    margin-top: 20px;
}

.vocabulary-exercise h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.vocab-question {
    margin-bottom: 15px;
}

.vocab-question select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Matching Game */
.matching-game {
    margin-top: 20px;
}

.matching-game h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.contraction-item {
    margin-bottom: 15px;
}

.contraction-input {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 60%;
}

/* Print Mode */
.print-mode {
    background: white;
}

.print-mode .nav-menu,
.print-mode .audio-control,
.print-mode .achievement-popup,
.print-mode .progress-container,
.print-mode .story-controls,
.print-mode .button-container {
    display: none;
}

.print-mode .container {
    margin: 20px auto;
    padding: 0;
}

.print-mode .header {
    background: none;
    box-shadow: none;
    border: none;
    padding: 20px 0;
}

.print-mode .title,
.print-mode .subtitle,
.print-mode .reprint {
    color: black;
    text-shadow: none;
}

.print-mode .story-reader,
.print-mode .exercise-card {
    box-shadow: none;
    padding: 0;
}

.print-mode .section-title {
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .nav-items {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: start;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .container {
        padding: 10px;
    }
    
    .exercise-card,
    .story-reader {
        padding: 15px;
    }
    
    .progress-stats {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    
    .story-controls {
        flex-direction: column;
    }
    
    .contraction-input {
        width: 100%;
    }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .nav-item {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .story-content {
        font-size: 1rem;
    }
    
    .achievement-popup {
        width: 90%;
        padding: 10px;
    }
    
    .interactive-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}
