/*
 * LAWGO admin panel: the app's look on Filament (docs/design-assets/tokens.css,
 * design.md §4 and §6). Served from public/brand (not public/admin: nginx would take /admin for that folder). Loaded after Filament's own CSS by AdminPanelProvider.
 * Filament's rules sit in cascade layers, so these unlayered rules win without
 * !important. Colour scales (primary, gray…) are set in AdminPanelProvider.
 */

@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/IBMPlexSansArabic-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/IBMPlexSansArabic-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/ReadexPro-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/ReadexPro-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/ReadexPro-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/ReadexPro-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
    --lg-forest-deep: #002623;
    --lg-forest-dark: #054239;
    --lg-forest: #428177;
    --lg-forest-mid: #1D7669;
    --lg-wheat-light: #EDEBE0;
    --lg-wheat: #B9A779;
    --lg-wheat-dark: #988561;
    --lg-umber: #6B1F2A;
    --lg-charcoal: #3D3A3B;

    --lg-bg: #F6F5EF;
    --lg-surface: #FFFFFF;
    --lg-surface-muted: #FAF9F5;
    --lg-border: #E2DFD2;
    --lg-text: #161616;
    --lg-text-muted: #3D3A3B;
    --lg-primary: #054239;
    --lg-primary-soft: #E3EFEC;
    --lg-heading: #054239;

    --lg-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
    --lg-radius-card: 12px;
    --lg-radius-button: 10px;
    --lg-radius-tag: 6px;
    --lg-pattern-green: url("pattern-on-green.svg");
    --lg-pattern-green-small: url("pattern-on-green-small.svg");

    --topbar-height: 4rem;
}

.dark {
    --lg-bg: #162723;
    --lg-surface: #1C2D29;
    --lg-surface-muted: #213530;
    --lg-border: #2E4C46;
    --lg-text: #EDEBE0;
    --lg-text-muted: #C9B98D;
    --lg-primary: #8CCBC0;
    --lg-primary-soft: #2E554D;
    --lg-heading: #EDEBE0;
}

/* ── Page ─────────────────────────────────────────────────────────────── */

.fi-body {
    background-color: var(--lg-bg);
    color: var(--lg-text);
}

.fi-header-heading,
.fi-section-header-heading,
.fi-modal-heading,
.fi-simple-header-heading,
.fi-ta-header-heading,
.fi-wi-stats-overview-stat-value,
.fi-sidebar-group-label,
.fi-btn,
.fi-tabs-item,
.fi-badge,
.fi-fo-field-label-content,
.fi-ta-header-cell {
    font-family: var(--lg-display);
}

.fi-header-heading {
    color: var(--lg-heading);
    font-weight: 700;
    letter-spacing: 0;
}

.fi-header-subheading,
.fi-breadcrumbs-item-label {
    color: var(--lg-text-muted);
}

/* ── Topbar: the app's green header with the star pattern ─────────────── */

/*
 * The bar is 64px: the pattern at its 120px period showed only parts of stars.
 * Here it repeats small, one tile per bar height so every star is whole, from
 * a copy drawn with a thicker stroke so the line stays the app's 1.5px. It
 * fades out under the logo, at the start of the bar.
 */
.fi-topbar,
.fi-sidebar-header {
    background:
        linear-gradient(to left, var(--lg-forest-dark) 0%, rgb(5 66 57 / 0) 40%),
        var(--lg-pattern-green-small) 0 0 / var(--topbar-height) var(--topbar-height) repeat,
        var(--lg-forest-dark);
}

[dir="ltr"] .fi-topbar,
[dir="ltr"] .fi-sidebar-header {
    background:
        linear-gradient(to right, var(--lg-forest-dark) 0%, rgb(5 66 57 / 0) 40%),
        var(--lg-pattern-green-small) 0 0 / var(--topbar-height) var(--topbar-height) repeat,
        var(--lg-forest-dark);
}

.fi-topbar {
    box-shadow: inset 0 -2px 0 var(--lg-wheat-dark);
}

.fi-topbar .fi-icon-btn,
.fi-topbar .fi-topbar-open-sidebar-btn,
.fi-topbar .fi-topbar-close-sidebar-btn {
    color: var(--lg-wheat-light);
}

.fi-topbar .fi-icon-btn:hover,
.fi-topbar .fi-icon-btn:focus-visible {
    background-color: rgb(255 255 255 / 0.1);
}

.fi-topbar .fi-input-wrp {
    background-color: var(--lg-wheat-light);
    box-shadow: none;
    border-radius: var(--lg-radius-button);
}

.fi-topbar .fi-input-wrp .fi-input,
.fi-topbar .fi-input-wrp .fi-icon {
    color: var(--lg-text-muted);
}

.dark .fi-topbar .fi-input-wrp .fi-input,
.dark .fi-topbar .fi-input-wrp .fi-icon {
    color: #3D3A3B;
}

.fi-topbar .fi-avatar,
.fi-topbar .fi-user-avatar {
    box-shadow: 0 0 0 2px var(--lg-wheat);
}

/* On green the logo is always the white one. */
.fi-topbar .fi-logo.fi-logo-light,
.fi-sidebar-header .fi-logo.fi-logo-light {
    display: none;
}

.fi-topbar .fi-logo.fi-logo-dark,
.fi-sidebar-header .fi-logo.fi-logo-dark {
    display: flex;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

@media (min-width: 1024px) {
    .fi-sidebar {
        background-color: var(--lg-surface);
        border-inline-end: 1px solid var(--lg-border);
    }
}

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

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

.fi-sidebar-group-label {
    color: var(--lg-wheat-dark);
    font-size: 0.8125rem;
    font-weight: 600;
}

.dark .fi-sidebar-group-label {
    color: var(--lg-wheat);
}

.fi-sidebar-item-btn {
    border-radius: var(--lg-radius-button);
}

.fi-sidebar-item-label {
    color: var(--lg-text);
}

.fi-sidebar-item-btn > .fi-icon {
    color: var(--lg-forest-mid);
}

.dark .fi-sidebar-item-btn > .fi-icon {
    color: #8FC6BC;
}

.fi-sidebar-item.fi-sidebar-item-has-url > .fi-sidebar-item-btn:hover,
.fi-sidebar-item.fi-sidebar-item-has-url > .fi-sidebar-item-btn:focus-visible {
    background-color: var(--lg-bg);
}

/* The current page: the soft green pill with the marker bar of the app's cards. */
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--lg-primary-soft);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn::before {
    content: "";
    position: absolute;
    inset-block: 0.5rem;
    inset-inline-start: 0;
    width: 3px;
    border-radius: 3px;
    background-color: var(--lg-primary);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-icon,
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-sidebar-item-label {
    color: var(--lg-primary);
    font-weight: 600;
}

/* ── Cards: white, a hairline border, no shadow (tokens: shadow-none) ──── */

.fi-section:not(.fi-section-not-contained),
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-fo-repeater-item,
.fi-in-repeatable-item {
    background-color: var(--lg-surface);
    border-radius: var(--lg-radius-card);
    box-shadow: 0 0 0 1px var(--lg-border);
}

.fi-modal-window,
.fi-dropdown-panel {
    border-radius: var(--lg-radius-card);
}

.fi-section-header-heading {
    color: var(--lg-heading);
}

/* Stats: the marker bar of the app's cards. */
.fi-wi-stats-overview-stat {
    overflow: hidden;
}

.fi-wi-stats-overview-stat::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background-color: var(--lg-primary);
}

.fi-wi-stats-overview-stat-value {
    color: var(--lg-heading);
    font-weight: 700;
}

/* ── Tables ───────────────────────────────────────────────────────────── */

.fi-ta-ctn {
    overflow: hidden;
}

.fi-ta-header-cell {
    background-color: var(--lg-surface-muted);
    color: var(--lg-text-muted);
    font-weight: 600;
}

.fi-ta-row:hover {
    background-color: var(--lg-surface-muted);
}

/* ── Controls ─────────────────────────────────────────────────────────── */

.fi-btn {
    border-radius: var(--lg-radius-button);
    font-weight: 500;
}

.fi-input-wrp {
    border-radius: var(--lg-radius-button);
}

.fi-badge {
    border-radius: var(--lg-radius-tag);
}

.fi-tabs-item {
    border-radius: var(--lg-radius-button);
}

.fi-tabs-item.fi-active {
    background-color: var(--lg-primary-soft);
}

/* ── Sign-in and the other simple pages: the green ground of the splash ─ */

.fi-simple-layout {
    background: var(--lg-forest-dark) var(--lg-pattern-green) repeat;
    background-size: 120px 120px;
}

.fi-simple-main {
    border-radius: 16px;
    box-shadow: 0 24px 48px -16px rgb(0 38 35 / 0.55), 0 0 0 1px rgb(185 167 121 / 0.35);
}

.fi-simple-header .fi-logo {
    margin-bottom: 1.25rem;
}

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

.fi-simple-layout-header .fi-icon-btn {
    color: var(--lg-wheat-light);
}

/* ── Our own views (resources/views/filament) ─────────────────────────────
 * The panel has no Tailwind build: only Filament's own classes exist, so a
 * utility class (p-4, rounded-lg…) in a custom view does nothing. Custom
 * views use these lg-* classes instead.
 */

.lg-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lg-callout {
    border-radius: var(--lg-radius-button);
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5rem;
}

.lg-callout-warning {
    background-color: #F3EEDF;
    color: #5A4D33;
    box-shadow: inset 0 0 0 1px #E6DCC0;
}

.dark .lg-callout-warning {
    background-color: #4A4330;
    color: #D2C49A;
    box-shadow: none;
}

.lg-path {
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: var(--lg-text-muted);
    overflow-wrap: anywhere;
}

.lg-frame {
    display: block;
    width: 100%;
    border: 1px solid var(--lg-border);
    border-radius: var(--lg-radius-card);
    background-color: var(--lg-surface);
}

.lg-frame-tall {
    height: 80vh;
}

/* A Word file's text: read like the app's reader, on its wheat reading ground. */
.lg-textbox {
    overflow-y: auto;
    padding: 1rem 1.25rem;
    background-color: #FBFAF6;
    font-size: 0.9375rem;
    line-height: 1.9;
    white-space: pre-line;
}

.dark .lg-textbox {
    background-color: #1C2D29;
}

.lg-empty {
    border: 1px dashed var(--lg-border);
    border-radius: var(--lg-radius-card);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--lg-text-muted);
}

.lg-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.lg-table th {
    padding: 0.5rem 0.75rem;
    text-align: start;
    font-family: var(--lg-display);
    font-weight: 600;
    color: var(--lg-text-muted);
    background-color: var(--lg-surface-muted);
}

.lg-table td {
    padding: 0.5rem 0.75rem;
    text-align: start;
    border-top: 1px solid var(--lg-border);
}

.lg-table tr.lg-current td {
    font-weight: 600;
    background-color: var(--lg-primary-soft);
}

.lg-link {
    color: var(--lg-primary);
    font-weight: 500;
}

.lg-link:hover {
    text-decoration: underline;
}

.lg-grid-3 {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .lg-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.lg-figure {
    font-family: var(--lg-display);
    font-size: 1.875rem;
    line-height: 2.5rem;
    font-weight: 700;
    color: var(--lg-heading);
}

.lg-figure-sm {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.lg-note,
.lg-muted {
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--lg-text-muted);
}

.lg-ok { color: #1D7669; }
.lg-warn { color: #6E5F3F; }
.lg-danger { color: #6B1F2A; }
.dark .lg-ok { color: #85C6BB; }
.dark .lg-warn { color: #D2C49A; }
.dark .lg-danger { color: #EFAAB1; }

.lg-file {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--lg-border);
    border-radius: var(--lg-radius-card);
    background-color: var(--lg-surface-muted);
}

.lg-file-main {
    flex: 1;
    min-width: 0;
}

.lg-file-name {
    font-family: var(--lg-display);
    font-weight: 600;
    color: var(--lg-heading);
    overflow-wrap: anywhere;
}

.lg-button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    border-radius: var(--lg-radius-button);
    background-color: #054239;
    color: #FFFFFF;
    font-family: var(--lg-display);
    font-size: 0.875rem;
    font-weight: 500;
}

.lg-button:hover {
    background-color: #1D7669;
}

.lg-callout-info {
    background-color: var(--lg-primary-soft);
    color: var(--lg-heading);
}

.lg-strong {
    font-weight: 600;
    white-space: nowrap;
}

.lg-value {
    color: var(--lg-text);
    overflow-wrap: anywhere;
}
