/* ════════════════════════════════════════════════
   Dashboard
   ════════════════════════════════════════════════ */

/* ════════════════════════════════════════ DASHBOARD ═════ */

/* Nav button */
.dashboard-nav-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #ccc; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.dashboard-nav-btn:hover {
    background: rgba(139,92,246,0.18);
    border-color: rgba(139,92,246,0.35);
    color: #c4b5fd;
}

/* Page shell */
.db-page {
    position: fixed; inset: 0; z-index: 500;
    background: #08081a;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,92,246,0.3) transparent;
}
.db-page.hidden { display: none !important; }
.db-inner {
    max-width: 1000px; margin: 0 auto;
    padding: 0 20px 60px;
}

/* Header */
.db-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 28px 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 28px;
    position: relative;
}
.db-header-center {
    position: absolute;
    left: 50%; transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
}
.db-title  { font-size: 24px; font-weight: 800; color: #f1f1f1; margin: 0; }
.db-date   { font-size: 12px; color: #555; margin: 3px 0 0; }
.db-header-right { flex-shrink: 0; }
.db-badges-shortcut {
    padding: 7px 14px; border-radius: 10px;
    border: 1px solid rgba(139,92,246,0.25);
    background: rgba(139,92,246,0.08);
    color: #a78bfa; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.18s;
}
.db-badges-shortcut:hover { background: rgba(139,92,246,0.18); }

/* Stat grid */
.db-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px; margin-bottom: 24px;
}
.db-stat-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    padding: 18px 14px;
    display: flex; align-items: center; gap: 12px;
    transition: all 0.18s;
    border-top: 2px solid var(--card-accent, #8b5cf6);
}
.db-stat-card:hover {
    background: rgba(255,255,255,0.07);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.db-sc-icon   { font-size: 28px; flex-shrink: 0; }
.db-sc-value  { font-size: 22px; font-weight: 800; color: #f1f1f1; line-height: 1; }
.db-sc-label  { font-size: 12px; color: #aaa; margin-top: 3px; }
.db-sc-sub    { font-size: 10px; color: #555; }

/* Card base */
.db-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 20px; padding: 20px;
    margin-bottom: 20px;
}
.db-card-title {
    font-size: 14px; font-weight: 700; color: #888;
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 16px;
}

/* Mid row */
.db-mid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px; margin-bottom: 0;
}
@media (max-width: 680px) { .db-mid-row { grid-template-columns: 1fr; } }

/* Streak nums */
.db-streak-nums {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px;
}
.db-sn-item  { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.db-sn-val   { font-size: 32px; font-weight: 900; line-height: 1; }
.db-sn-lbl   { font-size: 11px; color: #666; }
.db-sn-sep   { width: 1px; height: 48px; background: rgba(255,255,255,0.08); flex-shrink: 0; }

/* 28-day calendar grid */
.db-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}
.db-cal-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: column;
    align-items: center; justify-content: flex-end;
    padding-bottom: 3px;
    transition: transform 0.12s;
    cursor: default;
}
.db-cal-dow  { font-size: 8px; color: #444; }
.db-cal-cell:hover { transform: scale(1.15); }
.db-cal-active {
    background: rgba(139,92,246,0.35);
    border-color: rgba(139,92,246,0.5);
}
.db-cal-active .db-cal-dow { color: #c4b5fd; }
.db-cal-today {
    outline: 2px solid #f59e0b;
    outline-offset: 1px;
}

/* Quiz chart */
.db-quiz-chart { display: flex; flex-direction: column; gap: 8px; }
.db-qbar-wrap  { display: flex; align-items: center; gap: 10px; }
.db-qbar-track {
    flex: 1; height: 12px; border-radius: 99px;
    background: rgba(255,255,255,0.06); overflow: hidden;
}
.db-qbar-fill  { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.db-qbar-label { font-size: 11px; color: #888; width: 30px; text-align: right; flex-shrink: 0; }
.db-quiz-avg   { font-size: 12px; color: #666; margin-top: 12px; }

/* Video list */
.db-video-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer; transition: all 0.15s;
    border-radius: 10px; padding: 10px;
}
.db-video-item:last-child { border-bottom: none; }
.db-video-item:hover { background: rgba(255,255,255,0.04); }
.db-vid-thumb  {
    width: 80px; height: 52px; object-fit: cover;
    border-radius: 8px; flex-shrink: 0;
    background: rgba(255,255,255,0.05);
}
.db-vid-meta   { flex: 1; min-width: 0; }
.db-vid-title  {
    font-size: 13px; font-weight: 600; color: #e2e8f0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 5px;
}
.db-vid-info   { display: flex; gap: 10px; flex-wrap: wrap; }
.db-vid-info span { font-size: 11px; color: #555; }
.db-quiz-tag   { color: #10b981 !important; font-weight: 600; }
.db-vid-arrow  { font-size: 22px; color: #444; flex-shrink: 0; }
.db-video-item:hover .db-vid-arrow { color: #8b5cf6; }

/* Badge category rows */
.db-badge-cats  { display: flex; flex-direction: column; gap: 18px; }
.db-bcat-row    { display: flex; flex-direction: column; gap: 6px; }
.db-bcat-head   { display: flex; justify-content: space-between; align-items: center; }
.db-bcat-name   { font-size: 13px; font-weight: 600; color: #ccc; }
.db-bcat-count  { font-size: 12px; color: #666; }
.db-bcat-icons  { display: flex; gap: 6px; }
.db-bcat-icon   { font-size: 20px; transition: transform 0.12s; }
.db-bcat-icon.locked { opacity: 0.25; filter: saturate(0.1); }
.db-bcat-icon.earned { }
.db-bcat-icon.earned:hover { transform: scale(1.2); }
.db-bcat-track  {
    height: 6px; border-radius: 99px;
    background: rgba(255,255,255,0.06); overflow: hidden;
}
.db-bcat-fill   {
    height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    transition: width 0.6s ease;
}

/* Empty state */
.db-empty {
    color: #444; font-size: 13px; text-align: center;
    padding: 20px 0; font-style: italic;
}

/* ── Light mode overrides ── */
html.light-mode .db-page               { background: #eef0ff; }
html.light-mode .db-page.hidden        { display: none !important; }
html.light-mode .db-title              { color: #1e1b4b; }
html.light-mode .db-date               { color: #9ca3af; }
html.light-mode .db-header             { border-bottom-color: rgba(0,0,0,0.08); }
html.light-mode .db-stat-card          { background: rgba(255,255,255,0.8); border-color: rgba(0,0,0,0.07); }
html.light-mode .db-sc-value           { color: #1e1b4b; }
html.light-mode .db-sc-label           { color: #6b7280; }
html.light-mode .db-sc-sub             { color: #9ca3af; }
html.light-mode .db-card               { background: rgba(255,255,255,0.75); border-color: rgba(0,0,0,0.07); }
html.light-mode .db-card-title         { color: #9ca3af; }
html.light-mode .db-sn-lbl             { color: #9ca3af; }
html.light-mode .db-sn-sep             { background: rgba(0,0,0,0.08); }
html.light-mode .db-cal-cell           { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.06); }
html.light-mode .db-cal-active         { background: rgba(109,40,217,0.2); border-color: rgba(109,40,217,0.35); }
html.light-mode .db-cal-active .db-cal-dow { color: #6d28d9; }
html.light-mode .db-cal-dow            { color: #bbb; }
html.light-mode .db-qbar-track         { background: rgba(0,0,0,0.07); }
html.light-mode .db-qbar-label         { color: #9ca3af; }
html.light-mode .db-quiz-avg           { color: #9ca3af; }
html.light-mode .db-video-item:hover   { background: rgba(0,0,0,0.03); }
html.light-mode .db-vid-title          { color: #1e1b4b; }
html.light-mode .db-vid-info span      { color: #9ca3af; }
html.light-mode .db-vid-arrow          { color: #bbb; }
html.light-mode .db-bcat-name          { color: #374151; }
html.light-mode .db-bcat-count         { color: #9ca3af; }
html.light-mode .db-bcat-track         { background: rgba(0,0,0,0.07); }
html.light-mode .db-empty              { color: #bbb; }
html.light-mode .dashboard-nav-btn     { border-color: rgba(0,0,0,0.12); background: rgba(0,0,0,0.05); color: #4b5563; }
html.light-mode .dashboard-nav-btn:hover { background: rgba(109,40,217,0.08); color: #6d28d9; }
html.light-mode .db-badges-shortcut    { background: rgba(109,40,217,0.07); border-color: rgba(109,40,217,0.18); color: #7c3aed; }

/* ── Pomodoro Focus Card ── */
.db-pomo-panel { }
.db-pomo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
@media (max-width: 480px) { .db-pomo-grid { grid-template-columns: repeat(2, 1fr); } }

.db-pomo-stat-item {
    text-align: center;
    padding: 12px 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: all 0.15s;
}
.db-pomo-stat-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}
.db-pomo-stat-icon { font-size: 18px; margin-bottom: 4px; }
.db-pomo-stat-val {
    font-size: 20px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.2;
}
.db-pomo-stat-lbl {
    font-size: 10px;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}
.db-pomo-msg {
    font-size: 12px;
    color: #a78bfa;
    text-align: center;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 10px;
    margin-bottom: 12px;
}
.db-pomo-tomatoes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    padding: 6px 0;
}
.db-pomo-tomato {
    font-size: 16px;
    display: inline-block;
    animation: pomoTomatoPop 0.3s ease backwards;
}
@keyframes pomoTomatoPop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.db-pomo-more {
    font-size: 11px;
    color: var(--text-muted, #64748b);
    align-self: center;
    font-weight: 600;
}
.db-pomo-empty {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-muted, #64748b);
    font-size: 13px;
}
.db-pomo-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}
.db-pomo-empty-hint {
    font-size: 11px;
    color: #555;
    margin-top: 4px;
}

/* Light mode */
html.light-mode .db-pomo-stat-item {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
html.light-mode .db-pomo-msg {
    background: rgba(109, 40, 217, 0.06);
    border-color: rgba(109, 40, 217, 0.12);
    color: #7c3aed;
}

/* ── Card Error Boundary ── */
.db-card-error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
}
.db-card-error-icon {
    font-size: 24px;
    flex-shrink: 0;
}
.db-card-error-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.db-card-error-text span {
    font-size: 13px;
    font-weight: 600;
    color: #fca5a5;
}
.db-card-error-text small {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-card-error-retry {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.db-card-error-retry:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Light mode */
html.light-mode .db-card-error {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.12);
}
html.light-mode .db-card-error-text span { color: #dc2626; }
html.light-mode .db-card-error-text small { color: #9ca3af; }
html.light-mode .db-card-error-retry {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

/* ── Skeleton shimmer ── */
.db-skel {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.08) 40%,
        rgba(255, 255, 255, 0.04) 80%
    );
    background-size: 200% 100%;
    animation: dbSkelShimmer 1.5s ease-in-out infinite;
}
@keyframes dbSkelShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Light mode */
html.light-mode .db-skel {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.09) 40%,
        rgba(0, 0, 0, 0.05) 80%
    );
    background-size: 200% 100%;
    animation: dbSkelShimmer 1.5s ease-in-out infinite;
}


/* ════════════════════════════════════════════════
   Dashboard - Mobile Responsive
   ════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .db-inner { padding: 0 12px 40px; }
    .db-header {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 20px 0 16px;
    }
    .db-header-center {
        position: static;
        transform: none;
        order: -1;
    }
    .db-title { font-size: 20px; }
    .db-header-left { order: 0; }
    .db-header-right { order: 1; }
    .db-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (max-width: 480px) {
    .db-header { padding: 14px 0 12px; margin-bottom: 16px; }
    .db-title { font-size: 18px; }
    .db-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .db-stat-card { padding: 12px 10px; gap: 8px; }
    .db-stat-num { font-size: 22px; }
}

/* Light mode */
.light-mode .db-page { background: #f8fafc; }
.light-mode .db-title { color: #1e293b; }
.light-mode .db-date { color: #94a3b8; }
.light-mode .db-stat-card { background: rgba(255,255,255,0.8); border-color: rgba(0,0,0,0.06); }
.light-mode .db-header { border-bottom-color: rgba(0,0,0,0.06); }

/* ════════════════════════════════════════ CONTINUE LEARNING ═════ */
.db-continue-panel {
    margin-bottom: 16px;
}

.db-continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.db-cont-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.18s;
}
.db-cont-item:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateY(-1px);
}

.db-cont-thumb-wrap {
    position: relative;
    flex-shrink: 0;
    width: 72px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}
.db-cont-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.db-cont-pct-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 5px;
}

.db-cont-body {
    flex: 1;
    min-width: 0;
}
.db-cont-title {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}
.db-cont-progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 4px;
}
.db-cont-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 99px;
}
.db-cont-sub {
    font-size: 11px;
    color: #64748b;
}
.db-cont-arrow {
    flex-shrink: 0;
    color: #8b5cf6;
    font-size: 18px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.18s;
}
.db-cont-item:hover .db-cont-arrow {
    opacity: 1;
}

/* SRS due tile variant */
.db-cont-srs {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
    border-color: rgba(245, 158, 11, 0.25);
}
.db-cont-srs:hover {
    border-color: rgba(245, 158, 11, 0.45);
}
.db-cont-srs-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 10px;
}
