﻿/* ═══════════════════════════════════════════════════════════════════════════
   SALES ANALYTICS — sa-modal-vendor-detail.css
   Vendor Item Detail Modal (Stage E). Loads after sa-modal-history.css
   (depends on .sa-history-td-* helpers from that file for the purchase
   history sub-section).

   Owns:
     - Section shells (.sa-vendor-detail-section, titles, range chips)
     - Sales-this-week sub-grid (multi-row, one per mapped POS item)
     - Day cells (empty/today styling)
     - Week totals
     - Empty state for the sales section

   Does NOT own:
     - Modal shell — sa-shared.css
     - Purchase history table inside the modal — uses .sa-history-table*
       and .sa-history-td-* from sa-modal-history.css
     - "View detail →" button that opens this modal — sa-search.css

   Modal markup: Pages/SalesAnalytics/Partials/_VendorItemDetailModal.cshtml
   JS handlers: sales-analytics.js → openVendorItemDetailModal,
                                     renderVendorDetailPayload

   Why depends on sa-modal-history.css: the modal renders its 12-month
   purchase history using the same table styles as the Stage C modal.
   Avoiding duplication of those table rules here matches the v2 handoff
   guidance — duplicate-rule pattern is specifically what we're trying
   to avoid by splitting.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── SECTION SHELL ─────────────────────────────────────────────────────── */

.sa-vendor-detail-section {
    margin-bottom: 1.5rem;
}

    .sa-vendor-detail-section:last-child {
        margin-bottom: 0;
    }

.sa-vendor-detail-section-title {
    margin: 0 0 .65rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: baseline;
    gap: .65rem;
}

.sa-vendor-detail-section-range {
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: none;
    color: var(--text-muted);
    opacity: .8;
}


/* ── EMPTY STATE ───────────────────────────────────────────────────────── */

.sa-vendor-detail-sales-empty {
    padding: 1.25rem 1rem;
    text-align: center;
    border-radius: 10px;
    border: 1px dashed var(--glass-stroke);
    background: rgba(248, 250, 252, .65);
}

    .sa-vendor-detail-sales-empty p {
        margin: 0 0 .25rem;
        color: var(--text-main);
        font-size: .88rem;
    }

        .sa-vendor-detail-sales-empty p:last-child {
            margin-bottom: 0;
        }

.sa-vendor-detail-sales-empty-hint {
    color: var(--text-muted);
    font-size: .8rem;
}


/* ── SALES SUB-GRID (multi-row, one per mapped POS item) ───────────────── */

.sa-vendor-detail-sales-grid {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    border: 1px solid var(--glass-stroke);
    border-radius: 10px;
    background: rgba(255, 255, 255, .95);
    padding: .65rem .75rem .75rem;
    overflow-x: auto;
}

.sa-vendor-sales-header-row,
.sa-vendor-sales-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.8fr) repeat(7, minmax(52px, 1fr)) minmax(68px, .95fr);
    gap: .35rem;
    align-items: center;
    min-width: 760px;
}

.sa-vendor-sales-header-row {
    padding-bottom: .45rem;
    border-bottom: 1px solid var(--glass-stroke);
    margin-bottom: .15rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sa-vendor-sales-header-name {
    text-align: left;
}

.sa-vendor-sales-header-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    text-align: center;
}

    .sa-vendor-sales-header-day.sa-today .sa-vendor-sales-day-name,
    .sa-vendor-sales-header-day.sa-today .sa-vendor-sales-day-date {
        color: var(--accent);
    }

.sa-vendor-sales-day-name {
    font-weight: 700;
}

.sa-vendor-sales-day-date {
    font-weight: 400;
    font-size: .64rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
}

.sa-vendor-sales-header-total {
    text-align: right;
    border-left: 1px solid var(--glass-stroke);
    padding-left: .55rem;
}

.sa-vendor-sales-row {
    padding: .45rem 0;
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    border-radius: 6px;
}

    .sa-vendor-sales-row + .sa-vendor-sales-row {
        border-top: 1px solid rgba(148, 163, 184, .10);
    }

    .sa-vendor-sales-row:hover {
        background: rgba(37, 99, 235, .035);
    }

/* POS item name cell */
.sa-vendor-sales-name {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    text-align: left;
}

.sa-vendor-sales-pos-desc {
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sa-vendor-sales-division {
    color: var(--text-muted);
    font-size: .72rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Day cells */
.sa-vendor-sales-day-cell {
    text-align: center;
    color: var(--text-main);
    padding: .18rem .2rem;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}

    .sa-vendor-sales-day-cell.sa-empty {
        color: rgba(148, 163, 184, .70);
    }

    .sa-vendor-sales-day-cell.sa-today {
        background: rgba(37, 99, 235, .10);
        color: var(--accent-strong);
        font-weight: 700;
    }

/* Week total */
.sa-vendor-sales-week-total {
    text-align: right;
    font-weight: 700;
    color: var(--text-main);
    border-left: 1px solid var(--glass-stroke);
    padding-left: .55rem;
    white-space: nowrap;
}


/* ── COMPONENT-SCOPED RESPONSIVE ───────────────────────────────────────── */
/* These media queries live with the component (not in sa-responsive.css)
   because they only modify this file's grid widths. Keeping them here
   means changing the grid columns above doesn't require hunting in a
   second file for the matching responsive overrides. */

@media (max-width: 1024px) {
    .sa-vendor-sales-header-row,
    .sa-vendor-sales-row {
        min-width: 720px;
    }
}

@media (max-width: 640px) {
    .sa-vendor-detail-section-title {
        flex-wrap: wrap;
        gap: .25rem .5rem;
    }

    .sa-vendor-detail-sales-grid {
        padding: .55rem .55rem .65rem;
    }

    .sa-vendor-sales-header-row,
    .sa-vendor-sales-row {
        min-width: 700px;
    }

    .sa-vendor-sales-pos-desc {
        white-space: normal;
    }
}
