/* =============================================================
   Homline WMS — Central stylesheet
   Author: Sami SELLAMI — La Homline
   ---------------------------------------------------------------
   Scope  : shared UI primitives prefixed with .hom- used across
            Filament pages (details, reports, dashboards).
   Design : Filament-native components for semantics (badges,
            buttons) + .hom- classes for layout/cards/tables.
   Dark   : dark-mode variants via .dark ancestor (Filament sets it).
   Brand  : primary color #E53935 (Homline red).
   =============================================================*/

/* ---------- Page wrapper ---------- */
.hom-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ---------- Hero header ---------- */
.hom-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--fi-color-white, #fff);
    border: 1px solid rgb(0 0 0 / 0.05);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
.dark .hom-hero {
    background: rgb(24 24 27);
    border-color: rgb(255 255 255 / 0.08);
}

.hom-hero__primary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.hom-hero__be {
    font-family: ui-monospace, 'SF Mono', 'Menlo', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #E53935;
    line-height: 1.2;
}

.hom-hero__meta {
    font-size: 0.875rem;
    color: rgb(107 114 128);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}
.dark .hom-hero__meta { color: rgb(156 163 175); }

.hom-hero__meta span { white-space: nowrap; }
.hom-hero__meta strong {
    color: rgb(17 24 39);
    font-weight: 600;
}
.dark .hom-hero__meta strong { color: rgb(243 244 246); }

.hom-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    justify-content: flex-end;
}

/* ---------- Tabs (pill style) ---------- */
.hom-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding: 0.25rem;
    background: rgb(243 244 246);
    border-radius: 0.625rem;
}
.dark .hom-tabs { background: rgb(39 39 42); }

.hom-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(75 85 99);
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}
.dark .hom-tab { color: rgb(161 161 170); }

.hom-tab:hover {
    background: rgb(255 255 255 / 0.6);
    color: rgb(17 24 39);
}
.dark .hom-tab:hover {
    background: rgb(63 63 70 / 0.6);
    color: rgb(244 244 245);
}

.hom-tab--active {
    background: var(--fi-color-white, #fff);
    color: #E53935;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.06);
}
.dark .hom-tab--active { background: rgb(24 24 27); }

.hom-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    background: rgb(229 231 235);
    color: rgb(75 85 99);
    border-radius: 999px;
    line-height: 1;
}
.dark .hom-tab__count {
    background: rgb(63 63 70);
    color: rgb(209 213 219);
}
.hom-tab--active .hom-tab__count {
    background: rgba(229 57 53 / 0.15);
    color: #E53935;
}

/* ---------- Grid layouts ---------- */
.hom-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
    .hom-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hom-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hom-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Cards ---------- */
.hom-card {
    background: var(--fi-color-white, #fff);
    border: 1px solid rgb(0 0 0 / 0.05);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    overflow: hidden;
}
.dark .hom-card {
    background: rgb(24 24 27);
    border-color: rgb(255 255 255 / 0.08);
}

.hom-card__header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgb(0 0 0 / 0.05);
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(75 85 99);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dark .hom-card__header {
    color: rgb(161 161 170);
    border-color: rgb(255 255 255 / 0.08);
}
.hom-card__header::before {
    content: '';
    width: 3px;
    height: 1rem;
    background: #E53935;
    border-radius: 999px;
}

.hom-card__body { padding: 1rem 1.25rem; }
.hom-card__body--flush { padding: 0; }

/* ---------- Key-value pairs ---------- */
.hom-kv {
    display: grid;
    gap: 0.75rem 1.5rem;
    grid-template-columns: max-content 1fr;
    font-size: 0.875rem;
    line-height: 1.4;
}
.hom-kv dt {
    color: rgb(107 114 128);
    font-weight: 400;
}
.dark .hom-kv dt { color: rgb(156 163 175); }

.hom-kv dd {
    color: rgb(17 24 39);
    font-weight: 500;
    overflow-wrap: anywhere;
}
.dark .hom-kv dd { color: rgb(229 231 235); }

/* Utility modifiers for <dd> cells */
.hom-mono {
    font-family: ui-monospace, 'SF Mono', 'Menlo', monospace;
    font-size: 0.8125rem;
}
.hom-muted {
    color: rgb(156 163 175);
    font-weight: 400;
}
.dark .hom-muted { color: rgb(113 113 122); }

.hom-strong { font-weight: 600; }
.hom-accent { color: #E53935; font-weight: 600; }

/* ---------- Data tables ---------- */
.hom-table-wrap {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid rgb(0 0 0 / 0.05);
}
.dark .hom-table-wrap { border-color: rgb(255 255 255 / 0.08); }

.hom-table-wrap--flush {
    border: none;
    border-radius: 0;
}

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

.hom-table thead { background: rgb(249 250 251); }
.dark .hom-table thead { background: rgb(39 39 42); }

.hom-table th {
    padding: 0.625rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(75 85 99);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    text-align: left;
}
.dark .hom-table th { color: rgb(161 161 170); }

.hom-table tbody tr { border-top: 1px solid rgb(0 0 0 / 0.04); }
.dark .hom-table tbody tr { border-color: rgb(255 255 255 / 0.06); }

.hom-table tbody tr:hover { background: rgb(249 250 251 / 0.6); }
.dark .hom-table tbody tr:hover { background: rgb(39 39 42 / 0.4); }

.hom-table td {
    padding: 0.625rem 0.875rem;
    color: rgb(17 24 39);
}
.dark .hom-table td { color: rgb(229 231 235); }

.hom-table tfoot {
    background: rgb(249 250 251);
    font-weight: 600;
}
.dark .hom-table tfoot { background: rgb(39 39 42); }

.hom-table tfoot td {
    padding: 0.625rem 0.875rem;
    color: rgb(17 24 39);
}
.dark .hom-table tfoot td { color: rgb(243 244 246); }

/* Table alignment helpers (usable on th and td) */
.hom-text-end { text-align: right !important; }
.hom-text-center { text-align: center !important; }

/* ---------- Empty state ---------- */
.hom-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgb(156 163 175);
}
.dark .hom-empty { color: rgb(113 113 122); }

.hom-empty--compact { padding: 1rem 0; }

/* ---------- Chip rows (for badges wrappers) ---------- */
.hom-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* ---------- Notes block (colored callout) ---------- */
.hom-notes {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgb(254 242 242);
    color: rgb(153 27 27);
    border-left: 3px solid #E53935;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}
.dark .hom-notes {
    background: rgb(69 10 10 / 0.3);
    color: rgb(252 165 165);
}
.hom-notes strong {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

/* ---------- Footer actions row ---------- */
.hom-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

/* ---------- Back button (in-header) ---------- */
.hom-back {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(75 85 99);
    background: rgb(243 244 246);
    border: 1px solid rgb(0 0 0 / 0.05);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 150ms ease;
    width: fit-content;
}
.dark .hom-back {
    color: rgb(209 213 219);
    background: rgb(39 39 42);
    border-color: rgb(255 255 255 / 0.08);
}
.hom-back:hover {
    background: rgb(229 231 235);
    color: rgb(17 24 39);
}
.dark .hom-back:hover {
    background: rgb(63 63 70);
    color: rgb(244 244 245);
}
.hom-back__icon {
    font-size: 1em;
    line-height: 1;
}

/* ---------- Copy-to-clipboard ---------- */
.hom-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    padding: 1px 4px;
    margin: -1px -4px;
    border-radius: 0.25rem;
    transition: background-color 120ms ease;
    position: relative;
}
.hom-copy:hover {
    background: rgb(229 231 235 / 0.6);
}
.dark .hom-copy:hover {
    background: rgb(63 63 70 / 0.5);
}

.hom-copy__icon {
    opacity: 0;
    font-size: 0.75rem;
    color: rgb(107 114 128);
    transition: opacity 120ms ease;
    user-select: none;
}
.dark .hom-copy__icon { color: rgb(156 163 175); }
.hom-copy:hover .hom-copy__icon { opacity: 1; }

.hom-copy--copied { background: rgba(229 57 53 / 0.1); }
.dark .hom-copy--copied { background: rgba(229 57 53 / 0.2); }
.hom-copy--copied .hom-copy__icon {
    opacity: 1;
    color: #E53935;
}

/* ---------- Discrepancy badge (inline warning) ---------- */
.hom-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    color: rgb(146 64 14);
    background: rgb(254 243 199);
    border-radius: 999px;
    white-space: nowrap;
}
.dark .hom-delta {
    color: rgb(253 224 71);
    background: rgb(69 26 3 / 0.5);
}

.hom-delta--danger {
    color: rgb(153 27 27);
    background: rgb(254 226 226);
}
.dark .hom-delta--danger {
    color: rgb(252 165 165);
    background: rgb(69 10 10 / 0.5);
}

/* ---------- Extended grid — 6-column responsive ---------- */
.hom-grid-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) {
    .hom-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
    .hom-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
