/* ================================================================
   Hindi (MFL) - subject-specific overrides
   Base styles loaded from ../../shared/css/subject-base.css
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

:root {
    --primary: #ff6b35;
    --primary-light: #fff3ed;
    --color-brand: #ff6b35;
}

/* ---- Hindi text class ---- */
.hindi-text {
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    font-size: 1.15em;
    line-height: 1.8;
}

/* ---- Hindi topic tags ---- */
.topic-tag.vocab    { background: #e8f5e9; color: #2e7d32; }
.topic-tag.reading  { background: #e3f2fd; color: #1565c0; }
.topic-tag.listening { background: #fff3e0; color: #e65100; }
.topic-tag.grammar  { background: #fce4ec; color: #c62828; }
.topic-tag.speaking { background: #ede7f6; color: #4527a0; }

/* ---- Unit header cards ---- */
.unit-card {
    background: var(--card);
    border-radius: var(--radius, 16px);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 16px;
    border-left: 5px solid var(--primary);
    position: relative;
}
.unit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    margin-right: 10px;
    flex-shrink: 0;
}
.unit-card h2 {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.unit-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* ---- Question prompt ---- */
.question-prompt { font-size: 1.05rem; }

/* ---- Score bar ---- */
.score-bar-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--bg-subtle, #f5f6fa);
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}
.score-bar-wrap .score-display { font-weight: 700; color: var(--text); }
.score-bar-wrap .pct-display { font-weight: 700; color: var(--primary); min-width: 40px; text-align: center; }
.score-bar-wrap .streak-display { display: flex; align-items: center; gap: 4px; font-weight: 600; }
body.dark-mode .score-bar-wrap { background: rgba(255,255,255,0.06); }

/* ---- Vocab card styles ---- */
.vocab-card {
    background: var(--card);
    border-radius: var(--radius, 16px);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    text-align: center;
}
.vocab-word-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
}
.vocab-word {
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.6;
}
.vocab-trans {
    font-size: 0.92rem;
    color: var(--text-light);
    font-style: italic;
}
.vocab-q {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}
.vocab-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    margin: 0 auto 16px;
}
.vocab-opt {
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    color: var(--text);
}
.vocab-opt:hover { border-color: var(--primary); background: var(--primary-light); }
.vocab-opt.correct {
    border-color: var(--success, #27ae60);
    background: rgba(39, 174, 96, 0.1);
    color: var(--success, #27ae60);
}
.vocab-opt.wrong {
    border-color: var(--error, #e74c3c);
    background: rgba(231, 76, 60, 0.1);
    color: var(--error, #e74c3c);
}
body.dark-mode .vocab-opt { background: var(--card); border-color: #444; }
body.dark-mode .vocab-opt:hover { border-color: var(--primary); background: rgba(255,107,53,0.15); }

.vocab-ex {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 10px;
    font-style: italic;
    line-height: 1.6;
}
.vocab-progress {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 12px;
    font-weight: 600;
}
.vocab-results {
    text-align: center;
    padding: 24px;
}
.vocab-final-score {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}
.vocab-tts-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
    margin-top: 8px;
}
.vocab-tts-btn:hover { transform: scale(1.1); }
.vocab-tts-btn:active { transform: scale(0.95); }

/* ---- Passage box (reading comprehension) ---- */
.passage-box {
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    background: var(--bg-subtle);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 0 12px 12px 0;
    margin: 14px 0;
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text);
}
body.dark-mode .passage-box { background: #1a1a2e; border-left-color: var(--primary); }

/* ---- Listening controls ---- */
.listening-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-subtle, #f5f6fa);
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}
.listen-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.2s;
    flex-shrink: 0;
}
.listen-btn:hover { transform: scale(1.1); }
.listen-btn:active { transform: scale(0.95); }
.listen-btn.play-btn { background: var(--primary); }
.listen-btn.pause-btn { background: var(--primary); opacity: 0.85; }
.listen-btn.replay-btn { background: var(--primary-light); color: var(--primary); }
.listen-speed-btn {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.72rem;
    width: auto;
    padding: 0 12px;
    height: 34px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.listen-speed-btn:hover { background: var(--primary); color: #fff; }
.listen-label {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-left: 4px;
}
body.dark-mode .listening-controls { background: rgba(255,255,255,0.06); }

/* ---- TTS Reader Bar ---- */
.tts-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; padding: 8px 12px; background: var(--bg-subtle, #f5f6fa); border-radius: 10px; border: 1px solid var(--border); }
.tts-btn { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.15s, opacity 0.2s; flex-shrink: 0; }
.tts-btn:hover { transform: scale(1.1); }
.tts-btn:active { transform: scale(0.95); }
.tts-speed { background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 0.7rem; width: auto; padding: 0 10px; border-radius: 8px; }
.tts-voice-select { border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-size: 0.75rem; background: var(--card); color: var(--text); max-width: 140px; cursor: pointer; }
.tts-label { font-size: 0.78rem; color: var(--text-light); margin-left: 4px; }
body.dark-mode .tts-bar { background: rgba(255,255,255,0.06); }
.tts-word { cursor: default; border-radius: 3px; transition: background 0.2s, color 0.2s; }
.tts-word-ready { background: var(--primary-light); color: var(--primary); cursor: pointer; }
body.dark-mode .tts-word-ready { background: rgba(255,107,53,0.2); }

/* ---- Grammar exercise styles ---- */
.grammar-card {
    background: var(--card);
    border-radius: var(--radius, 16px);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
}
.grammar-prompt {
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 16px;
    color: var(--text);
}
.grammar-blank {
    display: inline-block;
    min-width: 80px;
    border-bottom: 2px dashed var(--primary);
    padding: 2px 6px;
    margin: 0 4px;
    color: var(--primary);
    font-weight: 600;
}
.grammar-hint {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 12px;
    font-style: italic;
}
.grammar-explanation {
    font-size: 0.88rem;
    background: var(--bg-subtle);
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 12px;
    line-height: 1.6;
    color: var(--text-light);
}
body.dark-mode .grammar-explanation { background: #1a1a2e; }

/* ---- Text input area (for free-text answers) ---- */
.text-answer-field {
    font-size: 1.1rem;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    min-width: 200px;
    max-width: 360px;
    width: 100%;
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    color: var(--text);
    background: var(--card);
    transition: border-color 0.2s;
    outline: none;
}
.text-answer-field:focus { border-color: var(--primary); }
body.dark-mode .text-answer-field { background: #1a1a2e; border-color: #444; color: var(--text); }

/* ---- Speaking prompt styles ---- */
.speaking-card {
    background: var(--card);
    border-radius: var(--radius, 16px);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    text-align: center;
}
.speaking-prompt {
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.8;
    color: var(--primary);
    margin-bottom: 8px;
}
.speaking-translation {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 18px;
}
.speaking-record-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(255,107,53,0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.speaking-record-btn:hover { transform: scale(1.1); }
.speaking-record-btn:active { transform: scale(0.95); }
.speaking-record-btn.recording {
    background: var(--error, #e74c3c);
    animation: pulse-record 1.2s ease-in-out infinite;
}
@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
    50% { box-shadow: 0 0 0 12px rgba(231,76,60,0); }
}
.speaking-feedback {
    margin-top: 16px;
    font-size: 0.92rem;
    color: var(--text-light);
}
.speaking-romanization {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 6px;
    font-style: italic;
}

/* ---- Writing reference styles ---- */
.writing-ref-fab {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 14px rgba(255,107,53,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.writing-ref-fab:hover { transform: scale(1.1); }
.writing-ref-panel-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.writing-ref-panel-backdrop.open { opacity: 1; pointer-events: auto; }
.writing-ref-panel {
    position: fixed;
    top: 0; right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg, #fff);
    z-index: 1001;
    overflow-y: auto;
    padding: 20px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.writing-ref-panel.open { transform: translateX(0); }
.writing-ref-panel .ref-section {
    background: rgba(128,128,128,0.06);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.writing-ref-panel .ref-section h3 {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 4px;
    margin-bottom: 8px;
    margin-top: 0;
}
.ref-table { width: 100%; border-collapse: collapse; }
.ref-table td { padding: 6px 10px; border-bottom: 1px solid rgba(128,128,128,0.15); font-size: 0.88rem; }
.ref-table td:first-child { font-weight: 600; width: 35%; font-family: 'Noto Sans Devanagari', 'Inter', sans-serif; }
.ref-table tr:last-child td { border-bottom: none; }
.writing-ref-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 4px 10px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.writing-ref-close:hover { background: rgba(128,128,128,0.1); }

/* ---- Loading screen ---- */
.loading-screen {
    background: linear-gradient(135deg, #4a1a00 0%, #8b3a00 40%, #5c2a00 70%, #7a3200 100%);
}
.loading-arc {
    animation: arc-draw 2s ease-in-out infinite;
    transform-origin: center;
}
@keyframes arc-draw {
    0% { stroke-dashoffset: 264; }
    50% { stroke-dashoffset: 66; }
    100% { stroke-dashoffset: 264; }
}
.loading-orbit { animation: orbit-pulse 3s ease-in-out infinite; }
.loading-orbit:nth-child(4) { animation-delay: 0.5s; }
.loading-orbit:nth-child(5) { animation-delay: 1s; }
@keyframes orbit-pulse {
    0%,100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}
.loading-electron {
    animation: electron-orbit 2s linear infinite;
    transform-origin: 50px 50px;
}
@keyframes electron-orbit { to { transform: rotate(360deg); } }
.loading-bar {
    background: linear-gradient(90deg, #ff6b35, #e65100, #ff6b35);
    background-size: 200% 100%;
}

/* ---- Dark Mode ---- */
body.dark-mode {
    --primary-light: rgba(255,107,53,0.15);
}
body.dark-mode .lb-table th { background: rgba(255,107,53,0.15); }
body.dark-mode .fb-float-body select,
body.dark-mode .fb-float-body textarea { background: #1a1a2e; border-color: #444; color: var(--text); }
body.dark-mode .vocab-card { background: var(--card); }
body.dark-mode .grammar-card { background: var(--card); }
body.dark-mode .speaking-card { background: var(--card); }
body.dark-mode .unit-card { background: var(--card); }

/* ---- Glassmorphism ---- */
body.has-bg .vocab-card,
body.has-bg .grammar-card,
body.has-bg .speaking-card,
body.has-bg .unit-card { background: rgba(255,255,255,0.85); backdrop-filter: blur(8px); }
body.has-bg.dark-mode .vocab-card,
body.has-bg.dark-mode .grammar-card,
body.has-bg.dark-mode .speaking-card,
body.has-bg.dark-mode .unit-card { background: rgba(22,33,62,0.85); }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .writing-ref-fab { bottom: 72px; right: 16px; }
    .vocab-word { font-size: 1.6rem; }
    .vocab-opts { max-width: 100%; }
    .speaking-prompt { font-size: 1.1rem; }
    .speaking-record-btn { width: 56px; height: 56px; font-size: 1.3rem; }
    .listening-controls { gap: 6px; padding: 8px 10px; }
    .unit-card { padding: 14px 16px; }
    .score-bar-wrap { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
    .passage-box { padding: 12px 14px; font-size: 0.95rem; }
    .grammar-card { padding: 16px; }
}

@media (max-width: 400px) {
    .vocab-word { font-size: 1.4rem; }
    .vocab-opt { padding: 10px 14px; font-size: 0.88rem; }
    .speaking-prompt { font-size: 1rem; }
    .unit-badge { width: 30px; height: 30px; font-size: 0.78rem; }
}
