/* ═══════════════════════════════════════════════════════════════
   Halgazdaság — Filament Admin Custom Styles
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=DM+Mono:wght@300;400;500&display=swap');

/* ── 1. Design tokens ─────────────────────────────────────────── */
:root {
    --hal-ink:        #0b1622;
    --hal-deep:       #0d2035;
    --hal-mid:        #0e3d52;
    --hal-accent:     #2a9d8f;
    --hal-accent2:    #e9c46a;
    --hal-silver:     #a8c4c8;
    --hal-foam:       #e8f4f3;
    --hal-glass:      rgba(13, 32, 53, 0.72);
    --hal-border:     rgba(42,157,143,.22);
}

/* ── 2. Table rows ──────────────────────────────────────────────
   Subtle hover highlight — box-shadow inset left accent, NO
   position:relative (breaks table cell alignment in some browsers)
   ─────────────────────────────────────────────────────────────── */
.fi-ta-row {
    transition: background .18s ease !important;
}

.fi-ta-row:hover td,
.fi-ta-row:hover [role="cell"] {
    background: rgba(42, 157, 143, .04) !important;
}

/* Left accent via first-cell border instead of ::before */
.fi-ta-row:hover td:first-child,
.fi-ta-row:hover [role="cell"]:first-child {
    box-shadow: inset 3px 0 0 var(--hal-accent);
}

/* ── 3. Table header cells ──────────────────────────────────────
   Uppercase, mono, smaller — like a data sheet header.
   letter-spacing kept minimal to avoid misalignment with long HU labels.
   ─────────────────────────────────────────────────────────────── */
.fi-ta-header-cell {
    font-family: 'DM Mono', monospace !important;
    font-size: .68rem !important;
    font-weight: 500 !important;
    letter-spacing: .03em !important;
    text-transform: uppercase !important;
    opacity: .75;
}

/* ── 4. Table cell text ─────────────────────────────────────────
   Slightly larger, mono for numbers
   ─────────────────────────────────────────────────────────────── */
.fi-ta-cell {
    font-family: 'DM Mono', monospace !important;
    font-size: .82rem !important;
}

/* ── 5. Badges ──────────────────────────────────────────────────
   Pill style with slightly more padding
   ─────────────────────────────────────────────────────────────── */
.fi-badge {
    font-family: 'DM Mono', monospace !important;
    font-size: .65rem !important;
    font-weight: 500 !important;
    letter-spacing: .08em !important;
    padding: .2rem .65rem !important;
    border-radius: 999px !important;
}

/* ── 6. Navigation ──────────────────────────────────────────────
   Tighten sidebar items and add a left-accent active indicator
   ─────────────────────────────────────────────────────────────── */
.fi-sidebar-nav-item-label {
    font-family: 'DM Mono', monospace !important;
    font-size: .78rem !important;
    letter-spacing: .06em !important;
}

/* ── 7. Page heading ────────────────────────────────────────────
   Use Cormorant for h1/h2 in the Filament panel
   ─────────────────────────────────────────────────────────────── */
.fi-header-heading {
    font-family: 'Cormorant Garamond', serif !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    letter-spacing: -.01em !important;
}

/* ── 8. Buttons — primary ───────────────────────────────────────
   Teal instead of default Filament amber/blue
   ─────────────────────────────────────────────────────────────── */
.fi-btn-color-primary {
    --c-400: 42 157 143 !important;
    --c-500: 38 140 128 !important;
    --c-600: 32 120 110 !important;
}

/* ── 9. Stats widgets (dashboard) ───────────────────────────────
   Kompaktabb méret: nagy képernyőn sem túl hatalmas,
   mobilon belefér két oszlopba.
   ─────────────────────────────────────────────────────────────── */
.fi-wi-stats-overview-stat-value {
    font-family: 'DM Mono', monospace !important;
    font-size: 1.1rem !important;
    line-height: 1.25 !important;
    letter-spacing: -.02em !important;
}

.fi-wi-stats-overview-stat-label {
    font-family: 'DM Mono', monospace !important;
    font-size: .68rem !important;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
    opacity: .65 !important;
}

.fi-wi-stats-overview-stat-description {
    font-size: .72rem !important;
}

/* Header-sávos stats card design, a készlet kártyák stílusához igazítva */
.fi-wi-stats-overview-stat {
    overflow: hidden !important;
    border: 1px solid var(--hal-border) !important;
}

.fi-wi-stats-overview-stat-label-ctn {
    margin: -1.5rem -1.5rem .65rem !important;
    padding: .38rem .7rem !important;
    background: var(--hal-mid);
    color: #e8f4f3 !important;
}

.fi-wi-stats-overview-stat-label {
    color: inherit !important;
    font-weight: 700 !important;
    opacity: 1 !important;
}

.fi-wi-stats-overview-stat .fi-icon {
    color: inherit !important;
    opacity: .9;
}

.fi-wi-stats-overview-stat.hal-theme--warning .fi-wi-stats-overview-stat-label-ctn {
    background: #9a6a00;
}

.fi-wi-stats-overview-stat.hal-theme--teal .fi-wi-stats-overview-stat-label-ctn {
    background: #0e3d52;
}

.fi-wi-stats-overview-stat.hal-theme--info .fi-wi-stats-overview-stat-label-ctn {
    background: #1d4ed8;
}

.fi-wi-stats-overview-stat.hal-theme--success .fi-wi-stats-overview-stat-label-ctn {
    background: #166534;
}

/* Mobilon 2 oszlop a stat widgetnél */
@media (max-width: 767px) {
    .fi-wi-stats-overview {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: .5rem !important;
    }
    .fi-wi-stats-overview-stat-value {
        font-size: .88rem !important;
    }
    .fi-wi-stats-overview-stat-description {
        font-size: .64rem !important;
    }
    .fi-wi-stats-overview-stat-label-ctn {
        margin: -1.5rem -1.5rem .55rem !important;
        padding: .34rem .55rem !important;
    }
    .fi-wi-stats-overview-stat-label {
        font-size: .62rem !important;
        letter-spacing: .05em !important;
    }
}

/* ── 9b-stat. Stat kártyák (TodayActivity, OpenOrders) ─────────
   Ugyanolyan vizuális stílus mint a készlet cardok, de rendelés/
   szállítás témaszínekkel. Count balra, Ft jobbra (top-right).
   ─────────────────────────────────────────────────────────────── */
.hal-stat-grid {
    display: grid;
    gap: .45rem;
}
.hal-stat-grid--2 { grid-template-columns: repeat(2, 1fr); }
.hal-stat-grid--3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 479px) {
    .hal-stat-grid--2,
    .hal-stat-grid--3 { grid-template-columns: 1fr; }
}
@media (min-width: 480px) and (max-width: 767px) {
    .hal-stat-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

.hal-stat-card {
    display: flex;
    flex-direction: column;
    border-radius: .5rem;
    overflow: hidden;
    border: 1px solid var(--hal-border);
    background: #fff;
    text-decoration: none;
    transition: box-shadow .18s ease, transform .12s ease;
}
.dark .hal-stat-card {
    background: rgb(24 36 50 / .7);
}
.hal-stat-card:hover {
    box-shadow: 0 4px 16px rgba(42,157,143,.15);
    transform: translateY(-1px);
}

/* Header strip — téma szerint színezett */
.hal-stat-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .35rem;
    padding: .36rem .6rem;
    background: var(--hal-mid);
    color: #e8f4f3;
}
.hal-stat-card--warning .hal-stat-hdr  { background: #9a6a00; }
.hal-stat-card--teal    .hal-stat-hdr  { background: #0e3d52; }
.hal-stat-card--info    .hal-stat-hdr  { background: #1d4ed8; }
.hal-stat-card--success .hal-stat-hdr  { background: #166534; }

.hal-stat-hdr-left {
    display: flex;
    align-items: center;
    gap: .3rem;
    min-width: 0;
}
.hal-stat-icon {
    width: .9rem;
    height: .9rem;
    flex-shrink: 0;
    color: inherit;
    opacity: .85;
}
.hal-stat-label {
    font-family: 'DM Mono', monospace;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
}
.hal-stat-ft {
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    font-weight: 500;
    color: rgba(232, 244, 243, .80);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Body — nagy szám */
.hal-stat-body {
    padding: .42rem .6rem .5rem;
    display: flex;
    align-items: baseline;
}
.hal-stat-val {
    font-family: 'DM Mono', monospace;
    font-size: .9rem;
    font-weight: 700;
    color: var(--hal-ink);
    line-height: 1.2;
}
.dark .hal-stat-val { color: #e8f4f3; }

@media (min-width: 640px) {
    .hal-stat-label { font-size: .64rem; }
    .hal-stat-ft    { font-size: .7rem; }
    .hal-stat-val   { font-size: 1rem; }
    .hal-stat-hdr   { padding: .38rem .7rem; }
    .hal-stat-body  { padding: .5rem .7rem .55rem; }
}
@media (min-width: 1024px) {
    .hal-stat-label { font-size: .68rem; }
    .hal-stat-ft    { font-size: .72rem; }
    .hal-stat-val   { font-size: 1.1rem; }
}

/* ── 9b. Készlet-kártya grid (StockSummaryWidget) ───────────────
   Mobile-first: telefonon kompakt 1 oszlop, majd skálázódik fel.
   ─────────────────────────────────────────────────────────────── */
.hal-stock-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .45rem;
}

@media (max-width: 359px) {
    .hal-stock-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 640px) {
    .hal-stock-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .6rem;
    }
}

@media (min-width: 1024px) {
    .hal-stock-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: .75rem;
    }
}

.hal-stock-card {
    border-radius: .65rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--hal-border);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s ease, transform .18s ease;
}

.dark .hal-stock-card {
    background: rgb(30 41 59 / .6);
    border-color: rgba(255,255,255,.08);
}

.hal-stock-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 32, 53, .12);
}

.hal-stock-card--danger .hal-stock-hdr {
    background: #1e293b !important;
}

/* Fejléc-sáv */
.hal-stock-hdr {
    background: #1e293b;
    color: #e8f4f3;
    padding: .3rem .5rem;
    font-family: 'DM Mono', monospace;
    font-size: .58rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    min-width: 0;
}
.hal-stock-hdr-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hal-stock-hdr-badges {
    display: flex;
    flex-shrink: 0;
    gap: .2rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}
.hal-stock-hdr-badge {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    padding: .08rem .3rem;
    border-radius: .25rem;
    font-size: .6rem;
    font-weight: 700;
    line-height: 1.4;
    background: rgba(15, 23, 42, .45);
    color: rgba(255,255,255,.88);
    white-space: nowrap;
}

.hal-stock-body {
    padding: .4rem .5rem .45rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .08rem;
    align-items: baseline;
}

.hal-stock-val {
    font-family: 'DM Mono', monospace;
    font-size: .76rem;
    font-weight: 700;
    color: var(--hal-ink);
    line-height: 1.2;
}

.dark .hal-stock-val { color: #e8f4f3; }

.hal-stock-val--alert,
.dark .hal-stock-val--alert {
    display: inline-flex;
    align-items: center;
    align-self: start;
    padding: .1rem .4rem;
    border-radius: .3rem;
    background: #fee2e2;
    color: #be1b1b;
    border: 1px solid #fca5a5;
}
.dark .hal-stock-val--alert {
    background: rgba(190, 27, 27, .25);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, .4);
}

.hal-stock-kg {
    font-family: 'DM Mono', monospace;
    font-size: .66rem;
    color: var(--hal-mid);
    line-height: 1.2;
    text-align: right;
}

.dark .hal-stock-kg { color: var(--hal-silver); }

.hal-stock-kg--alert,
.dark .hal-stock-kg--alert {
    display: inline-flex;
    align-items: center;
    align-self: start;
    justify-self: end;
    padding: .1rem .4rem;
    border-radius: .3rem;
    background: #fee2e2;
    color: #be1b1b;
    border: 1px solid #fca5a5;
    text-align: right;
}
.dark .hal-stock-kg--alert {
    background: rgba(190, 27, 27, .25);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, .4);
}

.hal-stock-avg {
    font-family: 'DM Mono', monospace;
    font-size: .62rem;
    color: #6b7280;
    margin-top: .1rem;
    grid-column: 1 / -1;
}

/* Kényelmesebb olvasás tableten/felfelé */
@media (min-width: 640px) {
    .hal-stock-hdr  { font-size: .64rem; padding: .34rem .6rem; }
    .hal-stock-body { padding: .46rem .6rem .5rem; }
    .hal-stock-val  { font-size: .84rem; }
    .hal-stock-kg   { font-size: .72rem; }
    .hal-stock-avg  { font-size: .64rem; }
}

@media (min-width: 1024px) {
    .hal-stock-hdr  { font-size: .7rem; }
    .hal-stock-val  { font-size: .92rem; }
    .hal-stock-kg   { font-size: .78rem; }
    .hal-stock-avg  { font-size: .64rem; }
}

/* ── 10. Form section headings ──────────────────────────────────
   Cormorant italic for form group titles
   ─────────────────────────────────────────────────────────────── */
.fi-fo-field-wrp-label {
    font-family: 'DM Mono', monospace !important;
    font-size: .72rem !important;
    letter-spacing: .07em !important;
    text-transform: uppercase !important;
}

/* ── 11. Dashboard scroll-nav (topbar tabs) ─────────────────────
   3 kis tab a topbar-ban, csak a dashboard oldalon jelenik meg.
   ─────────────────────────────────────────────────────────────── */
.dash-scroll-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-right: .75rem;
}

.dash-scroll-tab {
    display: inline-flex;
    align-items: center;
    padding: .22rem .65rem;
    border-radius: .4rem;
    font-family: 'DM Mono', monospace;
    font-size: .67rem;
    font-weight: 500;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--hal-mid);
    background: var(--hal-foam);
    border: 1px solid var(--hal-border);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}

.dark .dash-scroll-tab {
    color: var(--hal-silver);
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.1);
}

.dash-scroll-tab:hover {
    background: var(--hal-mid);
    color: #fff;
    border-color: var(--hal-mid);
}

@media (max-width: 479px) {
    .dash-scroll-tab {
        font-size: .58rem;
        padding: .18rem .45rem;
    }
}

/* ── 13. Table wrapper: subtle top border accent ──────────────── */
.fi-ta-wrap {
    border-top: 2px solid var(--hal-accent) !important;
    border-radius: .75rem !important;
    overflow: hidden;
}

/* ── 14. Mobil 2 soros oszlopfejléc (globális) ──────────────────
   A RelationManager-ek a szerkesztő oldalon élnek, ezért az alap
   2 soros fejléc-stílus globálisan kell, ne csak a lista partialokban.
   ─────────────────────────────────────────────────────────────── */
.hal-mobile-header-label {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .1rem;
    line-height: 1.05;
}

.hal-mobile-header-label .hal-mobile-header-sub {
    font-size: .62rem;
    opacity: .75;
}

/* ── 15. Rendelés / Szállítás tétel RelationManager mobil ───────
   A :has() szelektor csak azokra a tétel-táblákra hat, amelyekben
   a mobil összevont oszlopok szerepelnek, így nem érint más listát.
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .fi-ta-table:has(.fi-ta-cell-qty-mobile),
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) {
        table-layout: fixed;
        width: 100%;
    }

    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-product\.name,
    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-header-cell-product\.name {
        width: 38% !important;
    }

    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-qty-mobile,
    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-header-cell-qty-mobile,
    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-value-mobile,
    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-header-cell-value-mobile {
        width: 23% !important;
    }

    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-cell-product\.name,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-header-cell-product\.name {
        width: 36% !important;
    }

    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-cell-ordered-mobile,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-header-cell-ordered-mobile,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-cell-shipped-mobile,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-header-cell-shipped-mobile {
        width: 22% !important;
    }

    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-product\.name .fi-ta-text-item-label,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-cell-product\.name .fi-ta-text-item-label {
        white-space: normal;
        line-height: 1.15;
    }

    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-qty-mobile,
    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-value-mobile,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-cell-ordered-mobile,
    .fi-ta-table:has(.fi-ta-cell-ordered-mobile) .fi-ta-cell-shipped-mobile {
        padding-left: .25rem !important;
        padding-right: .25rem !important;
    }

    .fi-ta-table:has(.fi-ta-cell-qty-mobile) .fi-ta-cell-value-mobile .fi-ta-text-item-label {
        white-space: nowrap;
    }
}

@media (max-width: 767px) {
    /* Global mobile select readability across Filament filters/forms. */
    .fi-fo-select-native select,
    .fi-fo-select-native select option,
    .fi-select-input-btn,
    .fi-select-input-option,
    .fi-select-input-placeholder,
    .fi-select-input-value-ctn,
    .fi-select-input-search-ctn input,
    .fi-pagination-records-per-page-select {
        font-size: 16px !important;
        line-height: 1.35 !important;
    }
}

