/*
 * Daily Challenge card in the practice-page sidebar (js/components/sidebar.js, logic in js/daily-challenge.js).
 * Uses the sidebar's own tokens (--dash-*), so light and dark mode follow the rest of the page.
 * The sidebar is only ~200px wide, so everything here is compact. The card is deliberately NOT a .dash-card:
 * on phones the sidebar becomes a popover and strips .dash-card borders, and this card keeps its own look.
 */

.daily-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    /* Extra clear space above the card (on top of the column's own gap) so the button is never
       tapped by accident when someone aims at the ad above it. */
    margin-top: 12px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.02));
}

/* display:flex above would otherwise override the hidden attribute until the day's problem is filled in */
.daily-card[hidden] {
    display: none;
}

.daily-eyebrow {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dash-muted);
}

.daily-eyebrow i {
    margin-right: 5px;
    color: var(--dash-warning, #f59e0b);
}

.daily-title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dash-text);
}

.daily-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.daily-tag {
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
}

.daily-diff-easy {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
}

.daily-diff-medium {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
}

.daily-diff-hard {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}

.daily-cat {
    color: #14b8a6;
    background: rgba(20, 184, 166, 0.12);
    border-color: rgba(20, 184, 166, 0.3);
}

.daily-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--dash-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.daily-btn:hover {
    opacity: 0.9;
}

.daily-btn:focus-visible {
    outline: 2px solid var(--dash-accent);
    outline-offset: 2px;
}

.daily-btn i {
    font-size: 0.73rem;
}

/* Solved today: the button turns green and the card calms down */
.daily-done .daily-btn {
    background: var(--dash-success, #10b981);
}

@media (prefers-reduced-motion: reduce) {
    .daily-btn {
        transition: none;
    }
}

/* ── Daily Challenge card on the home page ──
   The card is styled with the practice pages' --dash-* colours, which the home page does not define, so map them to
   the home page's own colours inside the slot. The slot sits above the topic cards, centred, and is empty (takes no
   room) until the card has a problem to show. */
.home-daily-slot {
    --dash-accent: var(--primary);
    --dash-text: var(--text-main);
    --dash-muted: var(--text-muted);
    --dash-border: var(--border);
    --dash-warning: #f59e0b;
    width: 100%;
    max-width: none;   /* as wide as the topic grid below it (the section caps that at 1100px) */
    margin: 0 0 24px;
    box-sizing: border-box;
}

.home-daily-slot:empty {
    display: none;
}

.home-daily-slot .daily-card {
    margin-top: 0;
    padding: 16px 18px;
    gap: 10px;
}

.home-daily-slot .daily-title {
    font-size: 1.05rem;
}

.home-daily-slot .daily-eyebrow {
    font-size: 0.72rem;
}

/* Tablet and desktop: one wide row. Eyebrow, title and tags on the left, the Solve button on the right. */
@media (min-width: 769px) {
    .home-daily-slot .daily-card {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "eyebrow btn"
            "title   btn"
            "tags    btn";
        column-gap: 28px;
        row-gap: 6px;
        align-items: center;
        padding: 18px 24px;
    }
    .home-daily-slot .daily-card[hidden] {
        display: none;
    }
    .home-daily-slot .daily-eyebrow { grid-area: eyebrow; }
    .home-daily-slot .daily-title   { grid-area: title; font-size: 1.15rem; }
    .home-daily-slot .daily-tags    { grid-area: tags; }
    .home-daily-slot .daily-tag     { font-size: 0.65rem; }
    .home-daily-slot .daily-btn {
        grid-area: btn;
        gap: 14px;
        padding: 12px 24px;
        border-radius: 8px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
}

/* ── Practice pages, wide screens: the Daily Challenge card goes to the TOP of the right column ──
   The column is a flex column, so "order: -1" puts the card above the ad without touching the ad's markup or script.
   The extra space below the card keeps the Solve button well clear of the ad, so it is not tapped by mistake. */
.sidebar-right > .daily-card {
    order: -1;
    margin-top: 0;
    margin-bottom: 28px;
}
