/* ──────────────────────────────────────────────────────────────────
   portal-polish.css — Fiboniq Technologies (client + IB portals)
   Centralised visual consistency. Pure additive overrides — no
   layout breakage. Loaded LAST so it wins specificity battles.

   Token source of truth: assets/css/config.css (brand --bs-primary).
   The site historically hardcodes #f16c22; this file normalises
   both #f96c06 and #f16c22 through CSS vars where possible.
   ────────────────────────────────────────────────────────────────── */

:root {
    --fb-brand:        #f16c22;
    --fb-brand-soft:   rgba(241,108,34,.10);
    --fb-brand-strong: #d8541a;
    --fb-card-radius:  14px;
    --fb-card-shadow:  0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
    --fb-card-shadow-hover: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.06);
    --fb-border-soft:  rgba(15,23,42,.06);
    --fb-text-muted:   #6b7280;
    --fb-bg-soft:      #f8fafc;
}

[data-bs-theme="dark"] {
    --fb-card-shadow:  0 1px 2px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.22);
    --fb-card-shadow-hover: 0 4px 14px rgba(0,0,0,.32);
    --fb-border-soft:  rgba(255,255,255,.07);
    --fb-text-muted:   #adb5bd;
    --fb-bg-soft:      rgba(255,255,255,.03);
}

/* ─── 1. Breadcrumbs ─────────────────────────────────────────────── */
.breadcrumb {
    font-size: 12.5px;
    margin-bottom: 0;
    padding: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--fb-text-muted);
    padding-right: .35rem;
    padding-left: .35rem;
    font-weight: 600;
}
.breadcrumb-item a {
    color: var(--fb-text-muted);
    text-decoration: none;
    transition: color .15s ease;
}
.breadcrumb-item a:hover { color: var(--fb-brand); }
.breadcrumb-item.active,
.breadcrumb-item[aria-current="page"] {
    color: var(--fb-brand) !important;
    font-weight: 600;
}

/* Standardise the H4/H5 used as page titles above breadcrumbs */
h4.fs-6,
.page-title {
    font-size: 17px !important;
    font-weight: 600 !important;
    letter-spacing: -.01em;
    margin-bottom: 4px !important;
}

/* ─── 2. Cards ───────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--fb-border-soft);
    border-radius: var(--fb-card-radius);
    box-shadow: var(--fb-card-shadow);
    transition: box-shadow .2s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--fb-card-shadow-hover); }

.card-header {
    border-bottom: 1px solid var(--fb-border-soft);
    padding: 14px 18px;
}
.card-body { padding: 18px; }

/* Stat / summary cards (compact info tiles) — uniform height */
.card.mb-0 .card-body p.text-muted.small {
    font-size: 11.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.card.mb-0 .card-body h4 {
    font-size: 19px !important;
    font-weight: 700 !important;
    letter-spacing: -.02em;
}

/* ─── 3. Buttons ─────────────────────────────────────────────────── */
.btn { font-weight: 500; }

.btn-primary,
.btn-primary:focus {
    background-color: var(--fb-brand);
    border-color: var(--fb-brand);
    box-shadow: 0 1px 2px rgba(241,108,34,.25);
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary.active {
    background-color: var(--fb-brand-strong) !important;
    border-color: var(--fb-brand-strong) !important;
    box-shadow: 0 4px 10px rgba(241,108,34,.32) !important;
}

.btn-outline-light {
    color: var(--fb-text-muted);
    border-color: var(--fb-border-soft);
    background: transparent;
}
.btn-outline-light:hover {
    background: var(--fb-bg-soft);
    color: var(--fb-brand);
    border-color: var(--fb-brand);
}

/* DataTables export buttons — visual consistency */
.buttons-csv, .buttons-print, .buttons-pdf, .buttons-excel {
    background-color: var(--fb-brand) !important;
    border-color: var(--fb-brand) !important;
    color: #fff !important;
    border-radius: .375rem !important;
}
.buttons-csv:hover, .buttons-print:hover, .buttons-pdf:hover, .buttons-excel:hover {
    background-color: var(--fb-brand-strong) !important;
    border-color: var(--fb-brand-strong) !important;
}

/* ─── 4. Badges ──────────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 11px;
    padding: .35em .6em;
    border-radius: .375rem;
    letter-spacing: .01em;
}
.badge.bg-success-subtle  { background-color: rgba(34,197,94,.12)  !important; color: #16a34a !important; }
.badge.bg-danger-subtle   { background-color: rgba(239,68,68,.12)  !important; color: #dc2626 !important; }
.badge.bg-warning-subtle  { background-color: rgba(245,158,11,.14) !important; color: #d97706 !important; }
.badge.bg-info-subtle     { background-color: rgba(59,130,246,.12) !important; color: #2563eb !important; }
.badge.bg-secondary-subtle{ background-color: rgba(107,114,128,.12)!important; color: #6b7280 !important; }
.badge.bg-primary-subtle  { background-color: var(--fb-brand-soft) !important; color: var(--fb-brand) !important; }

/* ─── 5. Tables ──────────────────────────────────────────────────── */
.table thead th {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .03em;
    color: var(--fb-text-muted);
    border-bottom: 1px solid var(--fb-border-soft);
    padding: 12px 14px;
}
.table tbody td {
    padding: 14px;
    vertical-align: middle;
    font-size: 13.5px;
    border-bottom: 1px solid var(--fb-border-soft);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background-color: var(--fb-bg-soft); }

/* Tfoot totals row */
.table tfoot tr {
    background-color: var(--fb-bg-soft) !important;
    font-weight: 600;
    border-top: 2px solid var(--fb-border-soft);
}
.table tfoot td {
    padding: 12px 14px;
    font-size: 12.5px;
}

/* Horizontal scroll hint on overflowing tables */
.table-responsive { position: relative; }
.table-responsive::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 24px;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,.85) 100%);
    opacity: 0;
    transition: opacity .2s;
}
.table-responsive.has-overflow::after { opacity: 1; }
[data-bs-theme="dark"] .table-responsive::after {
    background: linear-gradient(to right, rgba(15,23,42,0) 0%, rgba(15,23,42,.85) 100%);
}

/* ─── 6. Forms ───────────────────────────────────────────────────── */
.form-control,
.form-select {
    border-radius: 8px;
    font-size: 13.5px;
    padding: .55rem .75rem;
    border-color: var(--fb-border-soft);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--fb-brand);
    box-shadow: 0 0 0 3px var(--fb-brand-soft);
}
.form-label.small {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--fb-text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Select2 — bring in line with native inputs */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border-radius: 8px !important;
    border-color: var(--fb-border-soft) !important;
    min-height: 38px;
}
.select2-container--default.select2-container--focus .select2-selection {
    border-color: var(--fb-brand) !important;
    box-shadow: 0 0 0 3px var(--fb-brand-soft);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--fb-brand) !important;
}

/* ─── 7. Quick-preset chip buttons (filter cards) ────────────────── */
.btn-outline-secondary.rounded-1.btn-sm {
    font-size: 11.5px;
    padding: .25rem .6rem;
    border-color: var(--fb-border-soft);
    color: var(--fb-text-muted);
    background: transparent;
    transition: all .15s ease;
}
.btn-outline-secondary.rounded-1.btn-sm:hover {
    background: var(--fb-brand-soft);
    border-color: var(--fb-brand);
    color: var(--fb-brand);
}

/* ─── 8. Sidebar polish ──────────────────────────────────────────── */
.sidebar-item .sidebar-link {
    border-radius: 8px;
    transition: background-color .15s ease, color .15s ease;
}
.sidebar-item .sidebar-link.active,
.sidebar-item .sidebar-link:hover {
    background-color: var(--fb-brand-soft);
    color: var(--fb-brand) !important;
}
.sidebar-item .sidebar-link.active .sidebar-icon iconify-icon { color: var(--fb-brand) !important; }

/* ─── 9. Topbar polish ───────────────────────────────────────────── */
.topbar .nav-icon-hover-bg {
    width: 38px; height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .15s ease;
}
.topbar .nav-icon-hover-bg:hover { background-color: var(--fb-brand-soft); }

/* ─── 10. Mobile polish ──────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
    h4.fs-6, .page-title { font-size: 15.5px !important; }
    .breadcrumb { font-size: 12px; }
    .table thead th { font-size: 11px; padding: 10px 10px; }
    .table tbody td { padding: 10px; font-size: 12.5px; }

    /* Stat tile compaction */
    .card.mb-0 .card-body { padding: 10px 12px; }
    .card.mb-0 .card-body h4 { font-size: 16px !important; }

    /* Filter cards stack neatly */
    .card-body .row.g-3 > [class^="col-"] { margin-bottom: .35rem; }

    /* Action buttons inline on top of pages */
    .d-flex.align-items-center.justify-content-between .btn {
        padding: .35rem .6rem;
        font-size: 12px;
    }
}

/* ─── 11. Empty-state polish ─────────────────────────────────────── */
.fb-empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--fb-text-muted);
}
.fb-empty-state iconify-icon {
    font-size: 56px;
    display: block;
    margin: 0 auto 10px;
    color: var(--fb-brand);
    opacity: .85;
}
.fb-empty-state .fb-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}
[data-bs-theme="dark"] .fb-empty-state .fb-empty-title { color: #f1f3f5; }
.fb-empty-state .fb-empty-sub {
    font-size: 13px;
    color: var(--fb-text-muted);
    max-width: 360px;
    margin: 0 auto;
}

/* ─── 12. Brand-orange utility class (replaces hardcoded inline style="color:#f16c22") ── */
.text-brand        { color: var(--fb-brand) !important; }
.bg-brand-soft     { background-color: var(--fb-brand-soft) !important; }
.border-brand      { border-color: var(--fb-brand) !important; }
.fw-brand          { color: var(--fb-brand) !important; font-weight: 600; }

/* ─── 13. Switch / icon-button rows on action menus ──────────────── */
.icon-action-btn {
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--fb-text-muted);
    background: transparent;
    border: 1px solid var(--fb-border-soft);
    transition: all .15s ease;
    cursor: pointer;
}
.icon-action-btn:hover {
    color: var(--fb-brand);
    background: var(--fb-brand-soft);
    border-color: var(--fb-brand);
}

/* ─── 14. Brokree / share-link list refinement (used on IB dashboard) ── */
.list-group-flush .list-group-item {
    border-color: var(--fb-border-soft);
    padding: 12px 14px;
    font-size: 13px;
}

/* ─── 15. DataTables length/info row spacing ─────────────────────── */
.dataTables_length, .dataTables_info, .dataTables_paginate {
    font-size: 12.5px;
    color: var(--fb-text-muted);
}

/* ─── 16. Modals ─────────────────────────────────────────────────── */
.modal-content {
    border: 1px solid var(--fb-border-soft);
    border-radius: var(--fb-card-radius);
    box-shadow: 0 20px 50px rgba(0,0,0,.15);
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--fb-border-soft); }
.modal-header h1.modal-title { font-size: 15px; font-weight: 600; }

/* Ensure body content respects fixed mobile bottom nav (works for both portals) */
@media (max-width: 1199.98px) {
    body.has-mobile-bottom-nav { padding-bottom: 84px !important; }
}

/* ─── 17. Modal tabs — refined segmented-control look ────────────
   Replaces the AI-looking "full bright orange pill" nav-tabs that
   the brand template produces by default. Use by adding the class
   `fb-modal-tabs` to any `<ul class="nav nav-tabs">` element.
   Bootstrap's tab JavaScript is unaffected. */
.fb-modal-tabs.nav-tabs,
.nav-tabs.fb-modal-tabs {
    border-bottom: 0 !important;
    background: var(--fb-bg-soft);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 1rem !important;
    display: flex;
}
.fb-modal-tabs .nav-item { flex: 1 1 0; }
.fb-modal-tabs .nav-link,
.fb-modal-tabs .nav-link.rounded-1,
.fb-modal-tabs button.nav-link {
    width: 100% !important;
    background: transparent !important;
    border: 0 !important;
    padding: 7px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--fb-text-muted) !important;
    border-radius: 8px !important;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
    text-align: center;
}
.fb-modal-tabs .nav-link:hover { color: var(--fb-brand) !important; }
.fb-modal-tabs .nav-link.active,
.fb-modal-tabs .nav-link.show.active {
    background: #fff !important;
    color: var(--fb-brand) !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 1px rgba(0,0,0,.04);
}
[data-bs-theme="dark"] .fb-modal-tabs.nav-tabs { background: rgba(255,255,255,.04); }
[data-bs-theme="dark"] .fb-modal-tabs .nav-link.active {
    background: rgba(255,255,255,.10) !important;
    color: #ffa367 !important;
}

/* ─── 18. Modal accordion — softer "primary-subtle" look ──────────
   Existing markup uses `accordion-button bg-primary-subtle` which
   renders peach with bright orange text. Keep that but ensure the
   focus ring and expanded shadow match brand. */
.modal-body .accordion-item {
    border: 1px solid var(--fb-border-soft);
    border-radius: 10px !important;
    margin-bottom: 8px;
    overflow: hidden;
}
.modal-body .accordion-item:first-of-type,
.modal-body .accordion-item:last-of-type { border-radius: 10px !important; }
.modal-body .accordion-button:not(.collapsed) { box-shadow: none; }
.modal-body .accordion-button:focus { box-shadow: 0 0 0 3px var(--fb-brand-soft); }
