/* Interactive English Lesson: A Triumph of Surgery - 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;
    transition: all 0.3s;
}

.highlight-vocab:hover {
    background: #ffeb3b;
}

.vocab-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 100;
}

.highlight-vocab:hover .vocab-tooltip {
    opacity: 1;
}

.vocabulary-note {
    background-color: #f0f8ff;
    border-left: 4px solid var(--primary-color);
    padding: 16px 20px;
    margin: 15px 0;
    border-radius: var(--input-radius);
    box-shadow: var(--shadow-sm);
}

.vocabulary-note .word {
    font-weight: bold;
    color: #4a6572;
}

.vocabulary-note .definition {
    color: #555;
    font-style: italic;
}

/* Comprehension Checks */
.comprehension-check {
    background: #e3f2fd;
    border-left: 4px solid var(--primary-color);
    padding: 24px;
    margin: 20px 0;
    border-radius: var(--input-radius);
    box-shadow: var(--shadow-sm);
}

.comprehension-check h3 {
    color: #4a6572;
    margin-bottom: 15px;
}

.comprehension-question {
    margin: 12px 0;
    padding: 16px;
    background: white;
    border-radius: var(--input-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

/* Reading Comprehension Questions Styling */
.question-section-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0,0,0,0.05);
}

.question-set {
    margin-bottom: 30px;
}

.question-item {
    background: white;
    border-radius: var(--card-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

.question-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 15px;
}

.question-options {
    margin: 15px 0;
}

.question-textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    outline: none;
    line-height: 1.6;
}

.question-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 101, 114, 0.2);
}

.option {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: var(--input-radius);
    cursor: pointer;
    transition: var(--transition);
}

.option:hover {
    background: #e9ecef;
}

.option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 50%;
    margin-right: 12px;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.option input[type="radio"]::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.2s ease-in-out;
    background-color: var(--primary-color);
}

.option input[type="radio"]:checked {
    border-color: var(--primary-color);
}

.option input[type="radio"]:checked::before {
    transform: scale(1);
}

.option label {
    flex: 1;
    cursor: pointer;
}

.question-feedback {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: var(--input-radius);
    font-weight: 500;
    display: none;
}

.question-feedback.correct {
    display: block;
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.question-feedback.incorrect {
    display: block;
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.question-feedback.warning {
    display: block;
    background-color: #fff8e1;
    color: #f57f17;
    border-left: 4px solid #ffc107;
}

/* Reflection Exercise */
.reflection-exercise {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.reflection-exercise textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--input-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    outline: none;
}

.reflection-exercise textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 101, 114, 0.2);
}

/* Vocabulary Exercise */
.vocabulary-exercise {
    background: #f8f9fa;
    padding: 24px;
    border-radius: var(--card-radius);
    margin: 20px 0;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.05);
}

.vocab-question {
    margin-bottom: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--input-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

.vocab-question:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.vocab-question select {
    padding: 10px 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--input-radius);
    font-size: 1rem;
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em;
    padding-right: 40px;
}

.vocab-question select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 101, 114, 0.2);
}

.vocab-question select:hover {
    border-color: var(--primary-color);
}

/* Matching Game */
.matching-game {
    background: #f5f5f5;
    padding: 24px;
    border-radius: var(--card-radius);
    margin: 20px 0;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.05);
}

.matching-game h3 {
    margin-bottom: 20px;
    color: #333;
}

/* Contraction Exercise */
.contraction-item {
    margin: 12px 0;
    padding: 16px;
    background: white;
    border-radius: var(--input-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

.contraction-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.contraction-input {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--input-radius);
    padding: 10px 16px;
    margin: 0 5px;
    width: 250px;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    outline: none;
}

.contraction-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 101, 114, 0.2);
}

/* Interactive Elements */
.button-container {
    text-align: center;
    margin-top: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.interactive-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    margin: 5px;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.interactive-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.1), rgba(255,255,255,0));
    opacity: 0;
    transition: var(--transition);
}

.interactive-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.interactive-btn:hover::after {
    opacity: 1;
}

.interactive-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.interactive-btn.secondary {
    background: linear-gradient(135deg, #9e9e9e, #616161);
}

.feedback-message {
    padding: 16px;
    border-radius: var(--input-radius);
    margin: 15px 0;
    text-align: center;
    font-weight: 600;
    display: none;
    box-shadow: var(--shadow-sm);
}

.feedback-message.show {
    display: block;
    animation: slideIn 0.5s;
}

.feedback-message.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.feedback-message.error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Audio Control */
.audio-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.audio-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4caf50, #8bc34a);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.audio-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0));
    opacity: 0;
    transition: var(--transition);
    border-radius: 50%;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.audio-btn:hover::after {
    opacity: 1;
}

.audio-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.audio-btn.muted {
    background: linear-gradient(135deg, #9e9e9e, #616161);
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 100px;
    right: 20px;
    background: white;
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.5s;
    z-index: 1000;
    max-width: 300px;
    border: 1px solid rgba(0,0,0,0.05);
    border-left: 4px solid #4caf50;
}

.achievement-popup.show {
    transform: translateX(0);
}

.achievement-title {
    font-size: 1.2rem;
    color: #4caf50;
    margin-bottom: 10px;
    font-weight: bold;
}

.achievement-desc {
    color: #666;
    font-size: 0.9rem;
}

/* Reading Indicator */
.reading-indicator {
    display: flex;
    align-items: center;
    background-color: #e3f2fd;
    padding: 12px 18px;
    border-radius: 30px;
    margin-top: 15px;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.05);
}

.reading-indicator.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.reading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #4a6572;
    border-top: 2px solid transparent;
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Paragraph highlighting during narration */
.paragraph-highlight {
    background-color: rgba(255, 236, 179, 0.4);
    border-left: 3px solid #ffc107;
    padding-left: 10px;
    border-radius: 4px;
    transition: background-color 0.5s ease;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.7);
    margin-top: 30px;
}

/* Print Mode */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .nav-menu, .audio-control, .achievement-popup, .progress-container, 
    .interactive-btn, .reading-mode-btn, .story-navigation {
        display: none !important;
    }
    
    .container {
        margin: 0;
        padding: 20px;
        max-width: 100%;
    }
    
    .header {
        background: none;
        color: black;
        padding: 20px 0;
    }
    
    .title {
        color: black;
        text-shadow: none;
    }
    
    .subtitle, .reprint {
        color: black;
    }
    
    .exercise-card, .story-reader {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .story-content {
        max-height: none;
        overflow: visible;
    }
    
    .module {
        display: block !important;
        page-break-after: always;
    }
    
    .highlight-vocab {
        background: none;
        text-decoration: underline;
    }
    
    .vocabulary-note {
        border: 1px solid #ddd;
        background: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-items {
        font-size: 0.8rem;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .matching-game {
        grid-template-columns: 1fr;
    }
    
    .container {
        margin-top: 100px;
    }
    
    .story-controls {
        flex-direction: column;
    }
    
    .reading-mode-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .exercise-card, .story-reader {
        padding: 20px 15px;
    }
    
    .contraction-input {
        width: 150px;
    }
    
    .nav-items {
        gap: 10px;
    }
    
    .nav-item {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
