/* Interactive English Lesson: The Adventures of Toto - 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: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.title {
    font-size: 2.5rem;
    color: var(--light-text);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--light-text);
    opacity: 0.9;
    font-weight: 300;
}

.reprint {
    font-size: 0.8rem;
    color: var(--light-text);
    opacity: 0.7;
    margin-top: 5px;
}

/* Progress Tracker */
.progress-container {
    background: rgba(255,255,255,0.8);
    border-radius: var(--card-radius);
    padding: 15px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.progress-bar {
    height: 10px;
    background: #e1e1e1;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 5px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Modules */
.module {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.module.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 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(--primary-color);
    font-size: 1.5rem;
}

.exercise-icon {
    margin-right: 10px;
    font-size: 1.8rem;
}

.content-block {
    margin-bottom: 25px;
}

.content-block p {
    margin-bottom: 15px;
}

.activity-title {
    margin: 25px 0 15px;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

/* Buttons */
.interactive-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.interactive-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.interactive-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

/* Reflection Exercise */
.reflection-exercise {
    margin-top: 20px;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 10px;
    resize: vertical;
}

.feedback-message {
    padding: 10px 15px;
    border-radius: var(--input-radius);
    margin-top: 10px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback-message.show {
    opacity: 1;
}

.feedback-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.feedback-message.error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.feedback-message.warning {
    background-color: #fff8e1;
    color: #ff8f00;
    border: 1px solid #ffe082;
}

/* Story Reader */
.story-reader {
    background: white;
    border-radius: var(--card-radius);
    padding: 25px;
    margin-bottom: 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;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

.reading-mode-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.reading-mode-btn:hover {
    background: #e9e9e9;
}

.story-content, .poem-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

.story-content p, .poem-content p {
    margin-bottom: 20px;
    text-align: justify;
}

/* Poem Styling */
.poem-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.poem-author {
    font-size: 1rem;
    font-style: italic;
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-color);
}

.poem-stanza {
    margin-bottom: 30px;
}

.poem-line {
    text-align: left;
    margin-bottom: 5px !important;
    padding-left: 20px;
}

/* Vocabulary */
.highlight-vocab {
    position: relative;
    border-bottom: 1px dashed var(--accent-color);
    cursor: pointer;
}

.active-highlight {
    background-color: rgba(247, 131, 97, 0.2);
    border-bottom: 1px solid var(--accent-color);
}

.vocab-tooltip {
    display: none;
}

.highlight-vocab:hover .vocab-tooltip {
    display: block;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 100;
}

.vocabulary-note {
    display: none;
    margin: 10px 0 20px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-left: 3px solid var(--accent-color);
    border-radius: 0 var(--input-radius) var(--input-radius) 0;
}

.vocabulary-note .word {
    font-weight: bold;
    color: var(--accent-color);
}

.vocabulary-note .definition {
    color: var(--text-color);
    font-size: 0.95rem;
}

/* Print Mode */
body.print-mode {
    background: white;
    color: black;
}

body.print-mode .nav-menu,
body.print-mode .audio-control,
body.print-mode .progress-container,
body.print-mode .story-controls,
body.print-mode .reading-indicator,
body.print-mode .button-container,
body.print-mode footer {
    display: none !important;
}

body.print-mode .container {
    margin: 0 auto;
    max-width: 100%;
}

body.print-mode .story-reader,
body.print-mode .exercise-card {
    box-shadow: none;
    margin: 0;
    padding: 20px 0;
}

body.print-mode .vocabulary-note {
    display: block;
}

body.print-mode .header {
    background: none;
    box-shadow: none;
    color: black;
    border: none;
}

body.print-mode .title,
body.print-mode .subtitle,
body.print-mode .reprint {
    color: black;
    text-shadow: none;
}

/* Audio Control */
.audio-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.5rem;
}

.audio-btn:hover {
    transform: scale(1.1);
}

.audio-btn.muted {
    opacity: 0.7;
}

/* Reading Indicator */
.reading-indicator {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.9);
    border-radius: var(--input-radius);
    padding: 10px 15px;
    margin-top: 15px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.reading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(74, 101, 114, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.reading-indicator.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.stop-narration-btn {
    margin-left: 15px;
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #4a6572, #334756);
    color: white;
    border-radius: var(--card-radius);
    padding: 15px 25px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.achievement-popup.show {
    transform: translateX(-50%) translateY(0);
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 5px;
}

/* Reading Comprehension */
.story-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.story-nav-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.story-nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.question-section {
    margin-top: 20px;
}

.question-section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.question-set {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.question-item {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.question-text {
    margin-bottom: 15px;
    font-weight: 500;
}

.question-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 15px;
    resize: vertical;
}

.question-feedback {
    margin: 15px 0;
    padding: 12px;
    border-radius: var(--input-radius);
}

.question-feedback.correct {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.question-feedback.incorrect {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.question-feedback.warning {
    background-color: #fff8e1;
    color: #ff8f00;
    border: 1px solid #ffe082;
}

.question-item.completed {
    opacity: 0.8;
}

.question-item.completed::after {
    content: "✓";
    color: #4caf50;
    font-size: 1.2rem;
    font-weight: bold;
    margin-left: 10px;
}

/* Vocabulary Exercises */
.vocabulary-exercise {
    margin-top: 20px;
}

.vocab-question {
    margin-bottom: 20px;
}

.vocab-question select {
    padding: 8px 12px;
    border-radius: var(--input-radius);
    border: 1px solid #ddd;
    font-size: 1rem;
    margin: 0 5px;
}

/* Matching Game */
.matching-game {
    margin-top: 20px;
}

.contraction-item {
    margin-bottom: 15px;
}

.contraction-input {
    width: 60%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
}

/* Animal Descriptions Exercise */
.animal-description {
    margin-bottom: 20px;
}

.animal-description-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
}

/* Comprehension Check */
.comprehension-check {
    margin-top: 30px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: var(--input-radius);
}

.comprehension-check h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.comprehension-question {
    margin-bottom: 8px;
    color: var(--text-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .container {
        margin-top: 60px;
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .nav-menu {
        padding: 10px;
    }
    
    .nav-items {
        gap: 10px;
    }
    
    .nav-item {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .exercise-card,
    .story-reader {
        padding: 20px;
    }
    
    .story-content, .poem-content {
        font-size: 1rem;
    }
    
    .audio-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .contraction-input {
        width: 100%;
    }
}

/* Show Answers Button */
.show-answers-btn {
    margin-top: 10px;
    font-size: 14px;
    padding: 8px 16px;
}

/* Answer Tooltip */
.answer-tooltip {
    position: absolute;
    background: rgba(33, 33, 33, 0.9);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.answer-tooltip.fade-out {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s, transform 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Optimize for Mobile View */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        margin-top: 50px;
        padding: 10px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .nav-menu {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .nav-items {
        justify-content: flex-start;
        padding-bottom: 5px;
    }
    
    .exercise-title {
        font-size: 1.3rem;
    }
    
    .exercise-card,
    .story-reader {
        padding: 15px;
        border-radius: 12px;
    }
    
    .interactive-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .achievement-popup {
        width: 90%;
        padding: 12px;
    }
    
    .reading-spinner {
        width: 16px;
        height: 16px;
    }
}
