/*
 * Haraka Pay responsive layer.
 * Loaded after custom.css by the wallet, merchant, PSP and checkout layouts.
 *
 * Breakpoints: phone < 576px, tablet 576-991px, desktop >= 992px.
 * The sidebar becomes a menu button below 992px (see the sidebar partials).
 */

/* ---- base ------------------------------------------------------------ */
html { -webkit-text-size-adjust: 100%; }
img, video, canvas, svg, iframe { max-width: 100%; }
img, video { height: auto; }
.row > *, .card, .card-body { min-width: 0; }

/* Long values (balances, references, emails) must wrap instead of overflowing their card. */
.card-body p,
.card-body a,
.card-body span,
.card-body h1, .card-body h2, .card-body h3, .card-body h4, .card-body h5, .card-body h6,
.breadcrumb-item,
.alert,
address {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Balance and amount figures can be very long: let them break inside the card. */
.card-body .d-flex > p,
.card-body a > p { min-width: 0; overflow-wrap: anywhere; }

/* Wide content scrolls inside itself rather than widening the page. */
pre, code { white-space: pre-wrap; word-break: break-word; }

/* ---- header ---------------------------------------------------------- */
header .logo-img img,
header .navbar-brand img { max-height: 48px; width: auto; max-width: 100%; object-fit: contain; }


/* ---- tablet and below ------------------------------------------------ */
@media (max-width: 991.98px) {
    /* comfortable tap targets */
    .btn, .page-link, .dropdown-item, .nav-link { min-height: 38px; }
    .btn-sm, .btn-xs, .action-btn { min-height: 34px; min-width: 34px; }

    /* the sidebar becomes a menu: give it room above the content */
    #collapseAccountMenu { margin-bottom: 1rem; }
}

/* ---- phone ----------------------------------------------------------- */
@media (max-width: 575.98px) {
    /* keep inputs at 16px so iOS does not zoom on focus */
    input, select, textarea, .form-control, .form-select { font-size: 16px; }

    header .logo-img { width: auto !important; flex: 0 0 auto; }
    header .container.d-flex > * { min-width: 0; }
    header .navbar-nav { flex-wrap: nowrap; gap: .5rem; min-width: 0; margin-left: auto; }
    header .navbar-nav .nav-item { min-width: 0; }
    header .navbar-nav .nav-item .fs-16 { font-size: 14px; }
    /* a long user name is cut with an ellipsis instead of widening the page */
    header .navbar-nav .nav-item.dropdown > a {
        display: inline-block; max-width: 42vw; overflow: hidden;
        text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
    }

    /* page title row: title on its own line, link below */
    .card-header .d-flex.justify-content-between { flex-wrap: wrap; gap: .25rem .75rem; }
    .card-header .d-flex.justify-content-between > .row { margin-left: 0; margin-right: 0; flex: 1 1 100%; min-width: 0; }
    .card-header .d-flex.justify-content-between > .row > * { padding-left: 0; padding-right: 0; }
    .card-header .row > h1.col-6,
    .card-header .row > .col-6 { flex: 0 0 100%; max-width: 100%; }
    .breadcrumb { flex-wrap: wrap; }

    /* buttons that sit in a row become easy to hit */
    .btn { padding-top: .5rem; padding-bottom: .5rem; }

    .card-body { padding-left: .75rem; padding-right: .75rem; }
    h1, .h1 { font-size: 1.6rem; }
    h2, .h2 { font-size: 1.4rem; }
}

/* ---- large desktop --------------------------------------------------- */
@media (min-width: 1400px) {
    .my-account-section .container { max-width: 1320px; }
}

/* ---- mobile menu drawer (slides in from the left below 992px) -------- */
.pay-drawer-backdrop { display: none; }
@media (max-width: 991.98px) {
    .pay-drawer {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 290px; max-width: 86vw;
        z-index: 1055;
        display: block !important;
        padding: 0 !important; margin: 0 !important;
        background: #fff;
        overflow-y: auto; overscroll-behavior: contain;
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform .25s ease, visibility 0s linear .25s;
        box-shadow: 0 0 24px rgba(0, 0, 0, .25);
    }
    .pay-drawer.drawer-open { transform: none; visibility: visible; transition: transform .25s ease; }
    .pay-drawer .my-account-tab { border-radius: 0 !important; box-shadow: none !important; }
    .pay-drawer-head {
        display: flex; align-items: center; justify-content: space-between;
        padding: .75rem 1rem; border-bottom: 1px solid rgba(0, 0, 0, .08);
        font-weight: 700; position: sticky; top: 0; background: #fff; z-index: 1;
    }
    .pay-drawer-close {
        border: 0; background: transparent; font-size: 1.75rem; line-height: 1;
        padding: 0 .25rem; min-width: 38px; min-height: 38px; cursor: pointer;
    }
    .pay-drawer-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1050;
        background: rgba(0, 0, 0, .5);
        opacity: 0; visibility: hidden;
        transition: opacity .25s ease, visibility 0s linear .25s;
    }
    .pay-drawer-backdrop.show { opacity: 1; visibility: visible; transition: opacity .25s ease; }
    body.pay-drawer-lock { overflow: hidden; }
}
@media (min-width: 992px) {
    .pay-drawer-head { display: none; }
}

/* ---- compact tabs (data-pay-tabs-dropdown) ---------------------------- */
.pay-tab-dropdown { display: none; position: relative; margin-bottom: .5rem; }
.pay-tab-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: .5rem .5rem; font-weight: 800; text-align: left;
    background: #fff; color: var(--bs-primary, #3f78e0);
    border: 2px solid currentColor; border-radius: .5rem; cursor: pointer;
}
.pay-tab-toggle .fa { margin-left: .5rem; transition: transform .15s ease; }
.pay-tab-toggle[aria-expanded="true"] .fa { transform: rotate(180deg); }
.pay-tab-menu {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1040;
    max-height: 60vh; overflow-y: auto; padding: .25rem 0;
    background: #fff; border: 1px solid rgba(0, 0, 0, .1); border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.pay-tab-menu.show { display: block; }
.pay-tab-item {
    display: block; width: 100%; padding: .6rem 1rem; text-align: left;
    background: transparent; border: 0; color: inherit; cursor: pointer;
}
.pay-tab-item:hover, .pay-tab-item:focus { background: rgba(63, 120, 224, .08); outline: 0; }
.pay-tab-item.active { font-weight: 700; color: var(--bs-primary, #3f78e0); background: rgba(63, 120, 224, .1); }

@media (max-width: 767.98px) {
    ul.nav-pills[data-pay-tabs-dropdown] { display: none !important; }
    .pay-tab-dropdown { display: block; }
}
@media (min-width: 768px) {
    ul.nav-pills[data-pay-tabs-dropdown] {
        flex-wrap: nowrap; overflow-x: auto; gap: .25rem;
        margin-bottom: 1rem; padding-bottom: .35rem;
        border-bottom: 1px solid rgba(0, 0, 0, .08);
        scrollbar-width: thin;
    }
    ul.nav-pills[data-pay-tabs-dropdown] .nav-item { flex: 0 0 auto; }
    ul.nav-pills[data-pay-tabs-dropdown] .nav-link {
        padding: .35rem .7rem !important; font-size: 14px !important; line-height: 1.4 !important;
        white-space: nowrap; border-radius: .4rem; margin: 0 !important;
    }
}

/* ---- small buttons ---------------------------------------------------- */
/* The theme's btn-sm is still ~44px tall; make it a genuinely compact button. */
.btn-sm:not(.btn-xs) {
    padding: .3rem .75rem;
    font-size: 13px;
    line-height: 1.45;
    border-radius: .35rem;
}

/* ---- compact site header ---------------------------------------------- */
/* top bar: one slim, vertically centred row at every width */
header .bg-gradient-reverse-primary { padding-top: .3rem !important; padding-bottom: .3rem !important; }
header .bg-gradient-reverse-primary > .container.d-flex { align-items: center; min-height: 40px; }
header .bg-gradient-reverse-primary .container > .d-flex { align-items: center !important; }
header .bg-gradient-reverse-primary .navbar-brand {
    display: flex; align-items: center; width: auto !important; margin: 0; padding: 0;
}
header .bg-gradient-reverse-primary .logo-img { height: auto !important; min-height: 0 !important; line-height: 1; }
header .bg-gradient-reverse-primary .navbar-brand a { display: flex; align-items: center; margin: 0 !important; }
header .bg-gradient-reverse-primary .logo-img img,
header .bg-gradient-reverse-primary .navbar-brand img { height: 46px; max-height: 46px; width: auto; }
header .bg-gradient-reverse-primary .navbar-nav { align-items: center; gap: .6rem; }
header .bg-gradient-reverse-primary .navbar-nav .nav-item { margin: 0; }
header .bg-gradient-reverse-primary .navbar-nav .nav-item > a { margin-top: 0 !important; }
header .bg-gradient-reverse-primary .navbar-nav .btn { margin-left: 0 !important; }

/* the fixed bar is now ~46px, so the content does not need a 100px gap */
.my-account-section.mt-15 { margin-top: 74px !important; }
.my-account-section > .container > .card.mt-5 { margin-top: 1rem !important; }

/* page title block: title and breadcrumb share one line */
.my-account-section .card-header { padding-top: .4rem !important; padding-bottom: .4rem !important; }
.my-account-section .card-header .d-flex.justify-content-between > .row {
    flex: 1 1 auto; flex-wrap: nowrap; align-items: baseline; justify-content: space-between;
    margin-left: 0; margin-right: 0;
}
.my-account-section .card-header .row > h1 {
    flex: 0 1 auto; width: auto; max-width: none; margin: 0 1rem 0 0; padding: 0;
    font-size: 1.15rem; line-height: 1.3;
}
.my-account-section .card-header .row > nav { flex: 0 0 auto; width: auto; max-width: none; margin-left: auto; padding: 0; }
.my-account-section .card-header .breadcrumb { margin: 0; padding: 0; font-size: .85rem; flex-wrap: nowrap; white-space: nowrap; }

@media (max-width: 575.98px) {
    header .bg-gradient-reverse-primary .logo-img img,
    header .bg-gradient-reverse-primary .navbar-brand img { height: 40px; max-height: 40px; }
    .my-account-section.mt-15 { margin-top: 66px !important; }
    /* phones: title above, breadcrumb below, both tight */
    .my-account-section .card-header .d-flex.justify-content-between > .row { flex-wrap: wrap; }
    .my-account-section .card-header .row > h1 { flex: 0 0 100%; margin: 0; font-size: 1.05rem; }
    .my-account-section .card-header .row > nav { margin-left: 0; }
    .my-account-section .card-header .breadcrumb { font-size: .8rem; }
}

/* ---- input focus: 2px solid border, no box-shadow ---------------------- */
/* The 2px line is drawn inside the field's own edge, so focusing never moves or resizes anything. */
.form-control:focus,
.form-select:focus,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="color"]):not([type="reset"]):focus,
select:focus,
textarea:focus {
    border-color: var(--bs-primary, #3f78e0) !important;
    outline: 2px solid var(--bs-primary, #3f78e0) !important;
    outline-offset: -2px !important;
    box-shadow: none !important;
}

/* ---- small floating-label fields -------------------------------------- */
/* The theme fixes floating fields at ~52px and a -sm select collapses to auto width; keep them full width and compact. */
.form-floating > .form-control-sm,
.form-floating > .form-select-sm {
    width: 100%;
    height: 44px;
    min-height: 44px;
    line-height: 1.3;
}
.form-floating > .form-select-sm {
    padding-top: 1.15rem;
    padding-bottom: .2rem;
}
.form-floating > input.form-control-sm:focus,
.form-floating > input.form-control-sm:not(:placeholder-shown),
.form-floating > textarea.form-control-sm:focus,
.form-floating > textarea.form-control-sm:not(:placeholder-shown) {
    padding-top: 1.15rem;
    padding-bottom: .2rem;
}
.form-floating > .form-control-sm ~ label,
.form-floating > .form-select-sm ~ label { padding-top: .6rem; padding-bottom: .6rem; font-size: 13px; }
.form-floating > textarea.form-control-sm { height: auto; min-height: 44px; padding-top: 1.4rem; }
.form-floating > .form-select-sm { padding-top: 1.05rem; padding-bottom: .35rem; line-height: 1.25; }
.form-floating > .form-select.form-select-sm { padding-top: .95rem !important; padding-bottom: .2rem !important; line-height: 1.25 !important; height: 44px !important; }
.form-floating > input.form-control.form-control-sm:focus,
.form-floating > input.form-control.form-control-sm:not(:placeholder-shown),
.form-floating > textarea.form-control.form-control-sm:focus,
.form-floating > textarea.form-control.form-control-sm:not(:placeholder-shown) { padding-top: 1.15rem !important; padding-bottom: .2rem !important; }

/* a small select stays as wide as the other fields (the theme makes it width:auto) */
select.form-select-sm.form-control-sm:not(.w-auto) { width: 100%; }

/* ---- table tool buttons: consistent size, spacing and style --------------- */
/* toolbar: search box and the refresh / columns buttons share one 34px height */
.fixed-table-toolbar .search { margin-right: .5rem; }
.fixed-table-toolbar .search input.form-control {
    height: 34px; min-height: 34px; padding: .25rem .75rem; font-size: 13px;
}
.fixed-table-toolbar .columns { gap: .4rem; }
.fixed-table-toolbar .columns .btn,
.fixed-table-toolbar .columns .btn-group > .btn,
.fixed-table-pagination .page-list .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
    height: 34px; min-width: 38px; padding: 0 .6rem !important;
    font-size: 13px; line-height: 1;
    color: var(--bs-primary, #3f78e0) !important; background: #fff !important;
    border: 1px solid rgba(63, 120, 224, .35) !important; border-radius: .4rem !important;
    box-shadow: none !important;
}
.fixed-table-toolbar .columns .btn:hover,
.fixed-table-toolbar .columns .btn:focus,
.fixed-table-toolbar .columns .btn-group.show > .btn,
.fixed-table-pagination .page-list .btn:hover,
.fixed-table-pagination .page-list .btn:focus {
    color: #fff !important; background: var(--bs-primary, #3f78e0) !important; border-color: var(--bs-primary, #3f78e0) !important;
}
.fixed-table-toolbar .columns .btn i { font-size: 13px; }
.fixed-table-toolbar .columns .keep-open { display: inline-flex; }

/* pagination footer: "Showing x to y of z rows [10] rows per page" reads as one tidy line */
.fixed-table-pagination .pagination-detail { display: flex; align-items: center; gap: .75rem; }
.fixed-table-pagination .pagination-info { font-size: 13px; color: #6c757d; }
.fixed-table-pagination .page-list { display: flex; align-items: center; gap: .4rem; font-size: 13px; color: #6c757d; }
.fixed-table-pagination .page-list .btn { min-width: 46px; height: 30px; }
/* the dropdown arrow (an icon-font glyph) must keep its own width inside the button */
.fixed-table-toolbar .columns .btn::after,
.fixed-table-pagination .page-list .btn::after {
    flex: 0 0 auto; width: auto !important; height: auto !important;
    margin: 0 0 0 .1rem !important; line-height: 1; font-size: 14px;
}
.fixed-table-toolbar .columns .btn .caret,
.fixed-table-pagination .page-list .btn .caret { display: none; }
.fixed-table-pagination .pagination-detail { flex-wrap: wrap; row-gap: .4rem; }
.fixed-table-pagination .page-list .dropdown-menu { min-width: 5rem !important; max-width: calc(100vw - 2rem); }

/* drawer header: app logo in place of the "Menu" label */
.pay-drawer-head .pay-drawer-logo { display: inline-flex; align-items: center; line-height: 1; }
.pay-drawer-head .pay-drawer-logo img { height: 52px; width: auto; max-width: 220px; object-fit: contain; }

/* ---- sidebar menu ------------------------------------------------------ */
.my-account-tab {
    padding: .6rem !important;
    border: 1px solid rgba(8, 60, 130, .07);
    box-shadow: 0 2px 14px rgba(30, 34, 40, .06) !important;
    border-radius: .75rem !important;
    gap: 2px;
}
.my-account-tab > hr { display: none; }                      /* dividers replaced by even row spacing */
.my-account-tab > li.nav-item { padding: 0 !important; }

/* one row design for every item, incl. the Wallet Settings toggle and submenu items */
.my-account-tab > li > a,
.my-account-tab .dropdown-menu li > a {
    position: relative; display: flex !important; align-items: center;
    gap: .75rem !important; min-height: 40px; padding: .5rem .75rem !important;
    border-radius: .55rem !important; font-weight: 500;
    text-decoration: none; transition: background-color .15s ease, color .15s ease;
}
.my-account-tab > li > a > div,
.my-account-tab .dropdown-menu li > a > div {                 /* fixed icon cell: every icon lines up */
    display: flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px;
}
.my-account-tab > li > a i,
.my-account-tab .dropdown-menu li > a i { font-size: 20px !important; line-height: 1; }
.my-account-tab > li > a p,
.my-account-tab .dropdown-menu li > a p { margin: 0 !important; padding: 0 !important; font-size: 14px; line-height: 1.25; }

/* hover and active */
.my-account-tab > li > a:hover,
.my-account-tab .dropdown-menu li > a:hover { background: rgba(63, 120, 224, .07); }
.my-account-tab > li > a.active,
.my-account-tab .dropdown-menu li > a.active {
    background: rgba(63, 120, 224, .12); color: var(--bs-primary, #3f78e0) !important; font-weight: 700;
}
.my-account-tab > li > a.active::before,
.my-account-tab .dropdown-menu li > a.active::before {
    content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--bs-primary, #3f78e0);
}

/* logout in red, with a soft red hover */
.my-account-tab > li > a[href*="logout"]:hover,
.my-account-tab > li > a.text-danger:hover,
.my-account-tab > li > a.link-danger:hover { background: rgba(220, 53, 69, .08); }

/* Wallet Settings: arrow on the right, submenu expands inside the sidebar */
.my-account-tab > li.dropdown > a.dropdown-toggle { width: 100%; float: none !important; justify-content: flex-start !important; }
.my-account-tab > li.dropdown > a.dropdown-toggle::after {
    margin-left: auto; padding-top: 0 !important; border: 0;
    font-family: "Font Awesome 5 Free", FontAwesome, sans-serif; font-weight: 900; content: "\f107"; font-size: 14px;
    transition: transform .15s ease; vertical-align: 0;
}
.my-account-tab > li.dropdown > a.dropdown-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.my-account-tab .dropdown-menu {
    position: static !important; transform: none !important; inset: auto !important;
    float: none; width: 100%; min-width: 0; margin: 2px 0 0 !important; padding: 0 0 0 1rem;
    border: 0; box-shadow: none; background: transparent;
}
/* sidebar: finishing touches */
.my-account-tab > li.dropdown > a.dropdown-toggle { color: #343f52 !important; font-weight: 500 !important; }
.my-account-tab > li.dropdown > a.dropdown-toggle:hover { background: rgba(63, 120, 224, .07); }
.my-account-tab > li.dropdown > a.dropdown-toggle[aria-expanded="true"],
.my-account-tab > li.dropdown.show > a.dropdown-toggle {
    color: var(--bs-primary, #3f78e0) !important; background: rgba(63, 120, 224, .08);
}
.my-account-tab > li.dropdown > a.dropdown-toggle::after { display: inline-block; line-height: 1; height: auto; width: auto; }
.my-account-tab > li > a.dropdown-toggle { min-height: 40px; height: 40px; }
/* submenu entries read left-aligned on one line, like the main entries */
.my-account-tab .dropdown-menu li { flex: none; width: 100%; text-align: left; }
.my-account-tab .dropdown-menu li > a { justify-content: flex-start; }
.my-account-tab .dropdown-menu li > a p { text-align: left; white-space: nowrap; }
/* the theme forces its accent (coral) on menu links via an ID rule; keep hover in the menu's own blue, red for logout */
#pills-tab.my-account-tab > .nav-item a:hover { color: var(--bs-primary, #3f78e0) !important; }
#pills-tab.my-account-tab > .nav-item a[href*="logout"]:hover,
#pills-tab.my-account-tab > .nav-item a.text-danger:hover,
#pills-tab.my-account-tab > .nav-item a.link-danger:hover { color: #dc3545 !important; }

/* ---- table pagination: compact page buttons ---------------------------- */
.fixed-table-pagination .pagination.pagination-sm { margin: 6px 0; box-shadow: none; background: transparent; border-radius: 0; }
.fixed-table-pagination ul.pagination { gap: 0; margin: 0; flex-wrap: nowrap; justify-content: flex-end; box-shadow: none; border-radius: 0; }
.fixed-table-pagination .page-item .page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 .55rem; margin: 0 !important;
    font-size: 13px; line-height: 1; color: #343f52;
    background: #fff; border: 1px solid rgba(8, 60, 130, .14); border-radius: .4rem !important;
    box-shadow: none; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.fixed-table-pagination .page-item .page-link:hover { background: rgba(63, 120, 224, .08); color: var(--bs-primary, #3f78e0); border-color: rgba(63, 120, 224, .35); }
.fixed-table-pagination .page-item.active .page-link {
    background: var(--bs-primary, #3f78e0) !important; color: #fff !important;
    border-color: var(--bs-primary, #3f78e0) !important; font-weight: 700;
}
.fixed-table-pagination .page-item.disabled .page-link { opacity: .45; background: #fff; color: #6c757d; pointer-events: none; }
.fixed-table-pagination .page-item.page-pre .page-link,
.fixed-table-pagination .page-item.page-next .page-link { min-width: 30px; padding: 0; }
.fixed-table-pagination .pagination .page-item { width: auto !important; min-width: 0 !important; flex: 0 0 auto; }
.fixed-table-pagination .pagination .page-item .page-link { width: auto; }
@media (max-width: 991.98px) {
    .fixed-table-pagination .page-item .page-link { min-height: 34px; height: 34px; min-width: 34px; }
}

/* page numbers form one joined strip: shared borders, only the two outer ends rounded */
.fixed-table-pagination .pagination .page-item .page-link { border-radius: 0 !important; margin-left: -1px !important; }
.fixed-table-pagination .pagination .page-item:first-child .page-link { margin-left: 0 !important; border-top-left-radius: .4rem !important; border-bottom-left-radius: .4rem !important; }
.fixed-table-pagination .pagination .page-item:last-child .page-link { border-top-right-radius: .4rem !important; border-bottom-right-radius: .4rem !important; }
.fixed-table-pagination .pagination .page-item.active .page-link,
.fixed-table-pagination .pagination .page-item .page-link:hover { position: relative; z-index: 1; }

/* page title block, second layout (title row directly inside the card header):
   remove Bootstrap's negative row margin so the title lines up with the content, and use the same compact design */
.my-account-section .card-header > .row {
    margin-left: 0; margin-right: 0; flex-wrap: nowrap; align-items: baseline; justify-content: space-between;
}
.my-account-section .card-header > .row > * { padding-left: 0; padding-right: 0; }
.my-account-section .card-header > .row > h1 {
    flex: 0 1 auto; width: auto; max-width: none; margin: 0 1rem 0 0; font-size: 1.15rem; line-height: 1.3;
}
.my-account-section .card-header > .row > nav { flex: 0 0 auto; width: auto; max-width: none; margin-left: auto; }
@media (max-width: 575.98px) {
    .my-account-section .card-header > .row { flex-wrap: wrap; }
    .my-account-section .card-header > .row > h1 { flex: 0 0 100%; margin: 0; font-size: 1.05rem; }
    .my-account-section .card-header > .row > nav { margin-left: 0; }
}
