/* ============================================================
   Mosquito Spray Schedule — spray-schedule.css
   Brand: #005677 primary · black text · white bg · 8px radius
   WCAG 2.1 AA compliant
   ============================================================ */

/* ── Container ─────────────────────────────────────────── */
.mss-schedule {
    width: 100%;
    max-width: 860px;
    margin: 0 auto 2rem auto;
    font-family: inherit;
    font-size: 0.95rem;
    color: #111;
    border: 1px solid #c8d8de;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 86, 119, 0.10);
}

/* ── Desktop column headers ─────────────────────────────── */
.mss-col-headers {
    display: grid;
    grid-template-columns: 1fr 140px;
    background: #005677;
    color: #fff;
}

.mss-col-header {
    padding: 11px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.mss-col-header + .mss-col-header {
    border-left: 1px solid rgba(255,255,255,0.2);
}

/* ── Date group ─────────────────────────────────────────── */
.mss-group {
    border-bottom: 2px solid #c8d8de;
}

.mss-group:last-child {
    border-bottom: none;
}

/* Date header — full width, clearly separates each date group */
.mss-group-header {
    display: block;
    background: #e6f1f6;
    border-bottom: 1px solid #b8cdd5;
    padding: 9px 16px;
}

.mss-group-date {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mss-group-date-text {
    font-weight: 700;
    font-size: 0.92rem;
    color: #003d52;
    letter-spacing: 0.01em;
}

/* "3 locations" pill — quick signal there are multiple entries */
.mss-group-count {
    display: inline-block;
    background: #005677;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.03em;
}

/* ── Entry rows ─────────────────────────────────────────── */
.mss-row {
    display: grid;
    grid-template-columns: 1fr 140px;
    align-items: center;
    border-bottom: 1px solid #edf3f6;
    transition: background 0.12s;
}

.mss-row:last-child {
    border-bottom: none;
}

.mss-row:hover {
    background: #f0f8fb;
}

/* Status accent — left border on each entry row */
.mss-status-scheduled {
    border-left: 4px solid #005677;
}

.mss-status-completed {
    border-left: 4px solid #2e9e68;
}

/* ── Cells ──────────────────────────────────────────────── */
.mss-cell {
    padding: 11px 16px;
}

.mss-col-time {
    border-left: 1px solid #edf3f6;
    display: flex;
    align-items: center;
}

.mss-location {
    font-weight: 500;
    line-height: 1.4;
}

/* ── Time badges ────────────────────────────────────────── */
.mss-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
    white-space: nowrap;
    /* Ensure badge text meets 4.5:1 contrast ratio */
}

.mss-badge-morning {
    background: #fff3cd;
    color: #6b4c00;   /* 7.2:1 on #fff3cd */
    border: 1px solid #e6c84a;
}

.mss-badge-evening {
    background: #fde8d8;
    color: #7a2f00;   /* 7.5:1 on #fde8d8 */
    border: 1px solid #e8884a;
}

.mss-badge-night {
    background: #003d52;
    color: #ffffff;   /* 13:1 on #003d52 */
    border: 1px solid #003d52;
}

.mss-badge-other {
    background: #e8e8e8;
    color: #333;      /* 9.7:1 on #e8e8e8 */
    border: 1px solid #bbb;
}

/* ── Focus styles (keyboard navigation / WCAG 2.4.7) ────── */
.mss-schedule *:focus-visible {
    outline: 3px solid #005677;
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Error / empty states ───────────────────────────────── */
.mss-error,
.mss-empty {
    padding: 24px;
    text-align: center;
    color: #444;
    background: #f7fafb;
}

.mss-error {
    background: #fff5f5;
    color: #7a0000;
}

.mss-admin-debug {
    color: #888;
    font-size: 0.8rem;
    text-align: center;
    padding: 0 16px 12px;
}

/* ============================================================
   RESPONSIVE — ≤ 640px: stacked card layout
   ============================================================ */
@media ( max-width: 640px ) {

    /* Hide desktop column headers — labels appear inline */
    .mss-col-headers {
        display: none;
    }

    /* Each group still has its date header, but entries become cards */
    .mss-group {
        border-bottom: none;
        margin-bottom: 16px;
    }

    .mss-group:last-child {
        margin-bottom: 0;
    }

    /* Date header: slightly larger on mobile for clear separation */
    .mss-group-header {
        border-radius: 8px 8px 0 0;
        padding: 10px 14px;
    }

    .mss-group-date-text {
        font-size: 1rem;
    }

    /* Entry rows become stacked label-value pairs */
    .mss-row {
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid #edf3f6;
        padding: 0;
        /* Keep status accent as left border */
    }

    .mss-row:last-child {
        border-bottom: none;
        border-radius: 0 0 8px 8px;
    }

    .mss-cell {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 14px;
        border-left: none;
    }

    .mss-col-loc {
        border-bottom: 1px solid #edf3f6;
    }

    /* Inline labels */
    .mss-col-loc::before {
        content: "Location";
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #005677;
        min-width: 62px;
        flex-shrink: 0;
    }

    .mss-col-time::before {
        content: "Time";
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #005677;
        min-width: 62px;
        flex-shrink: 0;
    }

    /* Group the group visually as a single card */
    .mss-group-header,
    .mss-row {
        border-left: none !important; /* status accent moves to group level */
    }

    /* Status accent at the group level on mobile */
    .mss-group:has(.mss-status-scheduled) .mss-group-header {
        border-left: 4px solid #005677;
    }

    .mss-group:has(.mss-status-completed) .mss-group-header {
        border-left: 4px solid #2e9e68;
    }

    .mss-schedule {
        border-radius: 8px;
        overflow: visible; /* allow per-group radius */
        border: none;
        box-shadow: none;
    }
}
