/* =====================================================================
   Insights — Phase v2 styles
   - Mood Heatmap (#34)
   - Weight Trend chart (#36)
   - Entertainment Shelf (#37)
   - Blip Reactions badges + picker (#38)
   ---------------------------------------------------------------------
   Uses existing .insights-*, .insights-stat-box, .insights-tab tokens
   from app.css. Theme variables: --bg-paper, --border-color,
   --text-primary, --text-secondary, --text-muted, --accent.
===================================================================== */


/* --- Tabs row (reused for all 5 insight pages) ---------------------- */
.insights-tabs .insights-tab {
    padding: 4px 10px;
    margin: 0 2px;
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 999px;
    transition: background .15s ease;
}
.insights-tabs .insights-tab:hover {
    background: rgba(0, 0, 0, 0.04);
}
.insights-tabs .insights-tab.active {
    background: var(--accent, #444);
    color: var(--text-light, #fff);
}


/* ─────────────────────────────────────────────────────────────────────
   #34  Mood Heatmap
   ──────────────────────────────────────────────────────────────────── */
.heatmap-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.heatmap-range-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 4px;
}
.heatmap-range-link {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    transition: all .15s ease;
}
.heatmap-range-link:hover {
    border-color: var(--accent, #444);
    color: var(--text-primary);
}
.heatmap-range-link.active {
    background: var(--accent, #444);
    border-color: var(--accent, #444);
    color: var(--text-light, #fff);
}

.heatmap-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
}
.heatmap-svg {
    display: block;
    min-width: 100%;
}
.heatmap-cell {
    cursor: pointer;
    transition: stroke .1s ease, transform .1s ease;
}
.heatmap-cell:hover {
    stroke: #000;
    stroke-width: 1px;
}
.heatmap-month-label,
.heatmap-day-label {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 10px;
    fill: var(--text-muted, #888);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted, #888);
}
.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}
.legend-label {
    margin: 0 4px;
}
.heatmap-hint {
    font-size: 12px;
    color: var(--text-muted, #888);
    margin-top: 12px;
    text-align: center;
}


/* ─────────────────────────────────────────────────────────────────────
   #36  Weight Trend chart
   ──────────────────────────────────────────────────────────────────── */
.weight-unit-toggle {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.weight-unit {
    padding: 4px 14px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
}
.weight-unit:hover {
    border-color: var(--accent, #444);
}
.weight-unit.active {
    background: var(--accent, #444);
    border-color: var(--accent, #444);
    color: var(--text-light, #fff);
}

.weight-delta.up   { color: #d97706; }
.weight-delta.down { color: #059669; }

.weight-chart-wrap {
    width: 100%;
    overflow-x: auto;
}
.weight-chart {
    width: 100%;
    height: auto;
    max-width: 720px;
    display: block;
    margin: 0 auto;
}
.weight-grid {
    stroke: var(--border-color, #d0d0d0);
    stroke-width: 0.5;
    stroke-dasharray: 2 3;
}
.weight-axis-label {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    fill: var(--text-muted, #888);
}
.weight-line {
    fill: none;
    stroke: var(--accent, #444);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.weight-area {
    fill: var(--accent, #444);
    opacity: 0.08;
}
.weight-dot {
    fill: var(--bg-paper, #fafaf8);
    stroke: var(--accent, #444);
    stroke-width: 1.5;
    transition: r .15s ease;
}
.weight-dot:hover {
    r: 5;
}

.weight-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.weight-list-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 13px;
}
.weight-list-item:last-child { border-bottom: none; }
.weight-list-date  { color: var(--text-secondary); }
.weight-list-value { font-weight: 500; color: var(--text-primary); }


/* ─────────────────────────────────────────────────────────────────────
   #37  Entertainment Shelf
   ──────────────────────────────────────────────────────────────────── */
.shelf-year-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.shelf-year {
    padding: 4px 14px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
}
.shelf-year:hover { border-color: var(--accent, #444); }
.shelf-year.active {
    background: var(--accent, #444);
    border-color: var(--accent, #444);
    color: var(--text-light, #fff);
}

.shelf-section {
    margin-top: 24px;
}
.shelf-section-emoji {
    margin-right: 6px;
}
.shelf-section-count {
    font-size: 13px;
    font-weight: normal;
    color: var(--text-muted, #888);
    margin-left: 6px;
}

.shelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.shelf-card {
    background: var(--bg-paper, #fafaf8);
    border: 1px solid var(--border-color, #eee);
    border-radius: 6px;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.shelf-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.shelf-card-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    background: #ececec;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.shelf-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.shelf-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8e8e6, #f5f5f3);
}
.shelf-card-placeholder-emoji {
    font-size: 48px;
    opacity: 0.45;
}
.shelf-card-rating {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 999px;
    font-family: var(--font-mono, monospace);
}
.shelf-card-meta {
    padding: 8px 10px 10px;
}
.shelf-card-title {
    font-size: 13px;
    font-weight: 500;
    margin: 0 0 2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.shelf-card-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shelf-card-year {
    font-size: 10px;
    color: var(--text-muted, #888);
    font-family: var(--font-mono, monospace);
}

@media (max-width: 480px) {
    .shelf-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }
    .shelf-card-placeholder-emoji { font-size: 36px; }
}


/* ─────────────────────────────────────────────────────────────────────
   #38  Blip Reactions
   ──────────────────────────────────────────────────────────────────── */

/* Trigger button — matches .entry-action style */
.entry-action.entry-reaction-btn {
    font-size: 14px;
    line-height: 1;
}

/* Badge row under entry */
.entry-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
}
.entry-reactions:empty { display: none; }

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color, #eee);
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
}
.reaction-badge:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: var(--accent, #444);
}
.reaction-badge .reaction-emoji {
    font-size: 13px;
    line-height: 1;
}

/* Picker popover */
.reaction-picker {
    position: absolute;
    z-index: 100;
    background: var(--bg-paper, #fafaf8);
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 4px;
    display: flex;
    gap: 2px;
    animation: reaction-pop .15s ease-out;
}
@keyframes reaction-pop {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}
.reaction-picker-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 999px;
    font-size: 18px;
    line-height: 1;
    transition: transform .1s ease, background .1s ease;
}
.reaction-picker-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: scale(1.18);
}
.reaction-picker-btn[aria-pressed="true"] {
    background: rgba(255, 215, 0, 0.18);
}
