/*
 * ASG theme for the Filament admin panel.
 *
 * Mirrors the company site (asg.co.id): navy #08265D + gold #CC9C49, DM Sans.
 * Loaded through a PanelsRenderHook::HEAD_END <link> in AdminPanelProvider,
 * after Filament's own CSS, so no build step is needed. Filament's bundle
 * does not scan app views, so classes used by custom Blade views (asg-*)
 * are defined here as well.
 */

:root {
    --asg-navy: #08265d;
    --asg-navy-light: #123b7a;
    --asg-navy-dark: #051a42;
    --asg-gold: #cc9c49;
    --asg-gold-light: #e2c27f;
    --asg-radius: 0.875rem;
}

/* Navy is too dark for filled buttons on the dark theme; lift the shades
   Filament uses for primary backgrounds there. */
.dark {
    --primary-600: oklch(0.43 0.12 260);
    --primary-700: oklch(0.38 0.11 260);
}

body.fi-body {
    letter-spacing: -0.005em;
}

/* ---------- Page background ---------- */
.fi-body:not(:has(.fi-simple-layout)) {
    background-color: #f4f6fb;
}

.dark .fi-body:not(:has(.fi-simple-layout)) {
    background-color: #060d1c;
}

/* ---------- Topbar ---------- */
.fi-topbar {
    background-color: rgb(255 255 255 / 0.85);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 3px 0 var(--asg-gold), 0 1px 0 rgb(8 38 93 / 0.08);
}

.dark .fi-topbar {
    background-color: rgb(5 14 33 / 0.85);
    box-shadow: inset 0 3px 0 var(--asg-gold), 0 1px 0 rgb(255 255 255 / 0.06);
}

/* ---------- Sidebar ---------- */
.fi-sidebar-group-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fi-sidebar-item-btn {
    border-radius: 0.625rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--asg-navy);
    box-shadow: 0 6px 16px -8px rgb(8 38 93 / 0.7);
}

.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: #fff;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-sidebar-item-grouped-border > .fi-sidebar-item-grouped-border-part {
    background-color: var(--asg-gold);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-badge {
    background-color: var(--asg-gold);
    color: var(--asg-navy-dark);
    --tw-ring-color: transparent;
}

.dark .fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--asg-navy-light);
}

/* Active parent ("Opportunity" while a stage child is open) */
.fi-sidebar-item.fi-sidebar-item-has-active-child-items > .fi-sidebar-item-btn > .fi-sidebar-item-label,
.fi-sidebar-item.fi-sidebar-item-has-active-child-items > .fi-sidebar-item-btn > .fi-icon {
    color: var(--asg-navy);
    font-weight: 600;
}

.dark .fi-sidebar-item.fi-sidebar-item-has-active-child-items > .fi-sidebar-item-btn > .fi-sidebar-item-label,
.dark .fi-sidebar-item.fi-sidebar-item-has-active-child-items > .fi-sidebar-item-btn > .fi-icon {
    color: var(--asg-gold-light);
}

/* ---------- Page header ---------- */
.fi-header-heading {
    color: var(--asg-navy);
    letter-spacing: -0.02em;
}

.dark .fi-header-heading {
    color: #fff;
}

/* ---------- Cards: sections, tables, widgets ---------- */
.fi-section:not(.fi-section-not-contained):not(.fi-aside),
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-wi-chart .fi-section {
    border-radius: var(--asg-radius);
    box-shadow: 0 1px 2px rgb(8 38 93 / 0.04), 0 8px 24px -12px rgb(8 38 93 / 0.12);
}

.dark .fi-section:not(.fi-section-not-contained):not(.fi-aside),
.dark .fi-ta-ctn,
.dark .fi-wi-stats-overview-stat {
    box-shadow: none;
}

.fi-section:not(.fi-section-not-contained):not(.fi-aside) > .fi-section-header .fi-icon {
    color: var(--asg-gold);
}

/* Stat cards get a gold accent bar */
.fi-wi-stats-overview-stat {
    position: relative;
    overflow: hidden;
}

.fi-wi-stats-overview-stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--asg-gold-light), var(--asg-gold));
}

.fi-wi-stats-overview-stat-value {
    color: var(--asg-navy);
    letter-spacing: -0.02em;
}

.dark .fi-wi-stats-overview-stat-value {
    color: #fff;
}

/* Table header row */
.fi-ta-header-cell {
    background-color: #f7f9fd;
}

.dark .fi-ta-header-cell {
    background-color: rgb(255 255 255 / 0.03);
}

/* ---------- Buttons ---------- */
.fi-btn {
    border-radius: 0.625rem;
}

/* ---------- Login / simple pages ---------- */
.fi-body:has(.fi-simple-layout) {
    background-color: #040a18;
    background-image:
        radial-gradient(60% 70% at 72% 30%, rgb(18 59 122 / 0.75), transparent 70%),
        radial-gradient(35% 40% at 85% 75%, rgb(204 156 73 / 0.18), transparent 70%),
        radial-gradient(50% 60% at 10% 100%, rgb(8 38 93 / 0.8), transparent 70%);
    background-attachment: fixed;
}

.fi-simple-layout {
    position: relative;
}

.fi-simple-layout::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgb(255 255 255 / 0.14) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(70% 70% at 60% 45%, black, transparent);
}

.fi-simple-main {
    position: relative;
    border-radius: 1.25rem;
    border-top: 4px solid var(--asg-gold);
    box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.55);
}

.fi-simple-header-heading {
    color: var(--asg-navy);
}

.dark .fi-simple-header-heading {
    color: #fff;
}

.fi-simple-header .fi-logo {
    height: 3.25rem !important;
}

/* ---------- Quotation editor page (custom Blade view) ---------- */
.asg-callout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border-radius: var(--asg-radius);
    border: 1px solid #ecd8a9;
    background-color: #fbf7ee;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #634a25;
}

.asg-callout svg {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    color: var(--asg-gold);
}

.dark .asg-callout {
    border-color: rgb(204 156 73 / 0.3);
    background-color: rgb(204 156 73 / 0.08);
    color: #ecd8a9;
}

.asg-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.asg-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #f1f5f9;
    color: #475569;
}

.asg-badge::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 9999px;
    background-color: currentColor;
}

.asg-badge[data-state="saved"] { background-color: #d1fae5; color: #047857; }
.asg-badge[data-state="dirty"] { background-color: #fef3c7; color: #b45309; }
.asg-badge[data-state="error"] { background-color: #ffe4e6; color: #be123c; }

.dark .asg-badge { background-color: rgb(255 255 255 / 0.08); color: #cbd5e1; }
.dark .asg-badge[data-state="saved"] { background-color: rgb(16 185 129 / 0.15); color: #6ee7b7; }
.dark .asg-badge[data-state="dirty"] { background-color: rgb(245 158 11 / 0.15); color: #fcd34d; }
.dark .asg-badge[data-state="error"] { background-color: rgb(244 63 94 / 0.15); color: #fda4af; }

.asg-editor-frame {
    height: 78vh;
    min-height: 600px;
    overflow: hidden;
    border-radius: var(--asg-radius);
    border: 1px solid #e2e8f0;
    background-color: #fff;
    box-shadow: 0 8px 24px -12px rgb(8 38 93 / 0.18);
}

.dark .asg-editor-frame {
    border-color: rgb(255 255 255 / 0.1);
}

/* Empty state used in the item list of the View page */
.asg-muted {
    color: #94a3b8;
    font-style: italic;
}

.asg-stack > * + * {
    margin-top: 1rem;
}
