/* ─────────────────────────────────────────────────────────────────────────────
   Home dashboard (/) — flat widget vocabulary (2026-09-25)

   Every dashboard widget (Components/Widgets/*.razor) renders inside
   `.home-container` (Home.razor) and builds from these `.hd-*` blocks instead of
   carrying its own copy of the old glass "bubble" CSS. Flat: solid surfaces,
   hairline borders, no gradients / blur / drop shadows / lifts. A widget is a
   titled SECTION (no wrapper card); its items are the only containers.

     .hd-section             one widget
     .hd-head                h2 + .hd-count pill left, .hd-link right
     .hd-grid                auto-fill grid of item cards
     .hd-item                clickable card: .hd-when | .hd-body | .hd-status
       .hd-title / .hd-sub / .hd-meta
       .hd-foot              full-width strip under an item (Qubica pending)
     .hd-empty               empty state: plain icon, text, optional .hd-btn
     .hd-btn(.primary)       pill button
     .hd-skel / .hd-bar      skeleton rows while the widget loads
     .hd-week / .hd-day      Upcoming Events week calendar
   ───────────────────────────────────────────────────────────────────────────── */

.home-container {
    --hd-border: var(--surface-border, rgba(0, 0, 0, 0.1));
    --hd-border-strong: rgba(0, 0, 0, 0.22);
    --hd-divider: rgba(0, 0, 0, 0.07);
    --hd-hover: rgba(0, 0, 0, 0.025);
    --hd-radius: 0.75rem;
}
[data-theme="dark"] .home-container {
    --hd-border: rgba(255, 255, 255, 0.1);
    --hd-border-strong: rgba(255, 255, 255, 0.24);
    --hd-divider: rgba(255, 255, 255, 0.07);
    --hd-hover: rgba(255, 255, 255, 0.03);
}

/* ═══ Section + head ═══════════════════════════════════════════════════════ */

.hd-section {
    margin-bottom: 1.5rem;
}

.hd-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.85rem;
}
.hd-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-heading);
}
.hd-head .hd-sub-head {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.hd-head .hd-link {
    margin-left: auto;
}

.hd-count {
    display: inline-flex;
    align-items: center;
    min-width: 1.5rem;
    justify-content: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: rgba(var(--brand-primary-rgb, 3, 102, 214), 0.12);
    color: var(--brand-primary);
}

.hd-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-primary);
    text-decoration: none;
}
.hd-link:hover {
    text-decoration: underline;
    color: var(--brand-primary);
}

/* ═══ Pill buttons ═════════════════════════════════════════════════════════ */

.hd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0.3rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--hd-border);
    background: var(--surface-card, #fff);
    color: var(--text-heading);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.hd-btn:hover {
    background: var(--hd-hover);
    border-color: var(--hd-border-strong);
    color: var(--text-heading);
    text-decoration: none;
}
.hd-btn.primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}
.hd-btn.primary:hover {
    filter: brightness(0.94);
    color: #fff;
}
.hd-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* ═══ Item cards ═══════════════════════════════════════════════════════════ */

.hd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.75rem;
}

.hd-item {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    background: var(--surface-card, #fff);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
a.hd-item:hover,
.hd-item.clickable:hover {
    border-color: var(--hd-border-strong);
    background: var(--hd-hover);
    color: inherit;
    text-decoration: none;
}
.hd-item.dim {
    opacity: 0.7;
}

/* Link row inside a div.hd-item — used when the card also carries a button
   (a <button> can't live inside an <a>). */
.hd-row {
    flex: 1 0 100%;
    display: flex;
    align-items: stretch;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.hd-row:hover {
    color: inherit;
    text-decoration: none;
}

/* Left column: time (today) or date (online reservations). Plain text on the
   card surface, separated by a hairline — no tinted tile. */
.hd-when {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 0.7rem 0.5rem;
    border-right: 1px solid var(--hd-divider);
    text-align: center;
    line-height: 1.15;
}
.hd-when-main {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
}
.hd-when-small {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.hd-when-accent {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin-top: 0.15rem;
}

.hd-body {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

/* Code + status pill on one line above the title, so the title keeps the full width. */
.hd-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.hd-code {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--brand-purple, #6f42c1);
}

.hd-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hover-scroll for long titles: the title box is a size container so the inner
   span can slide left by exactly (text width − visible width). */
.hd-title.scroll {
    container-type: inline-size;
    text-overflow: clip;
}
.hd-title.scroll > span {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    transition: transform 2.2s ease-in-out;
}
.hd-item:hover .hd-title.scroll > span {
    max-width: none;
    transform: translateX(min(0px, calc(100cqw - 100%)));
}

.hd-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.8rem;
    font-size: 0.74rem;
    color: var(--text-muted);
}
.hd-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.hd-meta i {
    font-size: 0.72rem;
}

.hd-status {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 0 0.8rem 0 0.25rem;
}

/* Full-width strip under the item (flex-basis 100% wraps it to its own line). */
.hd-foot {
    flex: 1 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.9rem;
    border-top: 1px solid var(--hd-divider);
}
.hd-foot-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b45309;
}
[data-theme="dark"] .hd-foot-label { color: #fcd34d; }

/* Needs-attention item: amber hairline instead of the old animated ring. */
.hd-item.attn {
    border-color: rgba(217, 119, 6, 0.55);
}
a.hd-item.attn:hover {
    border-color: rgba(217, 119, 6, 0.85);
}

/* ═══ Empty state ══════════════════════════════════════════════════════════ */

.hd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.75rem 1rem;
    border: 1px dashed var(--hd-border);
    border-radius: var(--hd-radius);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.hd-empty > i {
    font-size: 1.5rem;
    color: var(--text-muted);
}
.hd-empty p {
    margin: 0;
}
.hd-empty small {
    color: var(--text-muted);
}

/* ═══ Skeleton ═════════════════════════════════════════════════════════════ */

.hd-skel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius);
    background: var(--surface-card, #fff);
}
.hd-bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%);
    background-size: 200% 100%;
    animation: hd-shimmer 1.5s infinite;
}
.hd-bar.w60 { width: 60%; height: 15px; }
.hd-bar.w40 { width: 40%; }
.hd-bar.w80 { width: 80%; height: 10px; }
[data-theme="dark"] .hd-bar {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
}
@keyframes hd-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══ Upcoming Events week calendar ════════════════════════════════════════
   7 columns fit the capped content column at the 1200px boundary; overflow-x
   is the safety net. Below 1200 it becomes a day-by-day list (empty days hidden). */

.hd-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.hd-day {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 140px;
}
.hd-day-head {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    padding: 0.3rem 0.2rem 0.45rem;
    border-bottom: 2px solid var(--hd-divider);
}
.hd-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.hd-day-num {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-heading);
}
.hd-day-month {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--brand-primary);
}
.hd-day.empty .hd-day-head { opacity: 0.55; }
.hd-day-events {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.hd-day-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.8rem 0;
}

/* Compact vertical card inside a day column */
.hd-item.cal {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.15rem;
    padding: 0.6rem 0.7rem;
}
.hd-item.cal .hd-title {
    font-size: 0.85rem;
}
.hd-item.cal .hd-sub {
    font-size: 0.74rem;
}
.hd-cal-time {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-primary);
}
.hd-item.cal .hd-meta {
    margin-top: 0.15rem;
}
.hd-item.cal .hd-cal-status {
    margin-top: 0.3rem;
}
/* Inquiry-stage events are quotes, not bookings: dashed and quieter. */
.hd-item.cal.ghost {
    border-style: dashed;
    background: transparent;
    opacity: 0.8;
}
.hd-item.cal.ghost:hover {
    opacity: 1;
}

/* ═══ Quick actions ════════════════════════════════════════════════════════ */

.hd-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}
.hd-action {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
}
.hd-item.hd-action { flex-wrap: nowrap; }
.hd-action .hd-sub { white-space: normal; }
.hd-action > i {
    font-size: 1.35rem;
    line-height: 1;
    margin-top: 0.1rem;
}
.hd-action .hd-body {
    padding: 0;
}
.hd-action-go {
    align-self: center;
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}
.hd-action:hover .hd-action-go {
    transform: translateX(2px);
    color: var(--text-heading);
}
.hd-action.placeholder {
    border-style: dashed;
    background: transparent;
    color: var(--text-muted);
}
.hd-tone-primary { color: var(--brand-primary); }
.hd-tone-success { color: #198754; }
.hd-tone-warning { color: #b45309; }
.hd-tone-purple  { color: var(--brand-purple, #6f42c1); }
[data-theme="dark"] .hd-tone-success { color: #5dd39e; }
[data-theme="dark"] .hd-tone-warning { color: #f0a752; }

/* ═══ Breakpoints: tablet 768–1199, mobile under 768 ═══════════════════════ */

@media (max-width: 1199.98px) {
    .hd-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .hd-week {
        grid-template-columns: 1fr;
        overflow-x: visible;
        gap: 1rem;
    }
    .hd-day { min-width: 0; }
    .hd-day.empty { display: none; }
    .hd-day-events {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .hd-section { margin-bottom: 1.25rem; }
    .hd-head h2 { font-size: 1rem; }
    .hd-grid { grid-template-columns: 1fr; gap: 0.6rem; }
    .hd-actions { grid-template-columns: 1fr; gap: 0.5rem; }
    .hd-day-events { grid-template-columns: 1fr; }
    .hd-when { min-width: 62px; padding: 0.55rem 0.4rem; }
    .hd-body { padding: 0.55rem 0.75rem; }
    .hd-title { font-size: 0.9rem; }
    .hd-status { padding: 0 0.6rem 0 0.15rem; }
    .hd-empty { padding: 1.4rem 1rem; }
}
