/* ============================================
   Torah Tracker — insights
   Phase 11.5C: Split from app.css
   ============================================ */

/* ---- Insights Page ---- */
.insights-header { padding: 20px 0 4px; }

/* ---- Phase 10: Insights Tabs ---- */
.insights-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
}
.insights-tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}
.insights-tab {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    position: relative;
    white-space: nowrap;
}
.insights-tab.active {
    background: var(--accent-blue);
    color: #fff;
}
.insights-tab-icon { font-size: 14px; }
.insights-tab-badge {
    display: none;
    min-width: 18px;
    height: 18px;
    background: var(--accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 2px;
}
.insights-tab.active .insights-tab-badge {
    background: rgba(255,255,255,0.3);
}

/* ---- Phase 10: Insights Loader ---- */
.insights-loader {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}
.loader-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Phase 10: Empty States ---- */
.insights-empty {
    text-align: center;
    padding: 40px 20px;
}
.insights-empty-icon { font-size: 48px; margin-bottom: 12px; }
.insights-empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.insights-empty p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; max-width: 320px; margin: 0 auto 20px; }
.insights-empty-hint { margin-top: 16px; }

/* ---- Phase 10: Review Stage Legend ---- */
.review-stage-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}
.stage-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ---- Phase 10: Review Queue ---- */
.review-section { margin-bottom: 20px; }
.review-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
    margin-bottom: 10px;
}
.review-section-title { font-size: 15px; font-weight: 600; }
.review-section-count { font-size: 12px; color: var(--text-secondary); }

.review-queue { display: flex; flex-direction: column; gap: 8px; }

.review-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 14px;
    transition: all 0.2s;
    overflow: hidden;
}
.review-card.review-due { border-left: 3px solid var(--accent-orange, #FF9F0A); }
.review-card.review-upcoming { opacity: 0.8; }

.review-card-left { flex-shrink: 0; }
.review-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--bg-elevated);
}
.review-card-icon.gemara { background: rgba(74,144,217,0.15); }
.review-card-icon.mishna { background: rgba(52,199,89,0.15); }
.review-card-icon.halacha { background: rgba(175,82,222,0.15); }
.review-card-icon.chumash { background: rgba(255,69,58,0.15); }
.review-card-icon.other { background: rgba(201,169,97,0.15); }

.review-card-body { flex: 1; min-width: 0; }
.review-card-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.review-card-ref {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.review-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.review-urgency {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
}
.review-urgency.urgent-high { background: rgba(255,69,58,0.15); color: var(--accent-red); }
.review-urgency.urgent-med { background: rgba(255,159,10,0.15); color: #FF9F0A; }
.review-urgency.urgent-today { background: rgba(74,144,217,0.15); color: var(--accent-blue); }

.review-card-stage { display: flex; gap: 3px; }
.stage-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
}
.stage-pip.filled { border: none; }

.review-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.review-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.review-btn:active { transform: scale(0.92); }
.review-btn-start { background: rgba(74,144,217,0.15); color: var(--accent-blue); border-color: rgba(74,144,217,0.3); }
.review-btn-done { background: rgba(52,199,89,0.15); color: var(--accent-green); border-color: rgba(52,199,89,0.3); }

/* ---- Phase 10: Stats Tab ---- */
.stats-section { margin-bottom: 16px; }
.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px;
}
.stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.stats-card-title { font-size: 15px; font-weight: 600; }
.stats-card-subtitle { font-size: 12px; color: var(--text-secondary); }

/* Heatmap */
.heatmap-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}
.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    gap: 3px;
    min-width: fit-content;
}
.heatmap-cell {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    background: var(--bg-elevated);
}
.heatmap-cell.heat-0 { background: var(--bg-elevated); }
.heatmap-cell.heat-1 { background: rgba(74,144,217,0.25); }
.heatmap-cell.heat-2 { background: rgba(74,144,217,0.45); }
.heatmap-cell.heat-3 { background: rgba(74,144,217,0.7); }
.heatmap-cell.heat-4 { background: var(--accent-blue); }

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 10px;
    font-size: 11px;
}
.heatmap-legend-label { color: var(--text-tertiary); font-size: 10px; }
.heatmap-cell-legend {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Subject bars */
.subject-bars { display: flex; flex-direction: column; gap: 12px; }
.stat-bar-row { display: flex; align-items: center; gap: 10px; }
.stat-bar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    min-width: 90px;
}
.stat-bar-icon { font-size: 16px; }
.stat-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.stat-bar-gemara { background: var(--accent-blue); }
.stat-bar-mishna { background: var(--accent-green); }
.stat-bar-halacha { background: #AF52DE; }
.stat-bar-chumash { background: var(--accent-red); }
.stat-bar-other { background: var(--accent-gold); }
.stat-bar-value {
    font-size: 12px;
    font-weight: 600;
    min-width: 55px;
    text-align: right;
}
.stat-bar-pct { color: var(--text-secondary); font-weight: 400; }
.stat-empty-hint { text-align: center; color: var(--text-tertiary); font-size: 13px; padding: 16px; }

/* Monthly chart */
.monthly-chart {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    min-height: 140px;
    padding-top: 8px;
}
.monthly-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.monthly-bar-value { font-size: 10px; font-weight: 600; color: var(--text-secondary); }
.monthly-bar-track {
    width: 100%;
    height: 90px;
    background: var(--bg-elevated);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}
.monthly-bar-fill {
    width: 100%;
    background: linear-gradient(to top, var(--accent-blue), rgba(74,144,217,0.6));
    border-radius: 6px;
    transition: height 0.6s ease;
}
.monthly-bar-label { font-size: 11px; font-weight: 500; }
.monthly-bar-days { font-size: 10px; color: var(--text-tertiary); }

/* ---- Phase 10: Mastery Tab ---- */
.mastery-ring-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 24px 18px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}
.mastery-ring-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
}
.mastery-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.mastery-ring-bg {
    fill: none;
    stroke: var(--bg-elevated);
    stroke-width: 8;
}
.mastery-ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}
.mastery-ring-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.mastery-ring-pct { font-size: 24px; font-weight: 700; line-height: 1; }
.mastery-ring-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.mastery-ring-stats {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.mastery-stat { text-align: center; }
.mastery-stat-value { font-size: 20px; font-weight: 700; line-height: 1.2; }
.mastery-stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.mastery-stat-green { color: var(--accent-green); }
.mastery-stat-orange { color: #FF9F0A; }

/* Stage pipeline */
.stage-pipeline {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    min-height: 100px;
    padding: 8px 0;
}
.pipeline-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.pipeline-bar-track {
    width: 100%;
    height: 60px;
    background: var(--bg-elevated);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}
.pipeline-bar-fill {
    width: 100%;
    border-radius: 6px;
    transition: height 0.6s ease;
    min-height: 3px;
}
.pipeline-count { font-size: 13px; font-weight: 700; }
.pipeline-label { font-size: 10px; color: var(--text-secondary); }

/* Mastery sections */
.mastery-section { margin-bottom: 16px; }
.mastery-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
    margin-bottom: 10px;
}
.mastery-section-title { font-size: 15px; font-weight: 600; }
.mastery-section-count { font-size: 12px; color: var(--text-secondary); background: var(--bg-elevated); padding: 2px 8px; border-radius: 8px; }

/* Subject mastery cards */
.mastery-subject-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 8px;
}
.mastery-subject-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.mastery-subject-icon { font-size: 18px; }
.mastery-subject-name { font-size: 14px; font-weight: 600; flex: 1; }
.mastery-subject-count { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.mastery-bar-stacked {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-elevated);
}
.mastery-seg { transition: width 0.6s ease; }
.mastery-seg-mastered { background: var(--accent-green); }
.mastery-seg-progress { background: var(--accent-blue); }
.mastery-seg-new { background: var(--bg-elevated); }

.mastery-subject-meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.mastery-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
}
.mastery-tag-due { background: rgba(255,159,10,0.15); color: #FF9F0A; }
.mastery-tag-progress { background: rgba(74,144,217,0.15); color: var(--accent-blue); }
.mastery-tag-new { background: rgba(142,142,147,0.15); color: var(--text-secondary); }

/* Mastered items list */
.mastered-list {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
}
.mastered-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.mastered-item:last-child { border-bottom: none; }
.mastered-icon { font-size: 16px; }
.mastered-title { flex: 1; font-size: 13px; font-weight: 500; }
.mastered-check { font-size: 14px; }
.mastered-more {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}


/* ============================================
   Phase 12B — Yearly Summary Tab
   ============================================ */

.summary-year-selector {
    text-align: center;
    margin-bottom: 16px;
}
.summary-year-select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 8px 24px 8px 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    appearance: auto;
    cursor: pointer;
}

.summary-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}
.summary-stat {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 6px;
    text-align: center;
    border: 1px solid var(--border-subtle);
}
.summary-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.summary-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.summary-section {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
}
.summary-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Monthly bar chart */
.summary-month-chart {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 140px;
}
.summary-month-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.summary-month-value {
    font-size: 9px;
    color: var(--text-secondary);
    min-height: 14px;
    margin-bottom: 2px;
}
.summary-month-bar-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}
.summary-month-bar-fill {
    width: 100%;
    background: var(--accent-blue);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.4s ease;
}
.summary-month-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Subject bars */
.summary-subjects {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.summary-subject-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.summary-subject-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.summary-subject-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 64px;
}
.summary-subject-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}
.summary-subject-bar-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.summary-subject-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

/* ============================================
   Phase 12C — Coverage Map Tab
   ============================================ */

.coverage-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}
.coverage-subject-btn {
    flex: 1;
    padding: 10px 4px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.coverage-subject-btn.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.coverage-summary {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 8px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

.coverage-group {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-subtle);
}
.coverage-group-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.coverage-group-hebrew {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 14px;
    margin-left: 6px;
}
.coverage-group-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin: -6px 0 10px;
}

.coverage-masechtos {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.coverage-masechet {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}
.coverage-masechet-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 90px;
}
.coverage-masechet-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
}
.coverage-masechet-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.coverage-masechet.partial .coverage-masechet-fill {
    background: var(--accent-orange, #FF9F0A);
}
.coverage-masechet.complete .coverage-masechet-fill {
    background: var(--accent-green, #34C759);
}
.coverage-masechet-stat {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 42px;
    text-align: right;
}

.coverage-hours {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: right;
}

/* Mefarshim tags (Chumash) */
.coverage-mefarshim {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}
.coverage-mef-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.coverage-mef-tag {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px 4px 2px 0;
    background: var(--bg-elevated);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-primary);
}
.coverage-mef-tag small {
    color: var(--text-secondary);
    font-size: 10px;
}


