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

/* ---- History colours ---- */
:root {
    --primary: #8b6914;
    --primary-light: #fdf5e6;
}

/* Topic tags — history-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, #7a5c10, #8b6914); 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 — history-specific colours ---- */
.calc-btn {
    box-shadow: 0 4px 16px rgba(139,105,20,0.4);
}
.calc-btn:hover { background: #7a5c10; }

/* ---- Dark Mode — history overrides ---- */
body.dark-mode {
    --primary-light: rgba(139,105,20,0.15);
}
body.dark-mode .lb-table th { background: rgba(139,105,20,0.15); }
body.dark-mode .text-input { background: #1a1a2e; border-color: #444; color: var(--text); }
body.dark-mode .source-extract { background: rgba(139,105,20,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 — history gradient ---- */
.loading-screen {
    background: linear-gradient(135deg, #1a0f00 0%, #3d2a0a 40%, #2e1f05 70%, #3d2a00 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, #8b6914, #7a5c10, #a67c1a);
}

/* ---- Paper Generator — history-specific colours ---- */
.pg-context-box {
    background: #fdf5e6; border-left: 4px solid #8b6914;
}
.pg-context-title { color: #7a5c10; }
.pg-topic-label {
    background: #8b6914;
}
.pg-grade-circle {
    background: linear-gradient(135deg, #7a5c10, #8b6914);
    box-shadow: 0 4px 20px rgba(139,105,20,0.3);
}
.pg-q-topic { background: #8b6914; }

/* Dark mode paper gen — history */
body.dark-mode .pg-context-box { background: rgba(139,105,20,0.1); border-left-color: #8b6914; }
body.dark-mode .pg-context-title { color: #8b6914; }
body.dark-mode .pg-nav-btn.active { background: rgba(139,105,20,0.15); }

/* ---- Horizontal Timeline (history-specific) ---- */
#view-timeline { width: 100vw; margin-left: calc(-50vw + 50%); max-width: 100vw; padding: 0 24px; box-sizing: border-box; }
/* On desktop with sidebar, don't break out of #app container */
body.device-desktop #view-timeline { width: 100%; margin-left: 0; max-width: 100%; }
#view-timeline header, #view-timeline .level-select, #view-timeline .back-btn,
#view-timeline .score-bar, #view-timeline .question-card, #view-timeline .hint-box,
#view-timeline .feedback, #view-timeline > div[style*="text-align:center"] { max-width: 680px; margin-left: auto; margin-right: auto; }
.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: 280px; 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, #8b6914); 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(139,105,20,0.1)); color: var(--primary, #8b6914); font-weight: 600; }
.tl-h-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary, #8b6914); 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, #8b6914); border-radius: 3px; }
