/* Interactive English Lesson: The Necklace - 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: linear-gradient(
        to bottom right,
        rgba(255,255,255,0.2) 0%,
        rgba(255,255,255,0.05) 50%,
        transparent 80%
    );
    transform: rotate(30deg);
    pointer-events: none;
}

.title {
    color: var(--light-text);
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    position: relative;
}

.subtitle {
    color: var(--light-text);
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.reprint {
    font-size: 0.9rem;
    color: var(--light-text);
    opacity: 0.6;
}

/* Progress Bar */
.progress-container {
    background: white;
    border-radius: var(--card-radius);
    padding: 15px 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.progress-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a6572, #f78361);
    border-radius: 5px;
    width: 0%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
}

/* Module Cards */
.module {
    display: none;
    margin-bottom: 30px;
}

.module.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.exercise-card {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-md);
    padding: 25px;
    margin-bottom: 30px;
}

.exercise-title {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.6rem;
}

.exercise-icon {
    margin-right: 12px;
    font-size: 1.8rem;
}

.content-block {
    margin-bottom: 25px;
}

.content-block p {
    margin-bottom: 15px;
    font-size: 1.1rem;
    line-height: 1.6;
}

.activity-title {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin: 25px 0 15px;
}

/* Story Reader */
.story-reader {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-md);
    padding: 25px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.story-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.reading-mode-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.reading-mode-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.story-content {
    font-size: 1.15rem;
    line-height: 1.8;
}

.story-content p {
    margin-bottom: 25px;
    text-align: justify;
}

/* Vocabulary Highlighting */
.highlight-vocab {
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.highlight-vocab:hover {
    background-color: rgba(247, 131, 97, 0.2);
}

.active-highlight {
    background-color: rgba(247, 131, 97, 0.2);
    border-bottom: 2px dashed var(--accent-color);
}

.vocab-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    white-space: nowrap;
    z-index: 10;
}

.highlight-vocab:hover .vocab-tooltip {
    display: block;
}

.vocabulary-note {
    display: none;
    background-color: #f9f9f9;
    border-left: 4px solid var(--accent-color);
    padding: 10px;
    margin: 15px 0;
    font-size: 0.95rem;
}

.vocabulary-note .word {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 3px;
}

/* Print Mode */
body.print-mode {
    background: white;
}

body.print-mode .nav-menu,
body.print-mode .progress-container,
body.print-mode .audio-control,
body.print-mode footer,
body.print-mode .button-container,
body.print-mode .story-controls {
    display: none !important;
}

body.print-mode .container {
    margin: 20px auto;
}

body.print-mode .header {
    background: none;
    box-shadow: none;
    border: none;
    color: black;
}

body.print-mode .title, 
body.print-mode .subtitle,
body.print-mode .reprint {
    color: black;
    text-shadow: none;
}

body.print-mode .story-reader,
body.print-mode .exercise-card {
    box-shadow: none;
    border: 1px solid #ddd;
}

body.print-mode .vocabulary-note {
    display: block;
    break-inside: avoid;
}

/* 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;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.audio-btn:hover {
    transform: scale(1.1);
}

.audio-btn.muted {
    background: #f0f0f0;
    color: #999;
}

/* Reading Indicator */
.reading-indicator {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    padding: 10px 15px;
    border-radius: 20px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--primary-color);
    animation: fadeIn 0.3s ease;
}

.reading-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(74, 101, 114, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

.stop-narration-btn {
    margin-left: auto;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.stop-narration-btn:hover {
    background: #e0e0e0;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: top 0.5s ease;
    min-width: 250px;
    text-align: center;
}

.achievement-popup.show {
    top: 100px;
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.achievement-desc {
    font-size: 0.9rem;
    color: #666;
}

/* Reflection Exercise */
.reflection-exercise {
    background: #f9f9f9;
    padding: 20px;
    border-radius: var(--input-radius);
    margin-top: 20px;
}

.reflection-exercise 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;
}

/* Buttons */
.interactive-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.interactive-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Feedback Messages */
.feedback-message {
    padding: 10px 15px;
    border-radius: var(--input-radius);
    margin-top: 15px;
    font-size: 0.95rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback-message.show {
    opacity: 1;
}

.feedback-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-message.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.feedback-message.partial {
    background-color: #e2e3ff;
    color: #3a3b7a;
    border: 1px solid #d4d5f7;
}

.feedback-message.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Question Sections */
.question-section {
    margin-top: 20px;
}

.question-set {
    margin-bottom: 30px;
}

.question-section-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.section-title {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.question-item {
    background: #f9f9f9;
    padding: 20px;
    border-radius: var(--input-radius);
    margin-bottom: 20px;
}

.question-text {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.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-top: 15px;
    padding: 10px;
    border-radius: var(--input-radius);
}

/* Vocabulary Exercise */
.vocabulary-exercise {
    margin-top: 20px;
}

.vocab-question {
    margin-bottom: 15px;
}

.vocab-question select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-size: 1rem;
}

.correct-answer {
    border: 2px solid #28a745;
}

.incorrect-answer {
    border: 2px solid #dc3545;
}

/* Matching Game */
.matching-game {
    margin-top: 20px;
}

.contraction-item {
    margin-bottom: 15px;
}

.contraction-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--input-radius);
    font-size: 1rem;
    width: 250px;
    max-width: 100%;
}

.correct-input {
    border: 2px solid #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.incorrect-input {
    border: 2px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* Individual feedback for vocabulary and conditionals */
.individual-feedback {
    display: block;
    margin-top: 5px;
    padding: 3px 8px;
    font-size: 0.9rem;
    border-radius: var(--input-radius);
}

.individual-feedback.correct {
    color: #28a745;
}

.individual-feedback.incorrect {
    color: #dc3545;
}

/* Show answers button styling */
.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.interactive-btn.show-answers {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.shown-answer {
    background-color: rgba(108, 117, 125, 0.1);
    border: 2px solid #6c757d !important;
}

/* Story Navigation */
.story-navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.story-nav-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.story-nav-btn:hover {
    background: #e0e0e0;
}

.story-nav-btn.active {
    background: var(--accent-color);
    color: white;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 50px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Special styling for the invitation text */
.invitation {
    background: #f9f9f9;
    padding: 20px;
    border: 1px dashed #ccc;
    margin: 20px 0;
    text-align: center;
    font-family: 'Times New Roman', serif;
    color: #333;
    font-size: 1.1rem;
}

.invitation p {
    margin: 5px 0;
    letter-spacing: 1px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        margin-top: 70px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .nav-items {
        gap: 8px;
    }
    
    .nav-item {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .exercise-title {
        font-size: 1.4rem;
    }
    
    .content-block p {
        font-size: 1rem;
    }
    
    .story-content {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .interactive-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .reading-indicator {
        flex-direction: column;
        padding: 8px;
    }
    
    .stop-narration-btn {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .achievement-popup {
        min-width: 90%;
        padding: 12px;
    }
    
    .achievement-popup.show {
        top: 80px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 1.3rem;
    }
    
    .story-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .reading-mode-btn {
        text-align: center;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .exercise-card, .story-reader {
        padding: 15px;
    }
    
    .audio-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}
