@import '../../../../vendor/filament/filament/resources/css/theme.css';

@source '../../../../app/Filament/**/*';
@source '../../../../resources/views/filament/**/*';

/* SABA surfaces. Semantic status colors and focus rings come from the Panel. */
:root {
    --saba-canvas: #f6f7f8;
    --saba-surface: #ffffff;
    --saba-border: #e4e4e7;
    --saba-ink: #27272a;
    --saba-muted: #71717a;
    --saba-primary: #dc2626;
    --saba-active: #fef2f2;
}

.fi-body {
    background: var(--saba-canvas);
    color: var(--saba-ink);
}

/* Global width is Width::Full in the Panel; only gutters are adjusted here. */
.fi-main {
    padding-inline: 1rem;
}

@media (min-width: 1024px) {
    .fi-main {
        padding-inline: 1.5rem;
    }
}

.fi-page {
    row-gap: 1.5rem;
}

.fi-header-heading {
    color: var(--saba-ink);
    font-size: 1.625rem;
    font-weight: 650;
    letter-spacing: -0.035em;
}

/* Navigation: quiet white rail, soft active state, native mobile drawer. */
.fi-sidebar {
    background: var(--saba-surface);
    border-inline-end: 1px solid var(--saba-border);
}

.fi-sidebar-nav {
    padding: 1.5rem 1.25rem;
}

.fi-sidebar-nav-groups {
    row-gap: 1.75rem;
}

.fi-sidebar-group-label {
    color: var(--saba-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.fi-sidebar-item-btn {
    min-height: 2.625rem;
    border-radius: 0.5rem;
    padding-inline: 0.75rem;
}

.fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-btn:hover {
    background: #f4f4f5;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background: var(--saba-active);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-sidebar-item-label,
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-icon {
    color: #b91c1c;
}

/* Topbar keeps the existing search, user menu and logout controls. */
.fi-topbar {
    background: var(--saba-surface);
    border-bottom: 1px solid var(--saba-border);
    box-shadow: none;
}

.fi-topbar-start {
    min-width: 13rem;
}

.fi-logo {
    max-width: 100%;
    object-fit: contain;
}

/* Cards and tables share one restrained surface treatment. */
.fi-section:not(.fi-section-not-contained):not(.fi-aside),
.fi-fieldset:not(.fi-fieldset-not-contained),
.fi-ta-ctn {
    background: var(--saba-surface);
    border: 1px solid var(--saba-border);
    border-radius: 0.625rem;
    box-shadow: none;
}

.fi-section-header-heading {
    color: var(--saba-ink);
    font-size: 0.9375rem;
    font-weight: 600;
}

.fi-ta-table {
    width: 100%;
}

.fi-ta-table > thead {
    background: #fafafa;
}

.fi-ta-header-cell {
    color: #52525b;
    font-size: 0.75rem;
    font-weight: 600;
    padding-block: 0.875rem;
}

.fi-ta-row:hover {
    background: #fafafa;
}

.fi-ta-text-item {
    font-weight: 400;
}

.fi-ta-content,
.fi-ta-header-toolbar,
.fi-pagination {
    border-color: var(--saba-border);
}

/* Controls retain Filament's semantic colors and accessible focus states. */
.fi-btn {
    border-radius: 0.4375rem;
    font-weight: 600;
    box-shadow: none;
}

/* Filament 5's automatic contrast palette can select a pale fill. SABA uses
   an explicit red/white primary button while preserving outlined variants. */
.fi-btn.fi-color-primary:not(.fi-outlined) {
    background: var(--saba-primary);
    color: #ffffff;
}

.fi-btn.fi-color-primary:not(.fi-outlined):not([disabled]):not(.fi-disabled):hover {
    background: #b91c1c;
    color: #ffffff;
}

.fi-btn.fi-color-primary:not(.fi-outlined) > .fi-icon {
    color: #ffffff;
}

.fi-input-wrp {
    border-radius: 0.4375rem;
}

/* Login: centered native layout, brand logo, subtle red background accent. */
.fi-simple-layout {
    background:
        radial-gradient(ellipse at 15% 0%, #dc262609, transparent 45%),
        var(--saba-canvas);
    padding-inline: 1rem;
}

.fi-simple-main {
    background: var(--saba-surface);
    border: 1px solid var(--saba-border);
    border-radius: 0.75rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 24px #27272a05;
}

.fi-simple-header .fi-logo {
    width: 13rem;
    height: auto;
    margin-bottom: 1.75rem;
}

.fi-simple-header-heading {
    color: var(--saba-ink);
    font-size: 1.375rem;
    font-weight: 600;
}

@media (max-width: 639px) {
    .fi-simple-main {
        padding: 2rem 1.25rem;
    }
}

/* SABA topbar storefront shortcut. */
.saba-admin-store-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.25rem;
    padding: .45rem .8rem;
    border: 1px solid var(--saba-border);
    border-radius: .5rem;
    background: #fff;
    color: #3f3f46;
    font-size: .8125rem;
    font-weight: 600;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.saba-admin-store-link:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

/* Operational orders board. */
.saba-kanban-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(18rem, 21rem);
    gap: 1rem;
    align-items: start;
}

.saba-kanban-column {
    min-height: 28rem;
    border: 1px solid var(--saba-border);
    border-radius: .75rem;
    background: #f4f4f5;
    overflow: hidden;
}

.saba-kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--saba-border);
    background: rgba(255, 255, 255, .8);
}

.saba-kanban-column-title { color: #18181b; font-size: .875rem; font-weight: 700; }
.saba-kanban-column-subtitle { margin-top: .15rem; color: #71717a; font-size: .7rem; }
.saba-kanban-dot { width: .65rem; height: .65rem; border-radius: 9999px; background: #a1a1aa; }
.saba-kanban-dot--paid, .saba-kanban-dot--delivered { background: #16a34a; }
.saba-kanban-dot--processing { background: #f59e0b; }
.saba-kanban-dot--shipped { background: #2563eb; }
.saba-kanban-dot--ready_for_pickup { background: #7c3aed; }
.saba-kanban-dot--cancelled { background: #dc2626; }
.saba-kanban-stack { display: grid; gap: .75rem; padding: .75rem; }

.saba-kanban-card {
    border: 1px solid #e4e4e7;
    border-radius: .7rem;
    background: #fff;
    padding: .9rem;
    box-shadow: 0 1px 2px rgba(24,24,27,.03);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.saba-kanban-card:hover {
    border-color: #d4d4d8;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(24,24,27,.05);
}

.saba-kanban-action {
    border-radius: .45rem;
    background: #dc2626;
    padding: .4rem .65rem;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    transition: background .18s ease;
}
.saba-kanban-action:hover { background: #b91c1c; }

/* Dashboard: compact executive layout with controlled chart heights. */
.fi-page:has(.saba-dashboard-card) .fi-wi-stats-overview-stat,
.saba-kpi-card {
    border: 1px solid var(--saba-border);
    border-radius: .75rem;
    background: #fff;
    box-shadow: none;
    overflow: hidden;
    position: relative;
}

.saba-kpi-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: #d4d4d8;
}

.saba-kpi-card--primary::before { background: #dc2626; }
.saba-kpi-card--success::before { background: #16a34a; }
.saba-kpi-card--neutral::before { background: #71717a; }
.saba-kpi-card--warning::before { background: #f59e0b; }

.saba-dashboard-card {
    height: 100%;
    border: 1px solid var(--saba-border);
    border-radius: .75rem;
    background: #fff;
    overflow: hidden;
}

.saba-dashboard-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #eeeeef;
}

.saba-dashboard-card__eyebrow {
    margin: 0 0 .2rem;
    color: #dc2626;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .095em;
    text-transform: uppercase;
}

.saba-dashboard-card__title {
    margin: 0;
    color: #18181b;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.saba-dashboard-card__description {
    margin: .25rem 0 0;
    color: #71717a;
    font-size: .78rem;
    line-height: 1.35;
}

.saba-dashboard-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .35rem;
    min-height: 2rem;
    padding: .4rem .65rem;
    border: 1px solid #e4e4e7;
    border-radius: .45rem;
    background: #fff;
    color: #52525b;
    font-size: .72rem;
    font-weight: 650;
    text-decoration: none;
    transition: .18s ease;
}

.saba-dashboard-link:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.saba-dashboard-link__icon {
    width: .9rem;
    height: .9rem;
}

.saba-attention-list {
    display: grid;
}

.saba-attention-row {
    display: grid;
    grid-template-columns: minmax(11rem, 1.6fr) minmax(10rem, 1.2fr) auto auto 1rem;
    align-items: center;
    gap: 1rem;
    min-height: 4.3rem;
    padding: .8rem 1.25rem;
    border-bottom: 1px solid #f0f0f1;
    color: inherit;
    text-decoration: none;
    transition: background .15s ease;
}

.saba-attention-row:last-child { border-bottom: 0; }
.saba-attention-row:hover { background: #fafafa; }

.saba-attention-row__main {
    display: grid;
    min-width: 0;
    gap: .16rem;
}

.saba-attention-row__number {
    color: #18181b;
    font-size: .78rem;
    font-weight: 750;
}

.saba-attention-row__customer {
    overflow: hidden;
    color: #71717a;
    font-size: .75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saba-attention-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    color: #a1a1aa;
    font-size: .7rem;
}

.saba-attention-row__total {
    color: #27272a;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.saba-attention-row__chevron {
    width: 1rem;
    height: 1rem;
    color: #a1a1aa;
}

.saba-status-pill {
    display: inline-flex;
    align-items: center;
    width: max-content;
    padding: .28rem .5rem;
    border-radius: 999px;
    background: #f4f4f5;
    color: #52525b;
    font-size: .65rem;
    font-weight: 700;
    white-space: nowrap;
}

.saba-status-pill--paid,
.saba-status-pill--delivered { background: #f0fdf4; color: #15803d; }
.saba-status-pill--processing { background: #fffbeb; color: #b45309; }
.saba-status-pill--shipped { background: #eff6ff; color: #1d4ed8; }
.saba-status-pill--ready_for_pickup { background: #f5f3ff; color: #6d28d9; }
.saba-status-pill--cancelled { background: #fef2f2; color: #b91c1c; }

.saba-dashboard-empty {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 1.6rem 1.25rem;
    color: #71717a;
}

.saba-dashboard-empty__icon {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border-radius: 999px;
    background: #f0fdf4;
    color: #16a34a;
}

.saba-dashboard-empty__icon svg { width: 1.2rem; height: 1.2rem; }
.saba-dashboard-empty strong { color: #27272a; font-size: .8rem; }
.saba-dashboard-empty p { margin: .12rem 0 0; font-size: .72rem; }


/* Keep dashboard charts presentation-sized even with sparse datasets. */
.fi-wi-chart canvas {
    max-width: 100%;
}

@media (max-width: 1023px) {
    .saba-attention-row {
        grid-template-columns: minmax(0, 1fr) auto 1rem;
        gap: .65rem;
    }

    .saba-attention-row__meta,
    .saba-attention-row__status { display: none; }
}

@media (max-width: 639px) {
    .saba-dashboard-card__header {
        align-items: stretch;
        flex-direction: column;
    }

    .saba-dashboard-link { width: max-content; }

    .saba-attention-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .saba-attention-row__chevron { display: none; }
}

/* Dashboard: best-selling products replaces the former cash-flow summary. */
.saba-best-sellers-list {
    display: grid;
}

.saba-best-sellers-row {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: .8rem;
    align-items: center;
    padding: .95rem 1.2rem;
    border-bottom: 1px solid #f1f1f2;
}

.saba-best-sellers-row:last-child {
    border-bottom: 0;
}

.saba-best-sellers-rank {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: #f4f4f5;
    color: #52525b;
    font-size: .76rem;
    font-weight: 700;
}

.saba-best-sellers-main {
    min-width: 0;
    display: grid;
    gap: .15rem;
}

.saba-best-sellers-name {
    overflow: hidden;
    color: #18181b;
    font-size: .82rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saba-best-sellers-meta {
    color: #71717a;
    font-size: .72rem;
}

.saba-best-sellers-revenue {
    color: #18181b;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 639px) {
    .saba-best-sellers-row {
        grid-template-columns: 2rem minmax(0, 1fr);
    }

    .saba-best-sellers-revenue {
        grid-column: 2;
    }
}
