/*
 * Geography — subject-specific styles
 * Base styles loaded from ../../shared/css/subject-base.css
 */

/* ---- Geography colours ---- */
:root {
    --primary: #0d7377;
    --primary-light: #e0f7fa;
}

/* Topic tags — geography-specific variants */
.topic-tag.cause { background: #fff3e0; color: #e65100; }
.topic-tag.civ { background: #efebe9; color: #5d4037; }
.topic-tag.confl { background: #ffebee; color: #c62828; }
.topic-tag.coop { background: #e8f5e9; color: #2e7d32; }
.topic-tag.cult { background: #f3e5f5; color: #6a1b9a; }
.topic-tag.gov { background: #e3f2fd; color: #1565c0; }
.topic-tag.ident { background: #fce4ec; color: #ad1457; }
.topic-tag.ideol { background: #e8eaf6; color: #283593; }
.topic-tag.innov { background: #e0f7fa; color: #00838f; }
.topic-tag.inter { background: #fff8e1; color: #f57f17; }
.topic-tag.persp { background: #f1f8e9; color: #33691e; }
.topic-tag.sig { background: #ede7f6; color: #4527a0; }
.topic-tag.paper { background: linear-gradient(135deg, #0a5c5f, #0d7377); color: #fff; }

/* ---- Text input (free-text answers) ---- */
.text-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--card);
    color: var(--text);
}
.text-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ---- Source extract (blockquote source analysis) ---- */
.source-extract {
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    margin: 16px 0;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.6;
    border-radius: 0 8px 8px 0;
}
.source-extract .source-attribution {
    display: block;
    font-style: normal;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
}

/* ---- Calculator — geography-specific colours ---- */
.calc-btn {
    box-shadow: 0 4px 16px rgba(13,115,119,0.4);
}
.calc-btn:hover { background: #0a5c5f; }

/* ---- Dark Mode — geography overrides ---- */
body.dark-mode {
    --primary-light: rgba(13,115,119,0.15);
}
body.dark-mode .lb-table th { background: rgba(13,115,119,0.15); }
body.dark-mode .text-input { background: #1a1a2e; border-color: #444; color: var(--text); }
body.dark-mode .source-extract { background: rgba(13,115,119,0.1); }

/* ---- 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, #eef0ff); 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, #eef0ff); color: var(--primary); cursor: pointer; }
body.dark-mode .tts-word-ready { background: rgba(67,97,238,0.2); }

/* ---- Loading screen — geography gradient ---- */
.loading-screen {
    background: linear-gradient(135deg, #001a1a 0%, #0a3d3d 40%, #052e2e 70%, #003d3d 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, #0d7377, #0a5c5f, #10908f);
}

/* ---- Paper Generator — geography-specific colours ---- */
.pg-context-box {
    background: #e0f7fa; border-left: 4px solid #0d7377;
}
.pg-context-title { color: #0a5c5f; }
.pg-topic-label {
    background: #0d7377;
}
.pg-grade-circle {
    background: linear-gradient(135deg, #0a5c5f, #0d7377);
    box-shadow: 0 4px 20px rgba(13,115,119,0.3);
}
.pg-q-topic { background: #0d7377; }

/* Dark mode paper gen — geography */
body.dark-mode .pg-context-box { background: rgba(13,115,119,0.1); border-left-color: #0d7377; }
body.dark-mode .pg-context-title { color: #0d7377; }
body.dark-mode .pg-nav-btn.active { background: rgba(13,115,119,0.15); }

/* ================================================================
   PATHWAY — Progress rings, continue card, flowchart
   ================================================================ */

/* Progress ring on hub topic cards */
.pathway-ring {
    position: absolute; top: 12px; right: 12px;
    width: 44px; height: 44px;
}
.topic-card { position: relative; }
.pathway-ring-pct {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 0.65rem; font-weight: 700; color: var(--text);
}

/* Continue Learning card */
.pathway-continue-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px 20px;
    margin-bottom: 16px; transition: all 0.2s;
    border: 2px solid var(--primary);
}
.pathway-continue-card:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(0,0,0,0.12); }
.pathway-continue-card.pathway-complete { border-color: var(--success); cursor: default; }
.pathway-continue-card.pathway-complete:hover { transform: none; }
.pathway-continue-icon { font-size: 1.8rem; flex-shrink: 0; }
.pathway-continue-info { flex: 1; min-width: 0; }
.pathway-continue-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--primary); font-weight: 700; margin-bottom: 2px; }
.pathway-continue-name { font-size: 1.05rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pathway-continue-sub { font-size: 0.8rem; color: var(--text-light); margin-top: 2px; }
.pathway-continue-arrow { font-size: 1.4rem; color: var(--primary); font-weight: 700; flex-shrink: 0; }

/* Pathway view — overall progress */
.pw-overall {
    text-align: center; padding: 24px 0 20px; margin-bottom: 8px;
}
.pw-overall-ring {
    position: relative; display: inline-block; margin-bottom: 8px;
}
.pw-overall-pct {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 1.6rem; font-weight: 800; color: var(--text);
}
.pw-overall-text {
    font-size: 0.9rem; color: var(--text-light); font-weight: 600;
}
.pw-overall-sub {
    font-size: 0.75rem; color: var(--text-light); opacity: 0.7; margin-top: 4px;
}

/* Flowchart */
.pw-flowchart {
    padding: 0 8px 40px;
}
.pw-topic {
    margin-bottom: 0;
}
.pw-topic-header {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px;
    margin-bottom: 0;
}
.pw-topic.done .pw-topic-header { border-left: 4px solid var(--success); }
.pw-topic-icon { font-size: 1.6rem; flex-shrink: 0; }
.pw-topic-info { flex: 1; min-width: 0; }
.pw-topic-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.pw-topic-stat { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.pw-topic-mastered {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--success); margin-top: 2px;
}
.pw-topic-bar {
    width: 60px; height: 6px; border-radius: 3px;
    background: rgba(0,0,0,0.06); flex-shrink: 0; overflow: hidden;
}
.pw-topic-bar-fill {
    height: 100%; border-radius: 3px; background: var(--primary);
    transition: width 0.6s ease;
}
.pw-topic.done .pw-topic-bar-fill { background: var(--success); }

/* Lesson nodes */
.pw-lessons {
    padding-left: 36px; position: relative;
}
.pw-node-row {
    position: relative; display: flex; flex-direction: column; align-items: flex-start;
}
.pw-connector {
    width: 3px; height: 20px; background: rgba(0,0,0,0.1);
    margin-left: 17px;
}
.pw-connector.done { background: var(--success); }

.pw-node {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-radius: 12px;
    background: var(--card); box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    cursor: pointer; transition: all 0.2s; width: 100%;
}
.pw-node:hover { transform: translateX(4px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.pw-node-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 0.8rem; font-weight: 700;
    background: rgba(0,0,0,0.06); color: var(--text-light);
    transition: all 0.3s;
}
.pw-node.done .pw-node-dot { background: var(--success); color: #fff; }
.pw-node.next .pw-node-dot { background: var(--primary); color: #fff; animation: pw-pulse 2s ease-in-out infinite; }
.pw-node.locked .pw-node-dot { background: rgba(0,0,0,0.05); color: #ccc; }
.pw-node-dot.activity { background: transparent; font-size: 1.1rem; }
.pw-node.done .pw-node-dot.activity { background: var(--success-light); }

.pw-node-play { font-size: 0.7rem; margin-left: 2px; }
.pw-node-num { font-size: 0.75rem; }
.pw-node-label { flex: 1; font-size: 0.9rem; font-weight: 600; color: var(--text); }
.pw-node.locked .pw-node-label { color: var(--text-light); }
.pw-node-badge {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 3px 10px; border-radius: 20px;
    background: var(--primary); color: #fff; white-space: nowrap;
}

/* Activity node styling */
.pw-activity { background: rgba(13,115,119,0.04); border: 1px dashed rgba(13,115,119,0.2); }
.pw-activity.done { border-style: solid; border-color: var(--success); background: var(--success-light); }

/* Inter-topic connector */
.pw-topic-connector {
    width: 3px; height: 32px; background: rgba(0,0,0,0.08);
    margin: 0 0 0 53px;
}
.pw-topic-connector.done { background: var(--success); }

@keyframes pw-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13,115,119,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(13,115,119,0); }
}

/* Dark mode — pathway */
body.dark-mode .pathway-ring-pct { color: #e0e0e0; }
body.dark-mode .pw-overall-pct { color: #e0e0e0; }
body.dark-mode .pw-node { background: var(--card); }
body.dark-mode .pw-topic-header { background: var(--card); }
body.dark-mode .pw-connector { background: rgba(255,255,255,0.1); }
body.dark-mode .pw-topic-connector { background: rgba(255,255,255,0.08); }
body.dark-mode .pw-topic-bar { background: rgba(255,255,255,0.1); }
body.dark-mode .pw-node-dot { background: rgba(255,255,255,0.1); }
body.dark-mode .pw-node.locked .pw-node-dot { background: rgba(255,255,255,0.05); color: #555; }
body.dark-mode .pathway-continue-card { background: var(--card); }

/* Background overlay — pathway */
body.has-bg .pathway-continue-card,
body.has-bg .pw-topic-header,
body.has-bg .pw-node {
    background: rgba(255,255,255,0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body.has-bg.dark-mode .pathway-continue-card,
body.has-bg.dark-mode .pw-topic-header,
body.has-bg.dark-mode .pw-node {
    background: rgba(22,33,62,0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* Lesson engine — next lesson button */
.lesson-next-card {
    display: flex; align-items: center; gap: 12px;
    background: rgba(13,115,119,0.06); border: 2px solid var(--primary);
    border-radius: var(--radius); padding: 14px 18px;
    margin-top: 16px; cursor: pointer; transition: all 0.2s;
}
.lesson-next-card:hover { background: rgba(13,115,119,0.12); transform: translateY(-1px); }
.lesson-next-icon { font-size: 1.2rem; }
.lesson-next-info { flex: 1; }
.lesson-next-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary); font-weight: 700; }
.lesson-next-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.lesson-next-arrow { font-size: 1.2rem; color: var(--primary); }

/* ---- Horizontal Timeline — geography colours ---- */
.tl-h-wrapper { position: relative; overflow-x: auto; overflow-y: hidden; padding: 20px 0 12px; -webkit-overflow-scrolling: touch; }
.tl-h-track { display: flex; gap: 20px; padding: 0 12px; min-width: max-content; position: relative; }
.tl-h-track::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 3px; background: var(--border, #e0e0e0); transform: translateY(-50%); z-index: 0; }
.tl-h-card { position: relative; z-index: 1; width: 220px; flex-shrink: 0; background: var(--bg, #fff); border: 1.5px solid var(--border, #e0e0e0); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; }
.tl-h-card:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.tl-h-img { width: 100%; height: 120px; object-fit: cover; background: var(--primary-light, rgba(67,97,238,0.08)); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.tl-h-body { padding: 10px 12px; }
.tl-h-year { font-size: 0.72rem; font-weight: 700; color: var(--primary, #0d7377); text-transform: uppercase; }
.tl-h-title { font-size: 0.88rem; font-weight: 700; margin: 4px 0; line-height: 1.3; }
.tl-h-desc { font-size: 0.75rem; color: var(--text-light, #6c757d); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-h-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tl-h-tag { font-size: 0.6rem; padding: 2px 6px; border-radius: 4px; background: var(--primary-light, rgba(13,115,119,0.1)); color: var(--primary, #0d7377); font-weight: 600; }
.tl-h-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary, #0d7377); border: 2px solid var(--bg, #fff); position: absolute; top: -8px; left: 50%; transform: translateX(-50%); }
body.dark-mode .tl-h-card { background: rgba(22,33,62,0.9); border-color: #444; }
.tl-h-wrapper::-webkit-scrollbar { height: 6px; }
.tl-h-wrapper::-webkit-scrollbar-thumb { background: var(--primary, #0d7377); border-radius: 3px; }
