/* ===== Dashboard Styles ===== */

/* Greeting */
.dashboard-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.greeting-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 0.2rem;
}

.greeting-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.greeting-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
}

.streak-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 171, 64, 0.12);
    border: 1px solid rgba(255, 171, 64, 0.25);
    border-radius: 99px;
    padding: 0.45rem 1rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--warning);
    white-space: nowrap;
}

/* Section title */
.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ── Insights row ─────────────────────────────────────────────────────────── */
.insights-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
    margin-bottom: 2rem;
}

.insight-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    backdrop-filter: blur(10px);
    transition: transform var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
}

.insight-card.insight-primary::before   { background: var(--accent-primary); }
.insight-card.insight-secondary::before { background: var(--accent-secondary); }
.insight-card.insight-success::before   { background: var(--success); }
.insight-card.insight-warning::before   { background: var(--warning); }
.insight-card.insight-purple::before    { background: #a855f7; }

.insight-card:hover {
    transform: translateY(-2px);
    border-color: rgba(108, 99, 255, 0.3);
}

.insight-icon-wrap {
    font-size: 1.6rem;
    flex-shrink: 0;
    line-height: 1;
}

.insight-value {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
}

.insight-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.insight-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    font-style: italic;
}

/* ── Mastery rings ────────────────────────────────────────────────────────── */
.mastery-rings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.mastery-ring-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
}

.mastery-ring-card:hover {
    border-color: rgba(108, 99, 255, 0.35);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.ring-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
}

.mastery-svg {
    width: 110px;
    height: 110px;
    transform: rotate(-90deg);
}

.ring-track {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 10;
}

.ring-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-fill.color-histoire   { stroke: #ff6b6b; }
.ring-fill.color-geographie { stroke: #4ecdc4; }
.ring-fill.color-mythologie { stroke: #ffd93d; }

.ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-pct {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
}

.ring-emoji {
    font-size: 1rem;
    line-height: 1;
    margin-top: 2px;
}

.ring-cat-name {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.ring-cat-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ring-next-milestone {
    font-size: 0.7rem;
    color: var(--accent-secondary);
    font-weight: 600;
    margin-top: 0.1rem;
}

/* ── Subcategory spotlight ────────────────────────────────────────────────── */
.spotlight-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.spotlight-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition);
}

.spotlight-item:hover {
    border-color: rgba(108, 99, 255, 0.3);
    background: var(--bg-card-hover);
}

.spotlight-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.spotlight-info {
    flex: 1;
    min-width: 0;
}

.spotlight-phrase {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-bar-wrap {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 99px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.spotlight-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s ease;
}

.spotlight-pct {
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 38px;
    text-align: right;
}

.spotlight-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    flex-shrink: 0;
}

.badge-best    { background: rgba(0, 230, 118, 0.12); color: var(--success); border: 1px solid rgba(0,230,118,0.2); }
.badge-close   { background: rgba(0, 210, 255, 0.12); color: var(--accent-secondary); border: 1px solid rgba(0,210,255,0.2); }
.badge-started { background: rgba(108, 99, 255, 0.12); color: var(--accent-primary); border: 1px solid rgba(108,99,255,0.2); }

/* Show more toggle */
.spotlight-toggle {
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    padding: 0.4rem;
    transition: color var(--transition);
    background: none;
    border: none;
    width: 100%;
}

.spotlight-toggle:hover { color: var(--accent-secondary); }

/* ── Bottom grid ──────────────────────────────────────────────────────────── */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.due-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.due-badge {
    background: var(--accent-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    min-width: 24px;
    text-align: center;
}

/* ── Daily goal card ──────────────────────────────────────────────────────── */
.daily-goal-card {
    padding: 1.25rem 1.5rem;
}

.daily-goal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.daily-goal-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.daily-goal-insight {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.daily-goal-count {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-secondary);
    white-space: nowrap;
}

/* ── Activity chart (enhanced) ────────────────────────────────────────────── */
.activity-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.4rem;
    height: 100px;
    padding-bottom: 1.6rem;
    position: relative;
}

.activity-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    gap: 0;
    position: relative;
}

.activity-bar {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.activity-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--accent-primary) 0%, rgba(108,99,255,0.4) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 3px;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.activity-bar-fill.today {
    background: linear-gradient(180deg, var(--accent-secondary) 0%, rgba(0,210,255,0.4) 100%);
}

.activity-label {
    position: absolute;
    bottom: -1.4rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.activity-value {
    position: absolute;
    top: -1.2rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    display: none;
}

.activity-bar-wrapper:hover .activity-value { display: block; }

/* ── Streak Warning Banner ────────────────────────────────────────────────── */
.streak-warning-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 171, 64, 0.08);
    border: 1px solid rgba(255, 171, 64, 0.35);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    animation: warning-pulse-border 2s ease-in-out infinite;
}

@keyframes warning-pulse-border {
    0%, 100% { border-color: rgba(255, 171, 64, 0.35); box-shadow: none; }
    50%       { border-color: rgba(255, 171, 64, 0.65); box-shadow: 0 0 12px rgba(255,171,64,0.15); }
}

.streak-warning-icon {
    font-size: 2rem;
    flex-shrink: 0;
    animation: fire-shake 1.2s ease-in-out infinite;
}

@keyframes fire-shake {
    0%, 100% { transform: rotate(-6deg) scale(1); }
    30%       { transform: rotate(6deg) scale(1.12); }
    60%       { transform: rotate(-4deg) scale(1.06); }
    80%       { transform: rotate(4deg) scale(1.1); }
}

.streak-warning-body {
    flex: 1;
    min-width: 0;
}

.streak-warning-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--warning);
}

.streak-warning-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.streak-warning-btn {
    flex-shrink: 0;
    background: var(--warning) !important;
    color: #1a1a2e !important;
    font-weight: 700;
    border: none !important;
    padding: 0.45rem 1rem;
    white-space: nowrap;
}

/* ── Streak & Habitudes Card ──────────────────────────────────────────────── */
.streak-habits-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    backdrop-filter: blur(10px);
}

.sh-divider {
    width: 1px;
    background: var(--glass-border);
    align-self: stretch;
    flex-shrink: 0;
}

/* Streak counter */
.sh-streak-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-width: 90px;
    flex-shrink: 0;
}

.sh-fire {
    font-size: 2.4rem;
    line-height: 1;
    animation: fire-glow 2.5s ease-in-out infinite;
}

@keyframes fire-glow {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(255,171,64,0.3)); transform: scale(1); }
    50%       { filter: drop-shadow(0 0 14px rgba(255,171,64,0.65)); transform: scale(1.1); }
}

.sh-fire.no-streak {
    filter: grayscale(1);
    opacity: 0.35;
    animation: none;
}

.sh-streak-num {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    color: var(--warning);
    letter-spacing: -2px;
}

.sh-streak-num.no-streak { color: var(--text-muted); }

.sh-streak-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

.sh-record {
    font-size: 0.68rem;
    color: var(--accent-secondary);
    font-weight: 600;
    margin-top: 0.3rem;
    text-align: center;
}

/* Daily goal ring */
.sh-goal-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.sh-goal-ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 0.5rem;
}

.sh-goal-svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.sh-ring-track {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8;
}

.sh-ring-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    stroke: var(--accent-primary);
    transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s;
}

.sh-ring-fill.goal-done { stroke: var(--success); }

.sh-goal-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.sh-goal-done {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
}

.sh-goal-target {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.sh-goal-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
}

.sh-goal-status.done { color: var(--success); }

/* Week habit dots */
.sh-habits-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.sh-week-dots {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
}

.sh-week-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(255,255,255,0.09);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition);
}

.sh-week-dot.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.sh-week-dot.active.today {
    background: var(--success);
    border-color: var(--success);
}

.sh-week-dot.today:not(.active) {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.sh-week-labels {
    display: flex;
    gap: 0.35rem;
}

.sh-week-lbl {
    width: 30px;
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.sh-week-lbl.today {
    color: var(--accent-secondary);
    font-weight: 700;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .mastery-rings-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .streak-habits-card {
        flex-direction: column;
        gap: 1.25rem;
        align-items: stretch;
    }
    .sh-divider {
        width: 100%;
        height: 1px;
    }
    .sh-streak-section {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        min-width: unset;
    }
    .sh-streak-lbl, .sh-record { text-align: left; }
    .sh-streak-num { font-size: 2.5rem; }
    .sh-fire { font-size: 2rem; }
}

@media (max-width: 640px) {
    .mastery-rings-grid {
        grid-template-columns: 1fr;
    }
    .insights-row {
        grid-template-columns: 1fr 1fr;
    }
    .greeting-title { font-size: 1.3rem; }
    .streak-warning-banner {
        flex-wrap: wrap;
    }
    .streak-warning-btn { width: 100%; text-align: center; }
}
