/* ===== CONTENT LAYOUT - Speaking Page Styles ===== */

/* Main Content Layout */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    margin-top: calc(var(--header-sticky-height) + 20px);
    padding: 20px 0;
}

/* Main Article Section */
.main-article {
    background: var(--content-background);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--box-shadow);
}

/* Lesson Header */
.lesson-header {
    margin-bottom: 30px;
    padding-bottom: 25px;
}

.lesson-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.level-badge {
    background: var(--background-light);
    color: var(--text-light);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.lesson-title {
    font-size: 2.2rem;
    color: var(--text-color);
    margin: 15px 0;
    font-weight: 700;
    line-height: 1.3;
}

.lesson-description p {
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
}

/* Table of Contents */
.table-of-contents {
    background: var(--background-light);
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    cursor: pointer;
    background: var(--accent-bg);
    transition: var(--transition);
}

.toc-header:hover {
    background: var(--background-light);
}

.toc-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
}

.toggle-btn i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.toc-header.active .toggle-btn i {
    transform: rotate(180deg);
}

.toc-content {
    padding: 20px 25px;
    display: none;
}

.toc-content.active {
    display: block;
}

.toc-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-content li {
    margin: 10px 0;
}

.toc-content a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 8px 15px;
    border-left: 3px solid transparent;
    transition: var(--transition);
    border-radius: 4px;
}

.toc-content a:hover {
    color: var(--primary-color);
    background: var(--accent-bg);
    border-left-color: var(--primary-color);
    transform: translateX(5px);
}

/* Content Sections */
.content-section {
    margin-bottom: 30px;
}

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.section-content {
    padding: 0;
}

/* Pronunciation Bars */
.pronunciation-bars {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.pronunciation-bar {
    background: var(--background-light);
    border-radius: var(--border-radius);
    padding: 25px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.pronunciation-bar:hover {
    border-color: var(--primary-color);
    box-shadow: var(--box-shadow);
}

.pronunciation-bar.active {
    border-color: var(--primary-color);
    background: var(--accent-bg);
}

.pronunciation-bar.completed {
    border-color: #22c55e;
    background: linear-gradient(135deg, #dcfce7, #f0fdf4);
}

.sentence-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.sentence-info {
    flex: 1;
}

.sentence-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 6px 14px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.sentence-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.4;
}

.sentence-phonetic {
    font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif;
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-style: italic;
}

.sentence-vietnamese {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.4;
}

.sentence-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.play-sentence-btn,
.record-sentence-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
    position: relative;
}

.play-sentence-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: var(--box-shadow);
}

.play-sentence-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--box-shadow-lg);
}

.play-sentence-btn.playing {
    animation: pulse 1.5s infinite;
}

.record-sentence-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: var(--box-shadow);
}

.record-sentence-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--box-shadow-lg);
}

.record-sentence-btn.recording {
    animation: pulse 1s infinite;
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.6) !important;
    transform: scale(1.05) !important;
    border: 2px solid #fecaca !important;
}

.record-sentence-btn.recording:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.8) !important;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Recording State Visual Effects */
.pronunciation-bar.recording {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(185, 28, 28, 0.05));
    border-left: 4px solid #dc2626;
    animation: recordingGlow 2s ease-in-out infinite;
}

@keyframes recordingGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.6);
    }
}

/* Play button animation */
.play-sentence-btn.playing {
    background: linear-gradient(135deg, #059669, #047857);
    animation: pulse 1.5s infinite;
}

.sentence-score {
    text-align: center;
    min-width: 60px;
}

.score-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

.sentence-score.excellent .score-value {
    color: #22c55e;
}

.sentence-score.good .score-value {
    color: #3b82f6;
}

.sentence-score.fair .score-value {
    color: #f59e0b;
}

.sentence-score.poor .score-value {
    color: #ef4444;
}

/* Progress Bar */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    width: 0%;
    transition: width 0.3s ease;
}

.pronunciation-bar.completed .progress-fill {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    width: 100%;
}

/* Related Articles - Identical to listening.css */
.related-articles {
    margin-top: 80px;
    border: 2px solid var(--border-color);
    border-radius: 30px;
    padding: 30px 25px 25px;
    position: relative;
}

.related-articles h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 1.3rem;
    position: absolute;
    top: -18px;
    left: 20px;
    background: var(--content-background);
    padding: 0 15px;
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-item {
    background: var(--background-light);
    padding: 15px 18px;
    border-radius: var(--border-radius);
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.article-item:hover {
    border-left-color: var(--primary-color);
    background: var(--accent-bg);
    transform: translateX(5px);
}

.article-item h3 {
    margin-bottom: 6px;
    font-size: 1rem;
    font-weight: 600;
}

.article-item a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.article-item a:hover {
    color: var(--primary-color);
}

.article-item p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: calc(var(--header-sticky-height) + 20px);
    align-self: start;
}

.widget {
    background: var(--content-background);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
}

.widget-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 600;
}

.test-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.test-item {
    display: block;
    padding: 18px;
    background: var(--background-light);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: var(--transition);
}

.test-item:hover {
    transform: translateX(5px);
    box-shadow: var(--box-shadow);
    border-color: var(--primary-color);
}

.test-item h4 {
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.test-item p {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.difficulty.easy {
    background: #d4edda;
    color: #155724;
}

.difficulty.medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty.hard {
    background: #f8d7da;
    color: #721c24;
}

/* Dark Theme Support */
body.dark-theme .difficulty.easy {
    background: #1e4620;
    color: #d4edda;
}

body.dark-theme .difficulty.medium {
    background: #4a3c1a;
    color: #fff3cd;
}

body.dark-theme .difficulty.hard {
    background: #4a1e21;
    color: #f8d7da;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .main-article {
        padding: 25px 20px;
    }
    
    .lesson-title {
        font-size: 1.8rem;
    }
    
    .lesson-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sentence-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .sentence-actions {
        width: 100%;
        justify-content: center;
    }
    
    .pronunciation-bar {
        padding: 20px 15px;
    }
    
    .sentence-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .pronunciation-bars {
        gap: 20px;
    }
    
    .pronunciation-bar {
        padding: 15px;
    }
    
    .sentence-actions {
        gap: 8px;
    }
    
    .play-sentence-btn,
    .record-sentence-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--content-background);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    box-shadow: var(--box-shadow-lg);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification.info {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--accent-bg), var(--background-light));
}

.notification.error {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.notification.success {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.notification.warning {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.notification.info i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.notification.error i {
    color: #ef4444;
    font-size: 1.2rem;
}

.notification span {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

/* Show notification */
.notification[style*="opacity: 1"] {
    opacity: 1 !important;
    transform: translateX(0) !important;
}

/* Dark theme notification support */
body.dark-theme .notification.error {
    background: linear-gradient(135deg, #4a1e21, #3a1618);
    color: #f8d7da;
}

/* ===== ENHANCED RECORDING BUTTON STYLES ===== */

/* Microphone button with pulse effect */
.record-sentence-btn {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.record-sentence-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--box-shadow-lg);
}

/* Recording state - microphone with red pulse border */
.record-sentence-btn.recording {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    animation: pulse-red 1.5s infinite;
    border: 2px solid #fecaca;
}

.record-sentence-btn.recording::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid #ef4444;
    animation: border-pulse 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(220, 38, 38, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

@keyframes border-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

/* Stop icon when recording */
.record-sentence-btn.recording i {
    transform: scale(1.1);
}

/* Active recording bar effect */
.pronunciation-bar.recording {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.05), rgba(185, 28, 28, 0.02));
    border-left: 4px solid #dc2626;
    animation: recordingGlow 2s ease-in-out infinite;
}

@keyframes recordingGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.6);
    }
}