/*
 * Owner panel only (registered via OwnerPanelProvider::assets, never loaded by
 * Admin / Cashier / Deliverer). Transform + opacity only, RTL-safe (vertical
 * movement only), honours prefers-reduced-motion.
 */

/* ---- Page transition ------------------------------------------------- */
@keyframes owner-page-enter {
    from {
        opacity: 0;
        transform: translate3d(calc(14px * var(--owner-inline, 1)), 0, 0);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* "backwards" (not "both"): no transform stays on .fi-main afterwards, so fixed-position modals keep working. */
.fi-main {
    animation: owner-page-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* Cross-document fade for full page loads (Chromium); ignored elsewhere. */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.18s;
}

/* ---- Navigation progress bar (Livewire/Filament nprogress) -------------- */
html body #nprogress .bar {
    background: var(--primary-500, #10b981) !important;
    height: 3px !important;
    box-shadow: 0 0 8px color-mix(in srgb, var(--primary-500, #10b981) 55%, transparent);
}

html body #nprogress .peg {
    box-shadow: 0 0 10px var(--primary-500, #10b981), 0 0 5px var(--primary-500, #10b981) !important;
}

html body #nprogress .spinner {
    display: none !important;
}

/* ---- Loading states ------------------------------------------------------ */
@keyframes owner-skeleton-shimmer {
    0%,
    100% {
        opacity: 0.55;
    }

    50% {
        opacity: 0.25;
    }
}

/* Deferred tables before first records arrive. */
.fi-ta.fi-loading .fi-ta-row,
.fi-ta.fi-loading .fi-ta-cell {
    animation: owner-skeleton-shimmer 1.2s ease-in-out infinite;
}

/* Table is refreshing (search / filter / sort / page): controls get disabled by wire:loading.attr. */
.fi-ta:has(.fi-ta-search-field input:disabled) .fi-ta-content-ctn,
.fi-ta:has(.fi-pagination button:disabled) .fi-ta-content-ctn {
    opacity: 0.6;
    transition: opacity 0.18s ease;
}

.fi-ta .fi-ta-content-ctn {
    transition: opacity 0.18s ease;
}

/* Buttons that are busy (Filament marks them disabled while the request runs). */
.fi-btn[disabled],
.fi-btn.fi-disabled {
    transition: opacity 0.15s ease;
}

/* ---- Owner dashboard: opacity-only loading (no filter: blur) ---------------- */
.owner-dashboard .owner-dashboard-widgets.owner-dashboard-widgets--loading {
    opacity: 0.55;
    filter: none;
    transform: none;
    pointer-events: none;
}

.owner-dashboard .owner-dashboard-widgets {
    transition: opacity 0.28s ease;
}

/* ---- Owner Features nav item: always-glowing, colour-swapping ---------------- */
/* Palette: violet #7c3aed, pink #db2777, amber #f59e0b. Only background-position,
   box-shadow and opacity animate (no filter). Label/icon sit on a solid-ish tint
   so contrast holds in light and dark. */
.fi-sidebar-item.owner-nav-glow > .fi-sidebar-item-btn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background-image: linear-gradient(120deg, #7c3aed, #db2777, #f59e0b, #7c3aed);
    background-size: 300% 300%;
    animation: owner-nav-swap 6s ease-in-out infinite, owner-nav-pulse 2.4s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(219, 39, 119, 0.45);
}

.fi-sidebar-item.owner-nav-glow > .fi-sidebar-item-btn .fi-sidebar-item-label,
.fi-sidebar-item.owner-nav-glow > .fi-sidebar-item-btn .fi-icon,
.fi-sidebar-item.owner-nav-glow > .fi-sidebar-item-btn svg {
    color: #fff !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.fi-sidebar-item.owner-nav-glow > .fi-sidebar-item-btn:hover {
    opacity: 0.92;
}

/* Active: white ring + inner highlight so it stays distinguishable */
.fi-sidebar-item.owner-nav-glow.fi-active > .fi-sidebar-item-btn {
    outline: 2px solid #fff;
    outline-offset: -2px;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.55), 0 0 14px 2px rgba(219, 39, 119, 0.5);
}

.dark .fi-sidebar-item.owner-nav-glow.fi-active > .fi-sidebar-item-btn {
    outline-color: rgba(255, 255, 255, 0.9);
}

@keyframes owner-nav-swap {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes owner-nav-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(219, 39, 119, 0.4), 0 0 6px 0 rgba(124, 58, 237, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(219, 39, 119, 0), 0 0 14px 2px rgba(245, 158, 11, 0.45); }
}

/* ======================================================================
   Owner "soul" layer: colour + motion polish (Owner panel only).
   Palette (Filament colours set in OwnerPanelProvider):
   primary emerald 500 #10b981 | secondary indigo 500 #6366f1 | accent violet 500 #8b5cf6
   info sky 500 #0ea5e9 | warning amber 500 #f59e0b | danger rose 500 #f43f5e | gray slate
   Only transform/opacity/background/box-shadow are animated. No backdrop-filter.
   ====================================================================== */
html { --owner-inline: 1; }
html[dir="rtl"] { --owner-inline: -1; }

/* ---- Page background tint ---------------------------------------------- */
.fi-body {
    background-image:
        radial-gradient(700px 360px at 100% 0%, color-mix(in srgb, var(--primary-500, #10b981) 9%, transparent), transparent 70%),
        radial-gradient(640px 340px at 0% 8%, color-mix(in srgb, var(--accent-500, #8b5cf6) 7%, transparent), transparent 70%);
    background-repeat: no-repeat;
}

.dark .fi-body {
    background-image:
        radial-gradient(700px 360px at 100% 0%, color-mix(in srgb, var(--primary-500, #10b981) 12%, transparent), transparent 70%),
        radial-gradient(640px 340px at 0% 8%, color-mix(in srgb, var(--accent-500, #8b5cf6) 10%, transparent), transparent 70%);
}

/* ---- Topbar / sections -------------------------------------------------- */
.fi-topbar > nav,
.fi-topbar {
    background-image: linear-gradient(90deg,
        color-mix(in srgb, var(--primary-500, #10b981) 7%, transparent),
        color-mix(in srgb, var(--accent-500, #8b5cf6) 6%, transparent));
}

.fi-section:not(.fi-section-not-contained) {
    background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary-500, #10b981) 5%, transparent), transparent 55%);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dark .fi-section:not(.fi-section-not-contained) {
    background-image: linear-gradient(180deg, color-mix(in srgb, var(--primary-400, #34d399) 7%, transparent), transparent 55%);
}

.fi-section-header {
    border-inline-start: 3px solid var(--primary-500, #10b981);
    padding-inline-start: 0.75rem;
    border-radius: 2px;
}

.fi-section:nth-of-type(4n + 2) > .fi-section-header,
.fi-section:nth-of-type(4n + 2) .fi-section-header { border-inline-start-color: var(--accent-500, #8b5cf6); }
.fi-section:nth-of-type(4n + 3) .fi-section-header { border-inline-start-color: var(--info-500, #0ea5e9); }
.fi-section:nth-of-type(4n) .fi-section-header { border-inline-start-color: var(--warning-500, #f59e0b); }

/* ---- Stat widgets: accent bar + coloured icon chip -------------------------- */
.fi-wi-stats-overview-stat {
    --owner-chip: var(--primary-500, #10b981);
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(160deg, color-mix(in srgb, var(--owner-chip) 9%, transparent), transparent 60%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fi-wi-stats-overview-stat:nth-child(4n + 2) { --owner-chip: var(--info-500, #0ea5e9); }
.fi-grid-col:nth-child(4n + 2) .fi-wi-stats-overview-stat { --owner-chip: var(--info-500, #0ea5e9); }
.fi-wi-stats-overview-stat:nth-child(4n + 3) { --owner-chip: var(--accent-500, #8b5cf6); }
.fi-grid-col:nth-child(4n + 3) .fi-wi-stats-overview-stat { --owner-chip: var(--accent-500, #8b5cf6); }
.fi-wi-stats-overview-stat:nth-child(4n) { --owner-chip: var(--warning-500, #f59e0b); }
.fi-grid-col:nth-child(4n) .fi-wi-stats-overview-stat { --owner-chip: var(--warning-500, #f59e0b); }

.fi-wi-stats-overview-stat::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--owner-chip), color-mix(in srgb, var(--owner-chip) 35%, transparent));
    pointer-events: none;
}

.fi-wi-stats-overview-stat-label-ctn > svg {
    box-sizing: border-box;
    width: 1.875rem;
    height: 1.875rem;
    padding: 0.35rem;
    border-radius: 0.6rem;
    color: var(--owner-chip) !important;
    background: color-mix(in srgb, var(--owner-chip) 16%, transparent);
}

.fi-wi-stats-overview-stat-label-ctn:not(:has(> svg))::before {
    content: "";
    flex: none;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 999px;
    background: var(--owner-chip);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--owner-chip) 18%, transparent);
}

/* ---- Badges, active sidebar ------------------------------------------------- */
.fi-badge {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}

.fi-sidebar-item > .fi-sidebar-item-btn {
    position: relative;
    transition: background-color 0.22s ease, box-shadow 0.22s ease, transform 0.15s ease;
}

.fi-sidebar-item.fi-active:not(.owner-nav-glow) > .fi-sidebar-item-btn {
    background-image: linear-gradient(135deg,
        color-mix(in srgb, var(--primary-500, #10b981) 20%, transparent),
        color-mix(in srgb, var(--accent-500, #8b5cf6) 14%, transparent));
}

.fi-sidebar-item.fi-active:not(.owner-nav-glow) > .fi-sidebar-item-btn::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--primary-500, #10b981), var(--accent-500, #8b5cf6));
    animation: owner-pill-in 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
}

@keyframes owner-pill-in {
    from { transform: scaleY(0.2); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ---- Entrance stagger (only inside the short window JS opens after navigation) */
@keyframes owner-rise {
    from { opacity: 0; transform: translate3d(0, 12px, 0); }
    to { opacity: 1; transform: none; }
}

html.owner-boot .fi-wi,
html.owner-boot .fi-section,
html.owner-boot .fi-wi-stats-overview-stat,
html.owner-boot .fi-ta-row {
    animation: owner-rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

html.owner-boot .fi-wi:nth-child(1), html.owner-boot .fi-section:nth-child(1), html.owner-boot .fi-wi-stats-overview-stat:nth-child(1), html.owner-boot .fi-ta-row:nth-child(1), html.owner-boot .fi-grid-col:nth-child(1) .fi-wi-stats-overview-stat { animation-delay: 0ms; }
html.owner-boot .fi-wi:nth-child(2), html.owner-boot .fi-section:nth-child(2), html.owner-boot .fi-wi-stats-overview-stat:nth-child(2), html.owner-boot .fi-ta-row:nth-child(2), html.owner-boot .fi-grid-col:nth-child(2) .fi-wi-stats-overview-stat { animation-delay: 40ms; }
html.owner-boot .fi-wi:nth-child(3), html.owner-boot .fi-section:nth-child(3), html.owner-boot .fi-wi-stats-overview-stat:nth-child(3), html.owner-boot .fi-ta-row:nth-child(3), html.owner-boot .fi-grid-col:nth-child(3) .fi-wi-stats-overview-stat { animation-delay: 80ms; }
html.owner-boot .fi-wi:nth-child(4), html.owner-boot .fi-section:nth-child(4), html.owner-boot .fi-wi-stats-overview-stat:nth-child(4), html.owner-boot .fi-ta-row:nth-child(4), html.owner-boot .fi-grid-col:nth-child(4) .fi-wi-stats-overview-stat { animation-delay: 120ms; }
html.owner-boot .fi-wi:nth-child(5), html.owner-boot .fi-section:nth-child(5), html.owner-boot .fi-wi-stats-overview-stat:nth-child(5), html.owner-boot .fi-ta-row:nth-child(5), html.owner-boot .fi-grid-col:nth-child(5) .fi-wi-stats-overview-stat { animation-delay: 160ms; }
html.owner-boot .fi-wi:nth-child(6), html.owner-boot .fi-section:nth-child(6), html.owner-boot .fi-wi-stats-overview-stat:nth-child(6), html.owner-boot .fi-ta-row:nth-child(6), html.owner-boot .fi-grid-col:nth-child(6) .fi-wi-stats-overview-stat { animation-delay: 200ms; }
html.owner-boot .fi-wi:nth-child(7), html.owner-boot .fi-section:nth-child(7), html.owner-boot .fi-wi-stats-overview-stat:nth-child(7), html.owner-boot .fi-ta-row:nth-child(7), html.owner-boot .fi-grid-col:nth-child(7) .fi-wi-stats-overview-stat { animation-delay: 240ms; }
html.owner-boot .fi-wi:nth-child(8), html.owner-boot .fi-section:nth-child(8), html.owner-boot .fi-wi-stats-overview-stat:nth-child(8), html.owner-boot .fi-ta-row:nth-child(8), html.owner-boot .fi-grid-col:nth-child(8) .fi-wi-stats-overview-stat { animation-delay: 280ms; }
html.owner-boot .fi-wi:nth-child(9), html.owner-boot .fi-section:nth-child(9), html.owner-boot .fi-wi-stats-overview-stat:nth-child(9), html.owner-boot .fi-ta-row:nth-child(9), html.owner-boot .fi-grid-col:nth-child(9) .fi-wi-stats-overview-stat { animation-delay: 320ms; }
html.owner-boot .fi-wi:nth-child(10), html.owner-boot .fi-section:nth-child(10), html.owner-boot .fi-wi-stats-overview-stat:nth-child(10), html.owner-boot .fi-ta-row:nth-child(10), html.owner-boot .fi-grid-col:nth-child(10) .fi-wi-stats-overview-stat { animation-delay: 360ms; }
html.owner-boot .fi-wi:nth-child(11), html.owner-boot .fi-section:nth-child(11), html.owner-boot .fi-wi-stats-overview-stat:nth-child(11), html.owner-boot .fi-ta-row:nth-child(11), html.owner-boot .fi-grid-col:nth-child(11) .fi-wi-stats-overview-stat { animation-delay: 400ms; }
html.owner-boot .fi-wi:nth-child(n + 12), html.owner-boot .fi-section:nth-child(n + 12), html.owner-boot .fi-wi-stats-overview-stat:nth-child(n + 12), html.owner-boot .fi-ta-row:nth-child(n + 12), html.owner-boot .fi-grid-col:nth-child(n + 12) .fi-wi-stats-overview-stat { animation-delay: 440ms; }

/* ---- Press / hover ------------------------------------------------------------ */
.fi-btn,
.fi-icon-btn,
.fi-dropdown-list-item {
    transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.15s ease;
}

.fi-btn:not([disabled]):active,
.fi-icon-btn:not([disabled]):active {
    transform: scale(0.96);
}

@media (hover: hover) {
    .fi-wi-stats-overview-stat:hover,
    .fi-section:not(.fi-section-not-contained):hover {
        transform: translate3d(0, -2px, 0);
        box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--primary-500, #10b981) 40%, transparent);
    }
}

/* ---- Modals: gentle spring-like scale over a plain dim ------------------------- */
html body .fi-modal-close-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background-color: rgb(2 6 23 / 0.55);
}

html body .fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter {
    transition-timing-function: cubic-bezier(0.34, 1.35, 0.64, 1);
    transition-duration: 0.34s;
}

html body .fi-modal:not(.fi-modal-slide-over) > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter-start {
    transform: translate3d(0, 14px, 0) scale(0.94);
}

html body .fi-modal.fi-modal-slide-over > .fi-modal-window-ctn > .fi-modal-window.fi-transition-enter {
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    transition-duration: 0.34s;
}

/* ---- Toasts: slide up ---------------------------------------------------------- */
html body .fi-no .fi-no-notification.fi-transition-enter-start {
    transform: translate3d(0, 18px, 0) scale(0.98) !important;
    opacity: 0;
}

html body .fi-no .fi-no-notification.fi-transition-enter {
    transition-timing-function: cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* ---- Charts: soft fade-in of the canvas wrapper (Chart.js already draws in) ---- */
html.owner-boot .fi-wi-chart canvas {
    animation: owner-chart-in 0.5s ease 0.1s backwards;
}

@keyframes owner-chart-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Contrast guard (light mode): secondary text stays >= 4.5:1 on the tinted surfaces ---- */
html:not(.dark) .fi-wi-stats-overview-stat-label,
html:not(.dark) .fi-section-header-description,
html:not(.dark) .fi-main p {
    color: var(--gray-600, #475569);
}

/* ---- Reduced motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .fi-sidebar-item.owner-nav-glow > .fi-sidebar-item-btn {
        animation: none !important;
        background-size: 100% 100%;
        background-position: 0% 50%;
        box-shadow: 0 0 10px 1px rgba(124, 58, 237, 0.35);
    }

    .fi-main,
    html.owner-boot .fi-wi,
    html.owner-boot .fi-section,
    html.owner-boot .fi-wi-stats-overview-stat,
    html.owner-boot .fi-ta-row,
    html.owner-boot .fi-wi-chart canvas,
    .fi-sidebar-item.fi-active > .fi-sidebar-item-btn::before,
    .fi-ta.fi-loading .fi-ta-row,
    .fi-ta.fi-loading .fi-ta-cell,
    .owner-dashboard .fi-wi,
    .owner-dashboard .fi-wi-stats-overview-stat,
    .owner-dashboard .owner-dashboard-widgets--loading .fi-wi,
    .owner-dashboard .fi-wi-stats-overview-stat-value,
    .owner-dashboard .fi-wi-chart {
        animation: none !important;
    }

    .fi-btn:active,
    .fi-icon-btn:active,
    .fi-wi-stats-overview-stat:hover,
    .fi-section:hover {
        transform: none !important;
    }

    html body .fi-no .fi-no-notification.fi-transition-enter-start,
    html body .fi-modal .fi-modal-window.fi-transition-enter-start {
        transform: none !important;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }
}
