/* FX Vendor Portal Styles — CoreUI theme with orange branding */
:root {
    --fx-brand: #e8590c;
    --fx-brand-light: #f76707;
}

body {
    font-family: 'Sarabun', sans-serif;
}

/* ── Sidebar — Orange gradient (both light & dark) ────────── */
.sidebar,
.sidebar.fx-sidebar,
[data-coreui-theme="dark"] .sidebar,
[data-coreui-theme="dark"] .sidebar.fx-sidebar {
    --cui-sidebar-bg: #e8590c;
    background: linear-gradient(135deg, #e8590c, #f76707) !important;
    background-image: linear-gradient(135deg, #e8590c, #f76707) !important;
}
.sidebar .sidebar-header {
    background: rgba(0,0,0,0.1) !important;
    border-bottom-color: rgba(255,255,255,0.2) !important;
}
.sidebar .sidebar-brand,
.sidebar .sidebar-brand-full,
.sidebar .sidebar-brand-narrow {
    color: #fff !important;
}
/* FX badge — matches header, readable on orange sidebar */
.fx-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 32px;
    padding: 0 0.5rem;
    background: #fff;
    color: #e8590c;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
a:hover > .fx-logo-badge,
a:focus-visible > .fx-logo-badge {
    background: #fff5f0;
    color: #d04a00;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}
.sidebar-brand-full:hover .fx-brand-text,
.sidebar-brand-narrow:hover { /* keep text crisp under brand anchor hover */
    color: #fff;
    opacity: 0.92;
}
/* Header brand hover — subtle brand tint without changing background */
.header a.link-body-emphasis {
    transition: color 0.15s ease, background-color 0.15s ease;
    border-radius: 0.375rem;
}
.header a.link-body-emphasis:hover {
    background-color: rgba(232, 89, 12, 0.08);
    color: var(--fx-brand, #e8590c) !important;
}

/* Sidebar brand rows — let CoreUI toggle visibility via narrow state */
.sidebar .sidebar-brand-full.fx-brand-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
}
.sidebar .sidebar-brand-full.fx-brand-row .fx-brand-text {
    font-size: 1.05rem;
    line-height: 1;
    white-space: nowrap;
}
.sidebar .sidebar-brand-narrow.fx-brand-narrow {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Narrow state — hide expanded row, show compact */
.sidebar-narrow .sidebar-brand-full.fx-brand-row,
.sidebar-narrow-unfoldable:not(:hover) .sidebar-brand-full.fx-brand-row {
    display: none !important;
}
.sidebar-narrow .sidebar-brand-narrow.fx-brand-narrow,
.sidebar-narrow-unfoldable:not(:hover) .sidebar-brand-narrow.fx-brand-narrow {
    display: flex !important;
}
/* Expanded state — hide compact, show full */
.sidebar:not(.sidebar-narrow):not(.sidebar-narrow-unfoldable) .sidebar-brand-narrow.fx-brand-narrow,
.sidebar-narrow-unfoldable:hover .sidebar-brand-narrow.fx-brand-narrow {
    display: none !important;
}
.sidebar .sidebar-toggler {
    background-color: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,255,255,0.2) !important;
}
.sidebar .sidebar-toggler::after {
    filter: brightness(0) invert(1);
}
.sidebar .btn-close {
    filter: brightness(0) invert(1);
}
.sidebar .nav-link {
    color: rgba(255,255,255,0.85) !important;
}
.sidebar .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.1) !important;
}
.sidebar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.2) !important;
}
.sidebar .nav-icon {
    color: rgba(255,255,255,0.7) !important;
}
.sidebar .nav-link.active .nav-icon,
.sidebar .nav-link:hover .nav-icon {
    color: #fff !important;
}

/* ── Header ───────────────────────────────────────────────── */

/* ── Brand color utilities ────────────────────────────────── */
.text-brand {
    color: var(--fx-brand) !important;
}
.bg-brand {
    background: linear-gradient(135deg, #e8590c, #f76707) !important;
}
.btn-brand {
    background-color: var(--fx-brand);
    border-color: var(--fx-brand);
    color: #fff;
}
.btn-brand:hover {
    background-color: var(--fx-brand-light);
    border-color: var(--fx-brand-light);
    color: #fff;
}

/* ── Payment page ─────────────────────────────────────────── */
.pay-container {
    max-width: 480px;
    margin: 0 auto;
}
.amount-badge {
    display: inline-block;
    padding: 12px 24px;
    margin: 6px;
    font-size: 1.25rem;
    font-weight: 600;
    border: 2px solid #e8590c;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--cui-body-bg, #fff);
    color: #e8590c;
}
.amount-badge:hover,
.amount-badge.active {
    background: #e8590c;
    color: #fff;
}

/* ── PIN input ────────────────────────────────────────────── */
.pin-input {
    letter-spacing: 1rem;
    font-size: 2rem;
    text-align: center;
    font-weight: 700;
}

/* ── Success animation ────────────────────────────────────── */
.success-check {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #2eb85c;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: scaleIn 0.3s ease-out;
}
.success-check i {
    color: #fff;
    font-size: 2.5rem;
}
@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Transaction feed header toggles — flex-align the switch and its icon
 * so the slider and the speaker/chat glyph sit on the same horizontal
 * line. Bootstrap's default float-based layout drifts visually when the
 * label only holds a single-line icon. */
.transaction-feed .form-check.form-switch {
    display: inline-flex;
    align-items: center;
    padding-left: 0;
    gap: 0.5rem;
}
.transaction-feed .form-check.form-switch .form-check-input {
    float: none;
    margin: 0;
}
.transaction-feed .form-check.form-switch .form-check-label {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* ── Large switch toggle (NX design system) ──────────────── */
.form-switch-xl .form-check-input {
    width: 3rem;
    height: 1.5rem;
    margin-top: .15rem;
}

/* ── Vendor avatar ────────────────────────────────────────── */
.vendor-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fx-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ── Dark theme tuning (match NX look & feel) ─────────────── */
[data-coreui-theme="dark"] {
    --fx-brand: #f76707;
    --fx-brand-light: #ff922b;
}
[data-coreui-theme="dark"] body {
    background-color: #1a1d24;
}
[data-coreui-theme="dark"] .wrapper,
[data-coreui-theme="dark"] .body.flex-grow-1 {
    background-color: #1a1d24;
}
[data-coreui-theme="dark"] header.header {
    background-color: rgba(33, 38, 49, 0.85) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
[data-coreui-theme="dark"] header.header .border-bottom {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
[data-coreui-theme="dark"] .breadcrumb .breadcrumb-item,
[data-coreui-theme="dark"] .breadcrumb .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.65);
}
[data-coreui-theme="dark"] .breadcrumb .breadcrumb-item.active {
    color: rgba(255, 255, 255, 0.85);
}

/* Cards & dashboard tiles */
[data-coreui-theme="dark"] .card {
    background-color: #212631;
    border-color: rgba(255, 255, 255, 0.08);
    color: #e6e8eb;
}
[data-coreui-theme="dark"] .card .card-header,
[data-coreui-theme="dark"] .bg-body-tertiary {
    background-color: #2a303d !important;
    border-color: rgba(255, 255, 255, 0.06);
}
[data-coreui-theme="dark"] .text-body-secondary {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Amount badges must stay readable in dark mode */
[data-coreui-theme="dark"] .amount-badge {
    background: #212631;
    color: var(--fx-brand-light);
    border-color: var(--fx-brand-light);
}
[data-coreui-theme="dark"] .amount-badge:hover,
[data-coreui-theme="dark"] .amount-badge.active {
    background: var(--fx-brand);
    color: #fff;
    border-color: var(--fx-brand);
}

/* Keep the same bright orange sidebar in dark mode */
[data-coreui-theme="dark"] .sidebar {
    background: linear-gradient(135deg, #e8590c, #f76707) !important;
}

/* Mobile tap-target hardening — WCAG 2.5.5 minimum 44×44px. Only applies
 * below the desktop sidebar breakpoint so it doesn't bloat the CoreUI
 * header on large screens. */
@media (max-width: 991.98px) {
    .header .header-toggler,
    .header .btn.btn-link.nav-link,
    .header .nav-item > .nav-link,
    .header .nav-item > a.nav-link,
    .header .btn-close.d-lg-none,
    .transaction-feed #fullscreenBtn,
    .transaction-feed .form-check.form-switch label {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* Avatar dropdown trigger — the link wraps a 36px circle, bump the
     * hit area without enlarging the visual avatar. */
    .header .nav-item.dropdown > .nav-link {
        padding: 0.35rem 0.5rem;
    }
    /* Breadcrumb links sit at 18px tall — that's a tap target for navigation.
     * Add vertical padding so they meet the 44px floor. Center-align the row
     * so anchored items line up with plain-text items (labels without url). */
    .header .breadcrumb {
        align-items: center;
    }
    .header .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
        float: none;
    }
    .header .breadcrumb .breadcrumb-item > a {
        display: inline-block;
        padding: 0.75rem 0.25rem;
    }
    /* Header brand link — wraps the FX badge + "Vendor" text, currently 30px tall. */
    .header a.link-body-emphasis {
        min-height: 44px;
        padding: 0.25rem 0.25rem;
    }
    /* Sidebar chrome — the close button and brand link only become
     * tappable when the sidebar is open, but they still need to meet the
     * floor. */
    .sidebar .sidebar-header .btn-close {
        width: 44px;
        height: 44px;
        background-position: center;
        background-size: 18px;
    }
    .sidebar .sidebar-brand .sidebar-brand-full {
        min-height: 44px;
    }
    .sidebar .sidebar-brand .sidebar-brand-full > a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0.25rem 0;
    }
    /* All buttons and button-styled links must meet 44×44px on mobile.
     * btn-sm gets the same treatment because tap accuracy matters more
     * than visual density on touch screens. min-width catches icon-only
     * buttons like the row detail arrow. */
    .btn,
    a.btn {
        min-height: 44px;
        min-width: 44px;
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }
    /* CoreUI form-switch uses a hidden input behind a visual track — bump
     * the visible label so the whole row is an oversized tap target. */
    .form-check.form-switch {
        min-height: 44px;
        padding-top: 0.5rem;
    }
}
