/* === Enhanced Dutch Fluency Journal Styles === */
:root {
    --primary-color: #ff6700;
    --primary-color-light: #ff8533;
    --primary-color-dark: #cc5200;
    --primary-color-bg: #fff8f3;
    --secondary-color: #4CAF50;
    --accent-color: #2196F3;
    --background-color: #fdf6f2;
    --text-color: #2C3E50;
    --text-secondary: #666666;
    --light-text: #999999;
    --error-color: #f44336;
    --success-color: #4CAF50;
    --info-color: #2196F3;
    --warning-color: #ffc107;
    --white: #ffffff;
    --light-bg: #f8f9fa;
    --light-bg-hover: #f1f3f5;
    --border-color: #e2e8f0;
    --border-radius-sm: 8px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --box-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --box-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spacing: 20px;
    --emotion-grid-columns: 4;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --recording-red: #f44336;
    --recording-red-light: #ff7b73;
}

/* === Global Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.journal-body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

.journal-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* === Modern Header Styles === */
.page-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
    color: white;
    padding: 30px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08), 0 6px 6px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--transition);
}

.page-header:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.12);
}

.page-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 60%);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

.page-header h1 {
    color: white;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.header-subtitle {
    opacity: 0.95;
    margin-top: 8px;
    font-weight: 400;
    font-size: 1.1em;
    color: white;
    margin-bottom: 20px;
}

.user-info-bar {
    background-color: rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    margin-bottom: 25px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.95);
}

.info-item i {
    font-size: 0.9rem;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-actions .btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--border-radius-sm);
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(5px);
}

.header-actions .btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.header-actions .btn.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
    font-weight: 600;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@media (max-width: 768px) {
    .user-info-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .header-actions .btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
}

/* === Section Styles === */
section,
.history-section,
.stats-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08), 0 6px 6px rgba(0, 0, 0, 0.12);
    margin-bottom: 30px;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

section:hover {
    box-shadow: var(--box-shadow-lg);
    border-color: var(--border-color);
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    padding-bottom: 0.5rem;
}

section h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-light));
    border-radius: 2px;
}

/* === Level Selection === */
.level-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.level-btn {
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.level-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color-bg);
    transform: translateY(-2px);
}

.level-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color-dark);
    box-shadow: 0 2px 8px rgba(204, 82, 0, 0.3);
}

.level-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 70%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.level-btn:active::before {
    transform: scale(3);
    opacity: 1;
    transition: 0s;
}

/* === Emotion Grid === */
.emotion-grid,
.emotions-grid {
    display: grid;
    grid-template-columns: repeat(var(--emotion-grid-columns), 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.emotion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px 10px;
    cursor: pointer;
    transition: var(--transition);
}

.emotion-btn:hover {
    background-color: var(--primary-color-bg);
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.emotion-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color-dark);
    box-shadow: 0 3px 8px rgba(204, 82, 0, 0.25);
}

.emotion-btn .emoji {
    font-size: 2rem;
    margin-bottom: 8px;
    transition: transform 0.3s var(--transition-bounce);
}

.emotion-btn:hover .emoji {
    transform: scale(1.2);
}

/* === Mood Rating === */
.stars {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.star {
    background: none;
    border: none;
    font-size: 2.2rem;
    cursor: pointer;
    opacity: 0.3;
    transition: var(--transition);
    transform-origin: center;
}

.star:hover,
.star.active {
    opacity: 1;
    transform: scale(1.2);
}

/* === Language Toggle === */
.toggle-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color-bg);
    transform: translateY(-2px);
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color-dark);
    box-shadow: 0 2px 8px rgba(204, 82, 0, 0.3);
}

.lang-btn .emoji {
    font-size: 1.3rem;
    transition: transform 0.3s var(--transition-bounce);
}

.lang-btn:hover .emoji {
    transform: scale(1.2);
}

/* === Writing Section === */
.editor-container {
    background-color: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: var(--box-shadow-sm);
    transition: var(--transition);
}

.editor-container:focus-within {
    box-shadow: var(--box-shadow);
    border-color: var(--primary-color-light);
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

/* Voice Recording Button */
.voice-record-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 14px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.voice-record-btn:hover {
    background-color: var(--primary-color-bg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.voice-record-btn.recording {
    background-color: var(--recording-red-light);
    color: var(--white);
    border-color: var(--recording-red);
    animation: pulse 1.5s infinite;
}

.voice-record-btn .emoji {
    font-size: 1.2rem;
    transition: transform 0.3s var(--transition-bounce);
}

.voice-record-btn:hover .emoji {
    transform: scale(1.2);
}

/* Voice Recording Status */
.voice-recording-status {
    padding: 15px;
    background-color: var(--primary-color-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.voice-recording-status p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-color);
    flex-grow: 1;
}

.voice-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-right: 10px;
}

.voice-wave span {
    display: inline-block;
    width: 3px;
    height: 15px;
    background-color: var(--recording-red);
    border-radius: 3px;
    animation: wave 1s infinite ease-in-out;
}

.voice-wave span:nth-child(1) { animation-delay: 0.0s; }
.voice-wave span:nth-child(2) { animation-delay: 0.2s; }
.voice-wave span:nth-child(3) { animation-delay: 0.4s; }
.voice-wave span:nth-child(4) { animation-delay: 0.6s; }
.voice-wave span:nth-child(5) { animation-delay: 0.8s; }

.stop-recording-btn {
    background-color: var(--recording-red);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stop-recording-btn:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

@keyframes wave {
    0%, 100% {
        height: 5px;
    }
    50% {
        height: 20px;
    }
}

#journalTextarea {
    width: 100%;
    min-height: 200px;
    font-size: 1.05rem;
    line-height: 1.7;
    padding: 18px;
    border: none;
    font-family: inherit;
    background-color: var(--white);
    color: var(--text-color);
    resize: vertical;
    transition: all 0.2s ease;
}

#journalTextarea:focus {
    outline: none;
}

.writing-tips {
    padding: 15px 18px;
    border-top: 1px solid var(--border-color);
    background-color: var(--primary-color-bg);
    position: relative;
}

.writing-tips h3 {
    color: var(--primary-color-dark);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.writing-tips ul {
    margin-left: 20px;
    margin-top: 10px;
}

.writing-tips li {
    margin-bottom: 8px;
    position: relative;
}

/* === Submit Button === */
.submit-button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    padding: 14px 28px;
    font-size: 1.05rem;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    overflow: hidden;
}

.submit-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: all 0.6s;
}

.submit-button:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(204, 82, 0, 0.3);
}

.submit-button:hover::before {
    left: 100%;
}

.submit-button .button-content {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1;
}

.submit-button:disabled {
    background-color: var(--gray-medium);
    cursor: not-allowed;
    opacity: 0.7;
}

/* === Feedback Section === */
.feedback-section {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    margin-bottom: 25px;
    transition: var(--transition);
}

.feedback-section:not(.hidden) {
    animation: fadeInUp 0.5s ease forwards;
}

.enhanced-version {
    margin-bottom: 30px;
}

.enhanced-version h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
    position: relative;
    padding-bottom: 8px;
}

.enhanced-version h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-light));
    border-radius: 2px;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.audio-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.audio-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: all 0.6s;
}

.audio-btn:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(204, 82, 0, 0.25);
}

.audio-btn:hover::before {
    left: 100%;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--light-bg);
    padding: 8px 15px;
    border-radius: var(--border-radius);
}

.speed-control input[type="range"] {
    width: 100px;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary-color-light), var(--primary-color));
    outline: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.enhanced-content {
    line-height: 1.8;
    font-size: 1.1rem;
    background-color: var(--light-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 30px;
    box-shadow: var(--box-shadow-sm);
}

/* === Word Selection Styles === */
.word-selection-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.word-selection-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
    position: relative;
    padding-bottom: 8px;
}

.word-selection-section h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-light));
    border-radius: 2px;
}

.selection-instructions {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--primary-color-bg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    font-size: 1.05rem;
    line-height: 1.6;
}

.selected-words-container {
    margin-top: 20px;
    background-color: var(--light-bg);
    padding: 20px;
    border-radius: var(--border-radius);
}

.selected-words-container h4 {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: var(--font-weight-semibold);
}

#wordCount {
    margin-left: 10px;
    padding: 3px 10px;
    background-color: var(--primary-color-bg);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--primary-color-dark);
    font-weight: var(--font-weight-medium);
}

.selected-words-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.selected-word {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--primary-color-bg);
    border-radius: 20px;
    padding: 8px 15px;
    border: 1px solid var(--primary-color-light);
    transition: var(--transition);
    cursor: pointer;
    font-weight: var(--font-weight-medium);
}

.selected-word:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(204, 82, 0, 0.15);
}

.selected-word .remove-word {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-word:hover .remove-word {
    color: var(--white);
    transform: rotate(90deg);
}

.clickable-word {
    display: inline-block;
    padding: 4px 8px;
    margin: 0 3px;
    background-color: var(--light-bg);
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
    font-size: 1.05rem;
    line-height: 1.4;
}

.clickable-word:hover {
    background-color: var(--primary-color-light);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(204, 82, 0, 0.15);
}

.clickable-word.selected {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color-dark);
    box-shadow: 0 2px 4px rgba(204, 82, 0, 0.2);
}

/* === Vocabulary Section === */
.vocabulary-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.vocabulary-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
    position: relative;
    padding-bottom: 8px;
}

.vocabulary-section h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-light));
    border-radius: 2px;
}

.vocabulary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.vocabulary-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--box-shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.vocabulary-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
    border-color: var(--primary-color-light);
}

.vocabulary-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.vocabulary-card p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.example-sentence {
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 5px;
    padding-left: 10px;
    border-left: 2px solid var(--primary-color-light);
}

.youglish-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.youglish-link:hover {
    color: var(--primary-color-dark);
    text-decoration: underline;
}

/* === Action Buttons === */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

.primary-button {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 25px;
    font-size: 1.05rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.primary-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: all 0.6s;
}

.primary-button:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(204, 82, 0, 0.3);
}

.primary-button:hover::before {
    left: 100%;
}

.button-icon {
    font-size: 1.2rem;
}

/* === Email Button === */
#emailJournalButton {
    background-color: var(--accent-color);
}

#emailJournalButton:hover {
    background-color: #1976D2;
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}

/* === Word Learning Popup === */
.word-learning-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease forwards;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 25px;
    background-color: var(--primary-color);
    color: var(--white);
}

.popup-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: var(--font-weight-semibold);
}

.close-button {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.8rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.close-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.popup-content {
    padding: 25px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.word-explanation h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.2rem;
    font-weight: var(--font-weight-semibold);
}

.word-explanation p {
    margin-bottom: 20px;
    line-height: 1.7;
    color: var(--text-color);
}

.youglish-container {
    padding: 20px;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.youglish-container h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.2rem;
    font-weight: var(--font-weight-semibold);
}

#youglishPlayer {
    width: 100%;
    min-height: 250px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-top: 15px;
    background-color: var(--white);
}

.popup-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 25px;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

.nav-button {
    background-color: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-sm);
    padding: 8px 18px;
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
}

.nav-button:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* === Notification System === */
.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.notification {
    padding: 15px 20px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    animation: slideInRight 0.3s ease forwards;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 4px solid var(--primary-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: 3px;
}

.notification-message {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.notification-close:hover {
    color: var(--text-color);
    transform: rotate(90deg);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--error-color);
}

.notification.info {
    border-left-color: var(--info-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

/* === Overlay Background === */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease forwards;
}

/* === Loading Spinner === */
.loading-spinner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loading-spinner .spinner {
    width: 24px;
    height: 24px;
    animation: rotate 2s linear infinite;
}

.loading-spinner .path {
    stroke: var(--white);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

.loading-spinner .loading-text {
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 500;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Utility Classes === */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === Media Queries === */
@media (max-width: 768px) {
    .journal-container {
        padding: 1rem;
    }
    
    .emotion-grid {
        --emotion-grid-columns: 2;
    }
    
    .level-buttons {
        flex-direction: column;
    }
    
    .toggle-buttons {
        flex-direction: column;
    }
    
    .popup-content {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .audio-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .speed-control {
        width: 100%;
    }
    
    .editor-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .voice-record-btn, .tips-toggle {
        flex: 1;
        justify-content: center;
    }
    
    .word-count {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color-light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Help button */
.help-button {
    background-color: var(--primary-color-lighter);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.help-button:hover {
    background-color: var(--primary-color-darker);
    transform: scale(1.05);
}

.help-button .emoji {
    font-size: 1.2em;
    animation: pulse 2s infinite;
}

/* Help popup */
.help-popup {
    position: absolute;
    top: -80px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    width: 300px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transform-origin: bottom right;
    animation: popUp 0.3s ease-out;
    display: none;
}

.help-popup.visible {
    display: block;
}

.help-popup::before {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 30px;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    transform: rotate(45deg);
}

.help-popup h4 {
    margin-top: 0;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 10px;
}

.help-popup p {
    margin-bottom: 15px;
    font-size: 0.95em;
    line-height: 1.4;
}

.help-question {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color-darker);
}

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

@keyframes popUp {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* === Modern Journal History & Stats Styles === */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color-bg);
}

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

.history-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(255, 103, 0, 0.3);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 103, 0, 0.4);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary-color-dark), var(--primary-color));
}

.entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.entry-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.entry-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-light));
}

.entry-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.entry-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.entry-mood {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.entry-mood .emoji {
    font-size: 1.5rem;
}

.entry-preview {
    color: var(--text-color);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 15px;
}

.entry-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Modern Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 30px 0;
}

.pagination button {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.pagination button.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modern Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color-bg), white);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-light));
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.generate-report-btn {
    background: linear-gradient(135deg, var(--success-color), #45a049);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.generate-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* ===== YouTube Video Player Styles ===== */
.youtube-player-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.youtube-iframe-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.youtube-iframe-container iframe {
    width: 100%;
    height: 315px;
    border: none;
}

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

.youtube-videos-list h5 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.youtube-video-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface-color);
    border: 2px solid transparent;
}

.youtube-video-item:hover {
    background: var(--hover-color);
    transform: translateX(4px);
}

.youtube-video-item.active {
    border-color: var(--primary-color);
    background: rgba(255, 103, 0, 0.05);
}

.video-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.video-thumbnail:hover .play-icon {
    background: var(--primary-color);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.video-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.video-channel {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-loading,
.video-error {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    background: var(--surface-color);
    border-radius: 8px;
}

.video-error {
    color: var(--error-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .youtube-iframe-container iframe {
        height: 250px;
    }

    .video-thumbnail {
        width: 100px;
        height: 56px;
    }

    .video-title {
        font-size: 0.85rem;
    }

    .video-channel {
        font-size: 0.7rem;
    }
}
/* =================================================================
   GENRE SELECTION MODAL (shown after 2nd entry)
   ================================================================= */
.genre-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.genre-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.genre-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 52, 96, 0.85);
    backdrop-filter: blur(8px);
}

.genre-modal-content {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.genre-modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.genre-modal-header h2 {
    color: #0F3460;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.genre-modal-header p {
    color: #374151;
    font-size: 1.05rem;
    margin: 0;
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.genre-option {
    background-color: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.genre-option:hover {
    transform: translateY(-4px);
    border-color: #FF6B35;
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.2);
}

.genre-option:active {
    transform: translateY(-2px);
}

.genre-option.selected {
    background-color: #FF6B35;
    border-color: #FF6B35;
    color: white;
}

.genre-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.genre-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0F3460;
}

.genre-option.selected .genre-name {
    color: white;
}

.genre-modal-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.genre-hint {
    color: #6B7280;
    font-size: 0.9rem;
    margin: 0;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .genre-modal-content {
        padding: 2rem 1.5rem;
        max-width: 95%;
    }

    .genre-modal-header h2 {
        font-size: 1.5rem;
    }

    .genre-modal-header p {
        font-size: 0.95rem;
    }

    .genre-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .genre-option {
        padding: 1.25rem 0.75rem;
    }

    .genre-icon {
        font-size: 2rem;
    }

    .genre-name {
        font-size: 0.85rem;
    }
}
