/* Interactive English Lesson: The Beggar - 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;
    right: 0;
    height: 40%;
    background: linear-gradient(rgba(255,255,255,0.1), rgba(255,255,255,0));
    pointer-events: none;
}

.title {
    font-size: 3rem;
    color: white;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 5px;
}

.reprint {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
}

/* Progress Tracker */
.progress-container {
    background: rgba(255,255,255,0.2);
    border-radius: var(--card-radius);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
}

.progress-bar {
    height: 30px;
    background: rgba(255,255,255,0.3);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    width: 0%;
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0));
}

.progress-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    color: white;
}

/* Module Sections */
.module {
    display: none;
    animation: fadeIn 0.5s;
}

.module.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Content Blocks */
.content-block {
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.content-block p {
    margin-bottom: 15px;
}

.content-block blockquote {
    border-left: 4px solid #4a6572;
    padding-left: 15px;
    margin: 15px 0;
    font-style: italic;
    color: #555;
}

/* Exercise Cards */
.exercise-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

.exercise-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.exercise-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.exercise-icon {
    font-size: 2rem;
}

.activity-title {
    font-size: 1.3rem;
    color: #4a6572;
    margin: 25px 0 15px;
}

.section-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Story Reader */
.story-reader {
    background: white;
    border-radius: var(--card-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

.story-reader:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.18);
}

.story-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.reading-mode-btn {
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.reading-mode-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.reading-mode-btn:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

.story-navigation {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.story-nav-btn {
    padding: 8px 20px;
    background: #e0e0e0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.story-nav-btn:hover {
    background: #d0d0d0;
}

.story-nav-btn.active {
    background: #4a6572;
    color: white;
}

.story-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 20px;
    scroll-behavior: smooth;
}

.story-content p {
    margin-bottom: 15px;
    text-indent: 30px;
}

/* Vocabulary Styling */
.highlight-vocab {
    background: linear-gradient(to bottom, transparent 60%, #ffeb3b 60%);
    cursor: pointer;
    position: relative;
}

.highlight-vocab.active-highlight {
    background: linear-gradient(to bottom, transparent 60%, #ff9800 60%);
    font-weight: bold;
}

.vocab-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
}

.highlight-vocab:hover .vocab-tooltip {
    display: block;
}

.vocabulary-note {
    display: none;
    background: #f5f5f5;
    border-left: 3px solid #4caf50;
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 0 5px 5px 0;
    font-size: 0.9rem;
}

.vocabulary-note .word {
    font-weight: bold;
    color: #4a6572;
    margin-bottom: 5px;
}

.vocabulary-note .definition {
    color: #666;
    font-style: italic;
}

/* Interactive Buttons */
.interactive-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #4a6572, #334756);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.interactive-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #334756, #232f37);
}

.interactive-btn:active {
    transform: translateY(-1px);
}

.interactive-btn:focus {
    outline: 2px solid #4a6572;
    outline-offset: 2px;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* Reflection Exercise */
.reflection-exercise {
    background: #f5f5f5;
    border-radius: var(--input-radius);
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
}

.reflection-exercise textarea {
    width: 100%;
    padding: 15px;
    border-radius: var(--input-radius);
    border: 1px solid #ccc;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
    font-family: inherit;
}

.feedback-message {
    background: #f5f5f5;
    border-radius: var(--input-radius);
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback-message.show {
    opacity: 1;
}

.feedback-message.success {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.feedback-message.error {
    background: #ffebee;
    border-left: 3px solid #f44336;
}

.feedback-message.warning {
    background: #fff8e1;
    border-left: 3px solid #ffc107;
}

/* Vocabulary Exercise */
.vocabulary-exercise {
    margin: 20px 0;
}

.vocab-question {
    background: #f9f9f9;
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--input-radius);
    border: 1px solid #e0e0e0;
}

.vocab-question p {
    margin-bottom: 10px;
}

.vocab-question select {
    padding: 8px 15px;
    border-radius: var(--input-radius);
    border: 1px solid #ccc;
    font-size: 0.9rem;
    background: white;
    min-width: 150px;
}

/* Matching Game */
.matching-game {
    margin: 20px 0;
}

.contraction-item {
    background: #f9f9f9;
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--input-radius);
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
}

.contraction-input {
    padding: 8px 12px;
    border-radius: var(--input-radius);
    border: 1px solid #ccc;
    font-size: 0.9rem;
    flex-grow: 1;
    margin-left: 10px;
}

/* Question Section */
.question-section {
    margin-top: 20px;
}

.question-set {
    background: #f9f9f9;
    padding: 20px;
    margin: 20px 0;
    border-radius: var(--card-radius);
    border: 1px solid #e0e0e0;
}

.question-item {
    background: white;
    padding: 20px;
    margin: 15px 0;
    border-radius: var(--input-radius);
    border: 1px solid #e0e0e0;
    box-shadow: var(--shadow-sm);
}

.question-text {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #333;
}

.question-textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--input-radius);
    border: 1px solid #ccc;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
    font-family: inherit;
}

.question-feedback {
    background: #f5f5f5;
    padding: 15px;
    margin: 15px 0;
    border-radius: var(--input-radius);
}

.question-feedback.correct {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.question-feedback.incorrect {
    background: #ffebee;
    border-left: 3px solid #f44336;
}

.question-feedback.warning {
    background: #fff8e1;
    border-left: 3px solid #ffc107;
}

/* Audio Control */
.audio-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.audio-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.audio-btn.muted {
    background: #f5f5f5;
    color: #999;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-lg);
    transform: translateX(150%);
    transition: transform 0.5s ease;
    z-index: 2000;
    min-width: 250px;
}

.achievement-popup.show {
    transform: translateX(0);
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.achievement-desc {
    font-size: 0.9rem;
    color: #666;
}

/* Reading Indicators */
.reading-indicator {
    display: flex;
    align-items: center;
    background: #e8f5e9;
    border-radius: var(--input-radius);
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 0.9rem;
    color: #2e7d32;
    animation: fadeIn 0.3s;
}

.reading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #4caf50;
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.reading-indicator.fade-out {
    opacity: 0;
    transition: opacity 0.5s;
}

.stop-narration-btn {
    margin-left: 15px;
    padding: 5px 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Paragraph highlighting during reading */
.paragraph-highlight {
    background: rgba(255, 248, 225, 0.5);
    border-left: 3px solid #ffc107;
    padding-left: 12px;
    border-radius: 0 5px 5px 0;
    animation: highlightFade 2s;
}

@keyframes highlightFade {
    from { background: rgba(255, 248, 225, 0.8); }
    to { background: rgba(255, 248, 225, 0.5); }
}

/* Comprehension check */
.comprehension-check {
    background: #e8f5e9;
    padding: 20px;
    margin: 25px 0;
    border-radius: var(--input-radius);
    border-left: 5px solid #4caf50;
}

.comprehension-check h3 {
    margin-bottom: 15px;
    color: #2e7d32;
}

.comprehension-question {
    background: white;
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: var(--input-radius);
    border: 1px solid #c8e6c9;
}

/* Print mode */
.print-mode {
    background: white;
    color: black;
}

.print-mode .nav-menu,
.print-mode .audio-control,
.print-mode .progress-container,
.print-mode .achievement-popup,
.print-mode .story-controls,
.print-mode footer,
.print-mode .button-container {
    display: none !important;
}

.print-mode .container {
    margin: 20px auto;
}

.print-mode .header {
    background: none;
    box-shadow: none;
    border-bottom: 2px solid #333;
    border-radius: 0;
    padding: 20px 0;
}

.print-mode .title,
.print-mode .subtitle,
.print-mode .reprint {
    color: black;
    text-shadow: none;
}

.print-mode .module {
    display: block !important;
    page-break-after: always;
}

.print-mode .story-reader,
.print-mode .exercise-card {
    box-shadow: none;
    border: 1px solid #e0e0e0;
    padding: 15px;
    margin-bottom: 30px;
}

.print-mode .vocabulary-note {
    display: block !important;
}

.print-mode .highlight-vocab {
    background: none;
    text-decoration: underline;
}

.print-mode .vocab-tooltip {
    display: none !important;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .exercise-card, 
    .story-reader {
        padding: 20px;
    }
    
    .nav-items {
        gap: 8px;
    }
    
    .nav-item {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .story-controls {
        flex-direction: column;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    margin-top: 40px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
