/* ============================================================
   MTN FX Design System
   ------------------------------------------------------------
   Single source of truth for tokens and shared UI components.
   Loaded after the theme CSS (app.min / custom.min) so equal-
   specificity rules here win the cascade.

   Conventions (see CLAUDE.md):
   - Chrome (labels, titles, buttons, column headers) is small
     bold uppercase; content stays normal case.
   - Black (#1a1a1a) banners + blue (#2563eb) accents.
   - No decorative icons.

   Pages may still carry local :root copies of these tokens —
   values are identical; delete local copies as pages get
   touched. New pages should rely on this file only.
   ============================================================ */

:root {
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --blue-dark: #1d4ed8;
    --black: #111111;
    --gray-900: #1a1a1a;
    --gray-800: #2d2d2d;
    --gray-700: #404040;
    --gray-600: #525252;
    --gray-500: #737373;
    --gray-400: #a3a3a3;
    --gray-300: #d4d4d4;
    --gray-200: #e5e5e5;
    --gray-100: #f5f5f5;
    --gray-50: #fafafa;
    --white: #ffffff;
    --red: #dc2626;
    --green: #16a34a;
    --yellow: #ca8a04;
    --orange: #ea580c;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --banner-bg: #1a1a1a;
}

/* ─── Accessibility ─────────────────────────────────────────
   Keyboard focus ring (mouse clicks unaffected). */
:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ─── Bootstrap / Velzon brand overrides ───────────────────
   The theme ships its own "primary"; everything below pins it
   to the MTN FX blue so legacy pages match the custom modules. */
.btn-primary {
    background-color: var(--blue);
    border-color: var(--blue);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn-primary:disabled {
    background-color: var(--blue-dark);
    border-color: var(--blue-dark);
}
.btn-outline-primary {
    color: var(--blue);
    border-color: var(--blue);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.btn-soft-primary {
    background-color: var(--blue-light);
    color: var(--blue);
    border-color: transparent;
}
.btn-link { color: var(--blue); }
.btn-link:hover { color: var(--blue-dark); }

.page-item.active .page-link {
    background-color: var(--blue);
    border-color: var(--blue);
}
.page-link { color: var(--blue); }
.page-link:hover { color: var(--blue-dark); }

.form-check-input:checked {
    background-color: var(--blue);
    border-color: var(--blue);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--blue);
}
.nav-tabs .nav-link.active { color: var(--blue); }

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--blue);
    color: #fff;
}

.text-primary { color: var(--blue) !important; }
.bg-primary { background-color: var(--blue) !important; }
.border-primary { border-color: var(--blue) !important; }
.badge.bg-primary { background-color: var(--blue) !important; }

/* ─── Page banner ───────────────────────────────────────────
   Standard black page header. New pages: use these classes
   instead of hand-rolling a per-page header. */
.mtnfx-banner {
    background: var(--banner-bg);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mtnfx-banner--floating { border-radius: 8px; margin-bottom: 16px; }

.mtnfx-banner h1,
.mtnfx-banner-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.mtnfx-banner p,
.mtnfx-banner-subtitle {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    margin: 2px 0 0;
    text-transform: none;
}

/* ─── Section label ─────────────────────────────────────────
   Quiet caps with a rule line extending across the row. */
.mtnfx-section-label {
    color: var(--gray-900);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mtnfx-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-300);
}

/* ─── Buttons ───────────────────────────────────────────────
   Compact button family used across module headers. */
.mtnfx-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--blue);
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s;
    line-height: 1.4;
}
.mtnfx-btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; text-decoration: none; }

.mtnfx-btn--secondary {
    background: var(--white);
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.mtnfx-btn--secondary:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--gray-900); }

.mtnfx-btn--danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}
.mtnfx-btn--danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Dark-banner variant: translucent white chip */
.mtnfx-btn--ghost {
    background: rgba(255,255,255,0.1);
    border-color: transparent;
    color: #fff;
}
.mtnfx-btn--ghost:hover { background: rgba(255,255,255,0.2); color: #fff; }

.mtnfx-btn:disabled,
.mtnfx-btn.busy {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Busy spinner: add .busy to any .mtnfx-btn (or use data-busy JS helper) */
.mtnfx-btn.busy::before {
    content: '';
    width: 11px;
    height: 11px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mtnfx-spin 0.7s linear infinite;
}
.mtnfx-btn--secondary.busy::before {
    border-color: var(--gray-300);
    border-top-color: var(--gray-600);
}

/* Busy state also works on Bootstrap buttons (mtnfxBusy helper) */
.btn.busy {
    opacity: 0.65;
    pointer-events: none;
}
.btn.busy::before {
    content: '';
    display: inline-block;
    width: 11px;
    height: 11px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mtnfx-spin 0.7s linear infinite;
    margin-right: 6px;
    vertical-align: -1px;
}

/* ─── Cards ────────────────────────────────────────────────── */
.mtnfx-card {
    background: var(--white);
    border: 1px solid var(--blue);
    border-radius: 6px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    transition: all 0.2s;
}
.mtnfx-card--hover { cursor: pointer; }
.mtnfx-card--hover:hover {
    border-color: var(--blue-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.mtnfx-card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-900);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mtnfx-card-desc {
    font-size: 10px;
    color: var(--gray-500);
    line-height: 1.3;
    text-transform: none;
}

/* ─── Loading ─────────────────────────────────────────────── */
@keyframes mtnfx-spin { to { transform: rotate(360deg); } }

.mtnfx-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: mtnfx-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

/* ─── Empty state ─────────────────────────────────────────── */
.mtnfx-empty {
    padding: 50px 20px;
    text-align: center;
    color: var(--gray-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-transform: none;
}
.mtnfx-empty h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin: 0 0 6px;
}
.mtnfx-empty p {
    font-size: 11px;
    margin: 0 0 12px;
}

/* ─── Toast (save/error feedback) ─────────────────────────── */
#mtnfx-toast-stack {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.mtnfx-toast {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid var(--blue);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    padding: 9px 14px;
    min-width: 190px;
    max-width: 340px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: auto;
}
.mtnfx-toast.show { opacity: 1; transform: translateY(0); }
.mtnfx-toast--success { border-color: var(--green); }
.mtnfx-toast--error { border-color: var(--red); }

/* ─── Tables ───────────────────────────────────────────────
   Module table pattern: caps micro-headers, tight rows,
   numerics right-aligned with tabular figures. */
.mtnfx-table { width: 100%; margin: 0; font-size: 11px; border-collapse: collapse; }
.mtnfx-table th {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 7px 10px;
    background: var(--gray-100);
    color: var(--gray-600);
    text-align: left;
    border: none;
}
.mtnfx-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    text-transform: none;
}
.mtnfx-table tbody tr:hover { background: var(--gray-50); }
.mtnfx-table tfoot td,
.mtnfx-table tfoot th {
    background: var(--gray-100);
    font-weight: 700;
    color: var(--gray-900);
    border-top: 2px solid var(--gray-300);
}
.mtnfx-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Utility: tabular figures anywhere (counts, currency, coords) */
.tnum { font-variant-numeric: tabular-nums; }

/* ─── DataTables skin ──────────────────────────────────────
   Restyles the stock DataTables chrome (length menu, search,
   info line, pagination) plus in-table typography to match the
   module table pattern. Applies to all DataTables pages. */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-900);
    text-transform: none;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
    outline: none;
}

table.dataTable thead th,
table.dataTable thead td {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

table.dataTable tbody td {
    font-size: 11px;
    color: var(--gray-700);
}

table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * {
    box-shadow: none;
    background: var(--gray-50);
}

table.dataTable tbody tr:hover td {
    background: var(--blue-light);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff !important;
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: 11px;
    padding: 3px 9px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-900) !important;
    border-radius: 4px;
}

/* ─── Legacy Bootstrap table alignment ─────────────────────
   Brings plain .table pages (inventory, shipments, users)
   toward the module pattern without markup changes. */
.table > thead > tr > th {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    background: var(--gray-100);
}

.table > tbody > tr > td {
    font-size: 11px;
    color: var(--gray-700);
    vertical-align: middle;
}

/* ─── Status indicators ────────────────────────────────────
   Colored dot + small caps text — NOT pill badges (no rounded
   colored backgrounds; that reads as generic SaaS). Color
   carries meaning only; neutral gray by default. */
.mtnfx-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    white-space: nowrap;
}
.mtnfx-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.mtnfx-status--blue { color: var(--blue); }
.mtnfx-status--green { color: var(--green); }
.mtnfx-status--red { color: var(--red); }
.mtnfx-status--yellow { color: var(--yellow); }

/* ── Date-picker calendar: brand it MTN FX blue (overrides the Velzon template navy #405189) ── */
.flatpickr-weekdays,
span.flatpickr-weekday { background-color: var(--blue) !important; color: #fff !important; }
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover { background: var(--blue) !important; border-color: var(--blue) !important; }
.flatpickr-day.today { border-color: var(--blue) !important; }
.flatpickr-day:hover:not(.selected):not(.flatpickr-disabled) { background: var(--blue-light) !important; border-color: var(--blue-light) !important; }
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: var(--blue) !important; }

/* ── Retheme Bootstrap "danger" buttons ─────────────────────────────────
   The Velzon theme's danger orange (#f06548) is off-palette. Map the
   btn-danger family to MTN FX blue site-wide. Loaded last, no !important,
   so pages with deliberate local styling (e.g. PWL's white/red) still win. */
.btn-danger {
    --vz-btn-bg: #2563eb;
    --vz-btn-border-color: #2563eb;
    --vz-btn-hover-bg: #1d4ed8;
    --vz-btn-hover-border-color: #1d4ed8;
    --vz-btn-active-bg: #1d4ed8;
    --vz-btn-active-border-color: #1d4ed8;
    --vz-btn-disabled-bg: #2563eb;
    --vz-btn-disabled-border-color: #2563eb;
    background-color: #2563eb;
    border-color: #2563eb;
}
.btn-danger:hover, .btn-danger:focus, .btn-danger:active {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}
.btn-outline-danger {
    --vz-btn-color: #2563eb;
    --vz-btn-border-color: #2563eb;
    --vz-btn-hover-bg: #2563eb;
    --vz-btn-hover-border-color: #2563eb;
    --vz-btn-active-bg: #2563eb;
    color: #2563eb;
    border-color: #2563eb;
}
.btn-outline-danger:hover, .btn-outline-danger:focus, .btn-outline-danger:active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.btn-soft-danger {
    --vz-btn-color: #2563eb;
    --vz-btn-bg: #eff6ff;
    --vz-btn-hover-bg: #2563eb;
    color: #2563eb;
    background-color: #eff6ff;
    border-color: transparent;
}
.btn-soft-danger:hover, .btn-soft-danger:focus, .btn-soft-danger:active {
    background-color: #2563eb;
    color: #fff;
}
