/*!
 * theme-refresh.css — modern UI refresh over SB Admin 2 (affiliate portal only).
 * Additive layer loaded after sb-admin-2.css. Remove the <link> in
 * auth-layout.cover.tpl to fully roll back. No structural widths are changed.
 */

:root {
    --rx-primary: #1d95fa;
    --rx-primary-600: #0b73e6;
    --rx-primary-700: #0a5fc0;
    --rx-ink: #2b3145;
    --rx-muted: #8a93a5;
    --rx-bg: #eef2f8;
    --rx-line: #eceff5;
    --rx-radius: 1rem;
    --rx-radius-sm: 0.7rem;
}

/* ---------- Base ---------- */
body#page-top {
    background-color: var(--rx-bg);
    color: #3d4257;
    font-family: "Inter", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
    color: var(--rx-ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}

a { color: var(--rx-primary-600); }
a:hover { color: var(--rx-primary-700); }

/* ---------- Cards & shadows ---------- */
.card {
    border: none;
    border-radius: var(--rx-radius);
    box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 8px 24px rgba(20, 30, 60, 0.06);
    transition: box-shadow 0.2s ease;
}
.card.shadow, .card.shadow-lg { box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 10px 30px rgba(20, 30, 60, 0.08) !important; }
.card.shadow:hover, .card.shadow-lg:hover { box-shadow: 0 6px 16px rgba(20, 30, 60, 0.08), 0 18px 44px rgba(20, 30, 60, 0.12) !important; }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--rx-line);
    border-top-left-radius: var(--rx-radius) !important;
    border-top-right-radius: var(--rx-radius) !important;
    padding-top: 1rem;
    padding-bottom: 1rem;
}
.card-header h6 { color: var(--rx-ink) !important; letter-spacing: 0.01em; }

.shadow { box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 10px 30px rgba(20, 30, 60, 0.07) !important; }
.shadow-sm { box-shadow: 0 1px 2px rgba(20, 30, 60, 0.06), 0 4px 12px rgba(20, 30, 60, 0.05) !important; }

/* Left-accent stat cards */
.border-left-primary { border-left: 0.28rem solid var(--rx-primary) !important; }
.border-left-success { border-left: 0.28rem solid #22c55e !important; }
.border-left-info    { border-left: 0.28rem solid #36b9cc !important; }
.border-left-warning { border-left: 0.28rem solid #f6c23e !important; }

/* ---------- Buttons ---------- */
.btn {
    border-radius: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background-image 0.15s ease;
}
.btn-primary {
    background-image: linear-gradient(135deg, #2a97ff, var(--rx-primary-600));
    border: none;
    box-shadow: 0 4px 12px rgba(13, 115, 230, 0.28);
}
.btn-primary:hover {
    transform: translateY(-1px);
    background-image: linear-gradient(135deg, var(--rx-primary), var(--rx-primary-700));
    box-shadow: 0 6px 18px rgba(13, 115, 230, 0.36);
}
.btn-primary:focus, .btn-primary.focus { box-shadow: 0 0 0 0.2rem rgba(29, 149, 250, 0.4); }
.btn-success { background-image: linear-gradient(135deg, #2ecc71, #16a34a); border: none; }
.btn-user { border-radius: 2rem; padding: 0.7rem 1rem; }
.btn-block.btn-user { padding: 0.8rem 1rem; }

/* ---------- Forms ---------- */
/* Unify .form-control and .custom-select — templates mix both in one row */
.form-control,
.custom-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0.6rem;
    border: 1px solid #dfe3ec;
    font-size: 1rem;
    line-height: 1.5;
    color: #3d4257;
    /* sb-admin 1.25em height clipped Inter; keep padding/height in sync */
    height: calc(1.5em + 1.1rem + 2px);
    padding: 0.55rem 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.custom-select {
    /* caret gutter only — same total height as .form-control */
    padding-right: 1.75rem;
    vertical-align: middle;
    background-color: #fff;
}
.form-control:focus,
.custom-select:focus {
    border-color: var(--rx-primary);
    box-shadow: 0 0 0 0.2rem rgba(29, 149, 250, 0.15);
}
.form-control-user {
    border-radius: 2rem !important;
    padding: 1.1rem 1.25rem;
    font-size: 0.9rem;
    height: calc(1.5em + 2.2rem + 2px);
}

/* ---------- Topbar ---------- */
.topbar {
    background-image: linear-gradient(90deg, var(--rx-primary-600) 0%, #1596f5 100%) !important;
    box-shadow: 0 2px 14px rgba(11, 95, 206, 0.25) !important;
}
.topbar #sidebarToggleTop { color: rgba(255, 255, 255, 0.9); }
.topbar .nav-item .nav-link { color: rgba(255, 255, 255, 0.92) !important; }
.topbar .topbar-divider { border-right: 1px solid rgba(255, 255, 255, 0.25); }
.topbar .img-profile { border: 2px solid rgba(255, 255, 255, 0.5); }

/* ---------- Sidebar ---------- */
.sidebar {
    background: #ffffff !important;
    border-right: 1px solid var(--rx-line);
    box-shadow: 2px 0 14px rgba(20, 30, 60, 0.03);
}
.sidebar-dark hr.sidebar-divider { border-top: 1px solid var(--rx-line); }
.sidebar-dark .nav-item .nav-link { color: #5b6270; font-weight: 500; }
.sidebar-dark .nav-item .nav-link i { color: #9aa2b1; transition: color 0.15s ease; }

.sidebar-dark .nav-item .nav-link:hover,
.sidebar-dark .nav-item .nav-link:focus {
    background: #f1f6ff !important;
    color: var(--rx-primary-600) !important;
    border-left: none !important;
    border-radius: var(--rx-radius-sm) !important;
}
.sidebar-dark .nav-item .nav-link:hover i,
.sidebar-dark .nav-item .nav-link:focus i { color: var(--rx-primary-600) !important; }

.sidebar-dark .nav-item.active .nav-link {
    background: linear-gradient(135deg, #2a97ff, var(--rx-primary-600)) !important;
    color: #fff !important;
    border-left: none !important;
    border-radius: var(--rx-radius-sm) !important;
    box-shadow: 0 4px 12px rgba(13, 115, 230, 0.32);
}
.sidebar-dark .nav-item.active .nav-link i { color: #fff !important; }

/* inset pill look without touching sidebar/nav-link widths on mobile */
@media (min-width: 768px) {
    .sidebar .nav-item .nav-link {
        width: auto;
        margin: 0.12rem 0.6rem;
        padding: 0.7rem 0.9rem;
        border-radius: var(--rx-radius-sm);
    }
}

/* Sidebar submenu (collapse) */
.sidebar .nav-item .collapse .collapse-inner,
.sidebar .nav-item .collapsing .collapse-inner {
    border-radius: var(--rx-radius-sm) !important;
    box-shadow: 0 6px 20px rgba(20, 30, 60, 0.1) !important;
    border-left: none !important;
}
.sidebar .collapse-item { color: #5b6270; }
.sidebar .collapse-item:hover { background-color: #f1f6ff !important; color: var(--rx-primary-600); }
.sidebar .collapse-item.active { color: var(--rx-primary-600) !important; font-weight: 700; }

.sidebar #sidebarToggle { background: rgba(29, 149, 250, 0.12); }
.sidebar #sidebarToggle:hover { background: rgba(29, 149, 250, 0.22); }
.sidebar-dark #sidebarToggle::after { color: var(--rx-primary-600); }

/* ---------- Tables ---------- */
.table thead th {
    border-bottom: 2px solid var(--rx-line);
    border-top: none;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--rx-muted);
    font-weight: 700;
}
.table td, .table th { border-top: 1px solid #f0f2f7; }
.table-bordered td, .table-bordered th { border: 1px solid var(--rx-line); }
.table tbody tr { transition: background-color 0.12s ease; }
.table:not(.table-inner) tbody tr:hover { background-color: #f7f9fd; }

/* ---------- Misc ---------- */
.dropdown-menu {
    border: none;
    border-radius: var(--rx-radius-sm);
    box-shadow: 0 8px 28px rgba(20, 30, 60, 0.14);
}
.dropdown-item:active { background-color: var(--rx-primary); }
.alert { border: none; border-radius: var(--rx-radius-sm); }
.badge { border-radius: 0.5rem; font-weight: 600; }
.list-group-item { border-color: var(--rx-line); }

.scroll-to-top {
    background: linear-gradient(135deg, var(--rx-primary), var(--rx-primary-600));
    border-radius: var(--rx-radius-sm);
    box-shadow: 0 4px 12px rgba(13, 115, 230, 0.32);
    line-height: 44px;
}
.scroll-to-top:hover { background: linear-gradient(135deg, var(--rx-primary-600), var(--rx-primary-700)); }

.sticky-footer { background: transparent; }
.sticky-footer .copyright { color: var(--rx-muted); }

/* Custom scrollbar for a cleaner modern feel */
* { scrollbar-width: thin; scrollbar-color: #c7cedd transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #c7cedd; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #aeb7ca; }

/* ---------- Core portal mobile ---------- */
html,
body#page-top {
    max-width: 100%;
    overflow-x: hidden;
}

.rx-sidebar-backdrop {
    display: none;
}

.rx-table-scroll {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    body.rx-sidebar-open {
        overflow: hidden;
    }

    body.rx-sidebar-open .rx-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(20, 30, 60, 0.48);
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        min-height: 4.375rem;
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .topbar #sidebarToggleTop {
        flex: 0 0 44px;
        width: 44px;
        min-height: 44px;
        margin-right: 0.5rem !important;
        padding: 0;
    }

    .topbar .sidebar-brand {
        min-width: 0;
        max-width: 10rem;
        overflow: hidden;
    }

    .topbar .sidebar-brand img {
        max-height: 2.75rem;
        margin: 0 !important;
    }

    #accordionSidebar.sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1040;
        width: min(86vw, 19rem) !important;
        min-height: 100dvh;
        padding: 0.75rem;
        overflow-x: hidden;
        overflow-y: auto;
        transform: translateX(0);
        transition: transform 0.2s ease;
    }

    #accordionSidebar.sidebar.toggled {
        width: min(86vw, 19rem) !important;
        transform: translateX(-105%);
    }

    #accordionSidebar .nav-item {
        width: 100%;
    }

    #accordionSidebar .nav-item .nav-link {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 44px;
        padding: 0.7rem 0.85rem;
        text-align: left;
        border-radius: var(--rx-radius-sm);
    }

    #accordionSidebar .nav-item .nav-link i {
        flex: 0 0 1.5rem;
        margin-right: 0.5rem;
        font-size: 0.95rem;
        text-align: center;
    }

    #accordionSidebar .nav-item .nav-link span {
        display: inline;
        font-size: 0.9rem;
    }

    #accordionSidebar .nav-item .collapse,
    #accordionSidebar .nav-item .collapsing {
        position: static;
        width: 100%;
        margin: 0.15rem 0 0.5rem;
    }

    #accordionSidebar .nav-item .collapse .collapse-inner,
    #accordionSidebar .nav-item .collapsing .collapse-inner {
        min-width: 0;
        margin: 0;
        padding: 0.35rem;
        box-shadow: none !important;
    }

    #accordionSidebar .collapse-item {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 0.65rem 0.75rem;
        white-space: normal;
    }

    #content-wrapper,
    #content,
    #content > .container-fluid {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    #content > .container-fluid {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    #content .container-fluid .container-fluid {
        padding-right: 0;
        padding-left: 0;
    }

    #content .rx-page-heading,
    #content > .container-fluid > .d-none.d-sm-inline-block {
        display: block !important;
    }

    #content .card-body {
        min-width: 0;
    }

    #content .rx-date-filter {
        width: 100%;
        max-width: 100%;
    }

    #content .form-row > [class*="col-"],
    #content .form-row > .form-group {
        width: 100%;
        max-width: 100%;
    }

    #content .form-row .btn,
    #content .rx-date-filter .form-control {
        width: 100%;
    }

    #content .account-info {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: stretch !important;
    }

    #content .account-info > .list-group {
        min-width: 0;
        margin-left: 0 !important;
    }

    #content .account-info > .list-group + .list-group {
        margin-left: 0.35rem !important;
    }

    #content .account-info .list-group-item {
        min-width: 0;
        padding: 0.75rem 0.5rem;
        overflow-wrap: anywhere;
    }

    #content [id$="-chart-container"],
    #content .fusioncharts-container,
    #content canvas,
    #content svg {
        max-width: 100% !important;
    }

    #content .rx-table-scroll > table,
    #content .table-responsive > table,
    #content .table-scrollable > table {
        min-width: 680px;
    }

    #content .pagination {
        flex-wrap: wrap;
        gap: 0.2rem;
    }

    #content .alert {
        padding-right: 2.75rem;
        overflow-wrap: anywhere;
    }

    .modal-dialog {
        margin: 1rem;
    }

    .modal-content {
        max-height: calc(100dvh - 2rem);
    }

    .modal-body {
        overflow-y: auto;
    }
}

@media (max-width: 374.98px) {
    #content .card-body {
        padding: 1rem;
    }

    #content .rx-table-scroll,
    #content .table-responsive,
    #content .table-scrollable {
        font-size: 0.82rem;
    }

    #content .account-info .list-group-item {
        padding-right: 0.35rem;
        padding-left: 0.35rem;
        font-size: 0.82rem;
    }
}
