/*
 * «أيوه جاي» look for the admin and vendor panels (dashboard cards, alerts, phone cards, account banner).
 *
 * Filament ships precompiled CSS with only the classes it uses itself, so everything our blades need beyond Filament
 * components lives here, scoped under .aj-*. Registered in AppServiceProvider (FilamentAsset) and published to
 * public/css/app by `php artisan filament:assets` (also run by composer's filament:upgrade).
 *
 * Brand: green #054A31 (the bag), amber #F7B500 → #E07800 (the speed lines), cream #FFF8E1.
 * Logical properties only, so RTL just works.
 */

/* ── Brand lockup ─────────────────────────────────────────────── */
.aj-brand-section { color: #E07800; }
.dark .aj-brand-section { color: #F7B500; }
.dark .aj-brand-mark { background: #FFF8E1; border-radius: .6rem; padding: .2rem; }

/* ── Dashboard building blocks ────────────────────────────────── */
.aj-dash {
    --aj-green: #054A31;
    --aj-amber: #F7B500;
    --aj-orange: #E07800;
    --aj-cream: #FFF8E1;

    --aj-card: #FFFFFF;
    --aj-soft: #FAF7F0;
    --aj-line: #ECE6D8;
    --aj-text: #1C1917;
    --aj-strong: #054A31;
    --aj-muted: #78716C;
    --aj-fill: #054A31;
    --aj-hero: #054A31;
    --aj-hero-text: #FFF8E1;

    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--aj-text);
    min-width: 0;
}
.dark .aj-dash {
    --aj-card: rgba(255, 255, 255, 0.04);
    --aj-soft: rgba(255, 255, 255, 0.07);
    --aj-line: rgba(255, 248, 225, 0.12);
    --aj-text: #F5F5F4;
    --aj-strong: #FFF8E1;
    --aj-muted: rgba(255, 248, 225, 0.65);
    --aj-fill: #3D946C;
    --aj-hero: rgba(61, 148, 108, 0.18);
    --aj-hero-text: #FFF8E1;
}

/* Period chips: scroll sideways on a phone, never wrap */
.aj-chips { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; padding-block-end: 2px; }
.aj-chips::-webkit-scrollbar { display: none; }
.aj-chip {
    flex: 0 0 auto; min-height: 44px; padding-inline: 1rem; border-radius: 999px;
    border: 1px solid var(--aj-line); background: var(--aj-card); color: var(--aj-text);
    font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer;
}
.aj-chip.is-on { background: var(--aj-amber); border-color: var(--aj-amber); color: var(--aj-green); }
.aj-chip:focus-visible { outline: 2px solid var(--aj-orange); outline-offset: 2px; }

.aj-card { background: var(--aj-card); border: 1px solid var(--aj-line); border-radius: 1rem; padding: 1rem; min-width: 0; }
.aj-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-block-end: .75rem; flex-wrap: wrap; }
.aj-title { font-size: 1rem; font-weight: 800; color: var(--aj-strong); margin: 0; }
.aj-link { color: var(--aj-orange); font-weight: 700; font-size: .875rem; text-decoration: none; }
.dark .aj-link { color: var(--aj-amber); }
.aj-link:hover { text-decoration: underline; }
.aj-muted { color: var(--aj-muted); }
.aj-num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.aj-empty { color: var(--aj-muted); font-size: .875rem; margin: 0; }

.aj-grid-4 { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aj-grid-2 { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
    .aj-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .aj-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* KPI tile */
.aj-kpi { display: flex; flex-direction: column; gap: .25rem; }
.aj-kpi-label { font-size: .8125rem; font-weight: 700; color: var(--aj-muted); }
.aj-kpi-value { font-size: 1.5rem; font-weight: 800; color: var(--aj-strong); line-height: 1.2; overflow-wrap: anywhere; }
.aj-kpi-note { font-size: .75rem; color: var(--aj-muted); }
.aj-up { color: #15803D; font-weight: 700; }
.aj-down { color: #B91C1C; font-weight: 700; }
.dark .aj-up { color: #4ADE80; }
.dark .aj-down { color: #F87171; }

/* Hero: the one number that matters for the period */
.aj-hero { background: var(--aj-hero); color: var(--aj-hero-text); border-radius: 1.25rem; padding: 1.25rem; border: 1px solid var(--aj-amber); }
.aj-hero-label { font-size: .875rem; font-weight: 700; opacity: .9; }
.aj-hero-value { font-size: 2.25rem; font-weight: 900; color: var(--aj-amber); line-height: 1.15; margin-block: .25rem; }
.aj-hero-meta { font-size: .8125rem; opacity: .85; }

/* Horizontal bars */
.aj-bars { display: flex; flex-direction: column; gap: .75rem; }
.aj-bar-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .875rem; margin-block-end: .25rem; }
.aj-bar-top b { color: var(--aj-strong); }
.aj-track { height: 10px; border-radius: 999px; background: var(--aj-line); overflow: hidden; }
.aj-track > span { display: block; height: 100%; border-radius: 999px; background: var(--aj-fill); min-width: 2px; }
.aj-track > span.is-amber { background: var(--aj-amber); }

/* Stacked bar + legend (orders by status) */
.aj-stackbar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: var(--aj-line); }
.aj-stackbar > span { display: block; height: 100%; min-width: 3px; }
.aj-legend { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .aj-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.aj-legend li { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.aj-legend i { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.aj-legend .aj-amount { margin-inline-start: auto; font-weight: 800; color: var(--aj-strong); }
.aj-st-pending { background: #A8A29E; }
.aj-st-processing { background: #F7B500; }
.aj-st-shipped { background: #60A5FA; }
.aj-st-delivered { background: #054A31; }
.dark .aj-st-delivered { background: #3D946C; }
.aj-st-cancelled { background: #F87171; }

/* Alerts: things waiting for someone, each a link to the list */
.aj-alerts { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.aj-alert {
    display: flex; align-items: center; gap: .75rem; padding: .875rem 1rem; min-height: 44px;
    border: 1px solid var(--aj-line); border-inline-start: 4px solid var(--aj-amber); border-radius: 1rem;
    background: var(--aj-card); color: var(--aj-text); text-decoration: none;
}
.aj-alert:hover { background: var(--aj-soft); }
.aj-alert.is-danger { border-inline-start-color: #DC2626; }
.aj-alert b { font-size: 1.5rem; font-weight: 900; color: var(--aj-strong); min-width: 2ch; text-align: center; }
.aj-alert span { font-size: .875rem; font-weight: 700; }

/* Plain tables inside cards (site expenses): numbers end-aligned, a total row, a clickable row */
.aj-scroll { overflow-x: auto; max-width: 100%; }
.aj-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.aj-table th, .aj-table td { padding: .5rem .625rem; text-align: start; white-space: nowrap; border-block-start: 1px solid var(--aj-line); }
.aj-table thead th { color: var(--aj-muted); font-weight: 700; font-size: .75rem; border-block-start: 0; }
.aj-table .aj-num { text-align: end; }
.aj-table tr.is-head td { background: var(--aj-soft); font-weight: 800; color: var(--aj-strong); }
.aj-table tr.is-total td { font-weight: 800; color: var(--aj-strong); border-block-start: 2px solid var(--aj-line); }
.aj-table tr.is-link { cursor: pointer; }
.aj-table tr.is-link:hover td { background: var(--aj-soft); }
.aj-tip { background: var(--aj-soft); border-radius: .75rem; padding: .75rem; font-size: .8125rem; color: var(--aj-muted); margin: .75rem 0 0; }

/* ‹ October 2026 › over a month sheet; chevrons follow the reading direction */
.aj-monthbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.aj-month { min-width: 8rem; text-align: center; font-size: 1.05rem; font-weight: 800; }
.aj-hero .fi-icon-btn { color: var(--aj-hero-text); }

/* ── Account banner on every vendor page (App\Filament\VendorAccountBanner) ── */
.aj-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid; margin-block-end: 8px; font-size: 14px; }
.aj-banner p { margin: 0; flex: 1 1 16rem; min-width: 0; line-height: 1.5; }
.aj-banner a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 16px; border-radius: 10px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.aj-banner.is-warning { background: #FFF8E1; border-color: #F7B500; color: #054A31; }
.aj-banner.is-warning a { background: #054A31; color: #FFF8E1; }
.aj-banner.is-danger { background: #FDECEC; border-color: #DC2626; color: #1C1917; }
.aj-banner.is-danger a { background: #B91C1C; color: #FFFFFF; }
.dark .aj-banner.is-warning { background: rgba(247, 181, 0, .12); color: #FFF8E1; }
.dark .aj-banner.is-warning a { background: #F7B500; color: #054A31; }
.dark .aj-banner.is-danger { background: rgba(220, 38, 38, .14); color: #FFF8E1; }

/* ── Page tabs keep scrolling sideways on a phone instead of turning into a <select> ── */
.fi-page .fi-page-sub-navigation-tabs { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.fi-page .fi-page-sub-navigation-tabs::-webkit-scrollbar { display: none; }
.fi-page .fi-page-sub-navigation-tabs .fi-tabs-item { min-height: 44px; white-space: nowrap; flex: 0 0 auto; }
.fi-page .fi-page-sub-navigation-select { display: none; }

/* ── Phone cards: every Filament table becomes one card per row under 640px ──
 * Each cell carries its column label as data-aj-label (AppServiceProvider); the first data cell is the card's title. */
@media (max-width: 639px) {
    .fi-ta-table:has(td[data-aj-label]) { display: block; }
    .fi-ta-table:has(td[data-aj-label]) > thead { display: none; }
    .fi-ta-table:has(td[data-aj-label]) > tbody { display: block; }
    .fi-ta-table:has(td[data-aj-label]) > tbody > tr {
        display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .625rem 1rem;
        padding: .875rem 1rem; position: relative;
    }
    .fi-ta-table td[data-aj-label] { display: block; padding: 0; min-width: 0; }
    .fi-ta-table td[data-aj-label]::before {
        content: attr(data-aj-label); display: block; font-size: .6875rem; font-weight: 700; color: rgb(120 113 108); margin-block-end: .125rem;
    }
    .dark .fi-ta-table td[data-aj-label]::before { color: rgba(255, 248, 225, .65); }
    .fi-ta-table td[data-aj-label=""]::before { display: none; }
    .fi-ta-table td[data-aj-label] > *,
    .fi-ta-table td[data-aj-label] .fi-ta-text { padding: 0 !important; }
    .fi-ta-table td[data-aj-label] .fi-ta-text-item,
    .fi-ta-table td[data-aj-label] p,
    .fi-ta-table td[data-aj-label] span { white-space: normal; overflow-wrap: anywhere; }
    /* Title: the first data cell, full width, no caption. */
    .fi-ta-table > tbody > tr > td[data-aj-label]:first-child,
    .fi-ta-table td.fi-ta-selection-cell + td[data-aj-label] { grid-column: 1 / -1; padding-inline-end: 2rem; }
    .fi-ta-table > tbody > tr > td[data-aj-label]:first-child::before,
    .fi-ta-table td.fi-ta-selection-cell + td[data-aj-label]::before { display: none; }
    .fi-ta-table > tbody > tr > td[data-aj-label]:first-child .fi-ta-text-item,
    .fi-ta-table td.fi-ta-selection-cell + td[data-aj-label] .fi-ta-text-item { font-size: 1rem; font-weight: 800; }
    /* Bulk-select box in the card's corner, actions on their own row. */
    .fi-ta-table:has(td[data-aj-label]) td.fi-ta-selection-cell { position: absolute; inset-block-start: .875rem; inset-inline-end: 1rem; padding: 0; }
    .fi-ta-table:has(td[data-aj-label]) td.fi-ta-actions-cell { grid-column: 1 / -1; display: block; padding: 0; }
    .fi-ta-table:has(td[data-aj-label]) td.fi-ta-actions-cell .fi-ta-actions { justify-content: flex-start; gap: .25rem; }
    .fi-ta-table:has(td[data-aj-label]) td.fi-ta-actions-cell .fi-icon-btn { min-width: 44px; min-height: 44px; }
}
