/* === Spec page === */
.spec-doc {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.spec-doc h1 { border-bottom: 3px solid var(--pico-primary); padding-bottom: 0.5rem; margin-bottom: 1.5rem; }
.spec-doc h2 { margin-top: 2.5rem; border-bottom: 1px solid var(--pico-muted-border-color); padding-bottom: 0.3rem; }
.spec-doc h3 { margin-top: 1.8rem; }
.spec-doc blockquote { border-left: 4px solid var(--pico-primary); padding: 0.5rem 1rem; margin: 1rem 0; background: var(--pico-card-background-color); border-radius: 0 8px 8px 0; }
.spec-doc table { font-size: 0.9rem; margin: 1rem 0; }
.spec-doc code { font-size: 0.85rem; }
.spec-doc pre { padding: 1rem; border-radius: 8px; overflow-x: auto; }

/* === Theme variables === */
:root, [data-theme="dark"] {
    --t-bg: #11151c;
    --t-surface: #1a2030;
    --t-text: #d1d5db;
    --t-text-muted: #7a8394;
    --t-border: #2a3140;
    --t-hover: #222838;
    --t-stripe: rgba(255,255,255,0.025);
    --t-card-shadow: 0 2px 8px rgba(0,0,0,0.2);
    --t-usage-bg: rgba(99,140,255,0.08);
}

[data-theme="light"] {
    --t-bg: #f4f5f7;
    --t-surface: #ffffff;
    --t-text: #1f2937;
    --t-text-muted: #6b7280;
    --t-border: #dfe3e8;
    --t-hover: #f0f1f3;
    --t-stripe: rgba(0,0,0,0.02);
    --t-card-shadow: 0 1px 4px rgba(0,0,0,0.06);
    --t-usage-bg: rgba(37,99,235,0.06);
}

/* === Dashboard === */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.header-row h1 { margin: 0; font-size: 1.6rem; }
.header-actions { display: flex; gap: 0.5rem; align-items: center; }
.header-actions button,
.header-actions a { margin: 0; padding: 0.4rem 1rem; font-size: 0.9rem; }

/* Collect info */
.collect-info {
    font-size: 0.75rem;
    color: var(--t-text-muted);
    margin-top: 0.4rem;
}
.collect-info strong { color: var(--t-text); font-weight: 500; }

/* Status bar */
.status-bar {
    margin-top: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--t-surface);
    border-radius: 8px;
    border: 1px solid var(--t-border);
}
.status-text { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; }
.status-sources { font-size: 0.85rem; margin-bottom: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.status-bar progress { margin: 0; height: 6px; }

/* Filters */
.filters {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--t-border);
}
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--t-text-muted); margin: 0; }
.filter-group select { margin: 0; padding: 0.3rem 0.6rem; font-size: 0.85rem; min-width: 100px; }

.filter-inline-row { display: contents; }
.filter-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.filter-tabs button {
    margin: 0;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 20px;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    color: var(--t-text);
    cursor: pointer;
}
.filter-tabs button.active {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}
.filter-tabs button:hover:not(.active) {
    background: var(--t-hover);
}
.filter-sep {
    color: var(--t-border);
    font-size: 0.9rem;
    line-height: 2;
    user-select: none;
}
.minor-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    margin: 0;
}
.minor-toggle input { margin: 0; width: auto; }

/* Updates list */
.updates-list { margin-bottom: 2rem; }
.date-group { margin-bottom: 1.5rem; }
.date-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--t-text-muted);
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--t-border);
}
.empty-state {
    text-align: center;
    color: var(--t-text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
}

/* Update card */
.update-card {
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--card-color, var(--t-border));
    background: var(--t-surface);
    color: var(--t-text);
    transition: box-shadow 0.15s;
}
.update-card:hover {
    box-shadow: var(--t-card-shadow);
}
.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}
.card-source {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--t-text-muted);
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}
.card-title a {
    color: var(--t-text);
    text-decoration: none;
}
.card-title a:hover { text-decoration: underline; }
.card-summary {
    font-size: 0.85rem;
    color: var(--t-text-muted);
    margin: 0.2rem 0;
    line-height: 1.4;
}
.card-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--t-text-muted);
}

/* Badges — theme-aware */
.badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

[data-theme="light"] .badge { background: #e5e7eb; color: #374151; }
[data-theme="light"] .badge-model_release { background: #dcfce7; color: #166534; }
[data-theme="light"] .badge-api_change { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .badge-feature { background: #fef3c7; color: #92400e; }
[data-theme="light"] .badge-pricing { background: #fce7f3; color: #9d174d; }
[data-theme="light"] .badge-tool { background: #ede9fe; color: #5b21b6; }

[data-theme="dark"] .badge { background: #374151; color: #d1d5db; }
[data-theme="dark"] .badge-model_release { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-api_change { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-feature { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-pricing { background: #831843; color: #f9a8d4; }
[data-theme="dark"] .badge-tool { background: #3b0764; color: #c4b5fd; }

/* Easy comment */
.card-easy {
    font-size: 0.84rem;
    color: var(--t-text);
    margin: 0.3rem 0 0.1rem;
    line-height: 1.4;
    opacity: 0.85;
}

/* Usage hint */
.card-usage {
    font-size: 0.82rem;
    color: var(--t-text);
    background: var(--t-usage-bg);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    margin: 0.4rem 0 0.2rem;
    font-family: monospace, monospace;
    line-height: 1.5;
}

/* Heat badge */
.heat-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.3;
}
.heat-1 { opacity: 0.5; }
.heat-2 { opacity: 0.7; }
.heat-3 { opacity: 0.85; }
[data-theme="dark"] .heat-4 { background: #7c2d12; color: #fdba74; }
[data-theme="dark"] .heat-5 { background: #991b1b; color: #fca5a5; }
[data-theme="light"] .heat-4 { background: #fed7aa; color: #9a3412; }
[data-theme="light"] .heat-5 { background: #fecaca; color: #991b1b; }
.list-row .heat-badge { font-size: 0.6rem; flex-shrink: 0; }

/* Like button */
.like-btn {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    margin: 0;
    background: none;
    border: 1px solid var(--t-border);
    color: var(--t-text-muted);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}
.like-btn:hover { border-color: #ef4444; color: #ef4444; }
.like-btn.liked { border-color: #ef4444; color: #ef4444; }
.like-btn:disabled { opacity: 0.5; cursor: wait; }
.like-count { font-size: 0.68rem; font-weight: 600; }
.list-row .like-btn { padding: 0.05rem 0.3rem; font-size: 0.65rem; flex-shrink: 0; }

/* Video finder button */
.yt-btn {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    margin: 0 0 0 auto;
    background: none;
    border: 1px solid var(--t-border);
    color: var(--t-text-muted);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
.yt-btn:hover { border-color: var(--pico-primary); color: var(--pico-primary); }
.yt-btn:disabled { opacity: 0.5; cursor: wait; }

/* Video results */
.video-results {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--t-border);
}
.video-loading, .video-empty {
    font-size: 0.8rem;
    color: var(--t-text-muted);
    padding: 0.3rem 0;
}
.video-item {
    padding: 0.3rem 0;
}
.video-item + .video-item {
    border-top: 1px solid var(--t-border);
}
.video-title {
    font-size: 0.82rem;
    text-decoration: none;
    font-weight: 500;
}
[data-theme="dark"] .video-title { color: #f87171; }
[data-theme="light"] .video-title { color: #dc2626; }
.video-title:hover { text-decoration: underline; }
.video-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--t-text-muted);
    margin-top: 0.1rem;
}
.video-channel { font-weight: 500; }
.video-note {
    font-size: 0.75rem;
    color: var(--t-text);
    opacity: 0.8;
    margin-top: 0.1rem;
}

/* Reactions */
.card-reactions { margin-top: 0.4rem; }
.reaction {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--t-text-muted);
    padding: 0.15rem 0;
}
.reaction a { color: var(--t-text-muted); text-decoration: none; }
.reaction a:hover { text-decoration: underline; color: var(--pico-primary); }
.reaction-score { font-weight: 600; }

/* Source colors */
.source-anthropic { --card-color: #7c3aed; }
.source-openai { --card-color: #10b981; }
.source-google { --card-color: #3b82f6; }
.source-meta { --card-color: #0ea5e9; }
.source-mistral { --card-color: #f97316; }
.source-xai { --card-color: #6b7280; }
.source-cursor { --card-color: #0ea5e9; }
.source-claude-code { --card-color: #d946ef; }
.source-openai-codex { --card-color: #22c55e; }
.source-mcp { --card-color: #8b5cf6; }
.source-mcp-servers { --card-color: #8b5cf6; }
.source-anthropic-sdk { --card-color: #a78bfa; }
.source-openai-sdk { --card-color: #34d399; }
.source-llama { --card-color: #fb923c; }
.source-vscode { --card-color: #007acc; }
.source-github-copilot { --card-color: #6e40c9; }

/* View toggle */
.view-btns { display: flex; gap: 0.3rem; }
.view-btn {
    margin: 0; padding: 0.35rem 0.7rem;
    font-size: 0.8rem; line-height: 1.2;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: 6px; cursor: pointer;
    color: var(--t-text-muted);
    white-space: nowrap;
    transition: all 0.15s;
}
.view-btn:hover {
    border-color: var(--pico-primary);
    color: var(--t-text);
}
.view-btn.active {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}

/* List view */
.list-rows { display: flex; flex-direction: column; }
.list-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-left: 3px solid var(--card-color, var(--t-border));
    font-size: 0.82rem;
    line-height: 1.4;
}
.list-row:nth-child(odd) { background: var(--t-stripe); }
.list-row:hover { background: var(--t-hover); }
.row-date {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--t-text-muted);
    min-width: 2.5rem;
    font-weight: 600;
}
.row-source { flex-shrink: 0; font-size: 0.8rem; }
.row-cat { flex-shrink: 0; min-width: 4rem; text-align: center; font-size: 0.65rem; padding: 0.05rem 0.3rem; }
.row-title {
    flex: 1;
    color: var(--t-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.row-title:hover { text-decoration: underline; }
.row-hint {
    flex-shrink: 1;
    color: var(--t-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30%;
}
.row-age {
    flex-shrink: 0;
    color: var(--t-text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
}
.list-row .yt-btn { padding: 0.05rem 0.3rem; font-size: 0.65rem; flex-shrink: 0; }

/* Theme toggle */
.theme-toggle {
    margin: 0;
    padding: 0.3rem 0.5rem;
    font-size: 1.1rem;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--pico-primary); }

/* Custom tooltip — JS positioned, fixed to viewport */
.tip-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    min-width: 240px;
    max-width: 360px;
    padding: 0.5rem 0.7rem;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--t-text);
    white-space: normal;
    word-break: break-word;
    pointer-events: none;
}
.tip-popup.show { display: block; }
.tip-title { font-weight: 600; margin-bottom: 0.2rem; }
.tip-easy { color: var(--t-text-muted); }
.tip-hint { font-family: monospace, monospace; font-size: 0.75rem; color: var(--t-text-muted); }

/* List row title wrapper */
.list-row .tip-wrap {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.list-row .tip-wrap .row-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .tip-popup { min-width: 200px; max-width: 280px; font-size: 0.75rem; }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.6rem 1.5rem;
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: opacity 0.3s;
}
.toast.fade-out { opacity: 0; }

@media (max-width: 768px) {
    .header-row { flex-direction: column; align-items: flex-start; }
    .header-actions { flex-wrap: wrap; }

    .filters {
        flex-direction: column;
        gap: 0.6rem;
        padding-bottom: 0.8rem;
        margin-bottom: 1rem;
    }
    .filter-group { width: 100%; }
    .filter-group select { width: 100%; }

    /* 소스 탭: 가로 스크롤 */
    .filter-tabs {
        gap: 0.2rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.2rem;
        flex-wrap: nowrap;
    }
    .filter-tabs::-webkit-scrollbar { display: none; }
    .filter-tabs button { flex-shrink: 0; }

    /* 기간/분류를 나란히 */
    .filter-inline-row {
        display: flex;
        gap: 0.5rem;
    }
    .filter-inline-row .filter-group { flex: 1; }

    /* 마이너 토글 + 뷰 버튼 한 줄 */
    .minor-toggle { font-size: 0.8rem; }
    .filter-group.view-toggle { width: auto; }

    /* 리스트 뷰 모바일 */
    .list-row { font-size: 0.75rem; gap: 0.3rem; padding: 0.25rem 0.4rem; }
    .row-hint { display: none; }
    .row-date { min-width: 2rem; font-size: 0.65rem; }
    .row-source { font-size: 0.7rem; }
    .row-cat { font-size: 0.6rem; min-width: 3rem; }

    /* 카드 뷰 모바일 */
    .update-card { padding: 0.6rem 0.8rem; }
    .card-title { font-size: 0.88rem; }
    .card-summary { font-size: 0.8rem; }
}
