/* ============================================================
   ISP Billing RouterOS SaaS — Glassmorphism Modern SaaS UI
   Light + Dark mode via [data-theme]
   ============================================================ */
:root {
    --ibr-primary: #4f46e5;
    --ibr-primary-soft: rgba(79, 70, 229, .12);
    --ibr-glass: rgba(255, 255, 255, .72);
    --ibr-glass-border: rgba(255, 255, 255, .65);
    --ibr-bg: #eef0fa;
    --ibr-text: #1e2033;
    --ibr-muted: #6b7080;
    --ibr-shadow: 0 18px 50px rgba(46, 50, 120, .12);
    --ibr-sidebar-w: 264px;
    /* Panel solid utk komponen Bootstrap (dropdown/modal) agar mudah dibaca */
    --ibr-panel: #ffffff;
    --ibr-panel-2: #f6f7fd;
    /* FIX 1.1.8 — variabel Bootstrap dipetakan ke tema agar semua komponen ikut gaya */
    --bs-body-bg: #eef0fa;
    --bs-body-color: #1e2033;
    --bs-border-color: rgba(30, 32, 51, .12);
    --bs-primary: #4f46e5;
    --bs-link-color: #4f46e5;
    --bs-link-hover-color: #4338ca;
}
[data-theme="dark"] {
    --ibr-glass: rgba(30, 32, 54, .72);
    --ibr-glass-border: rgba(255, 255, 255, .08);
    --ibr-bg: #12131f;
    --ibr-text: #e6e8f2;
    --ibr-muted: #9aa0b4;
    --ibr-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    --ibr-primary-soft: rgba(99, 102, 241, .18);
    --ibr-panel: #1c1e30;
    --ibr-panel-2: #232640;
    --bs-body-bg: #12131f;
    --bs-body-color: #e6e8f2;
    --bs-border-color: rgba(255, 255, 255, .1);
    --bs-emphasis-color: #f3f4fb;
    --bs-secondary-color: #9aa0b4;
    --bs-tertiary-bg: #1c1e30;
    --bs-secondary-bg: #232640;
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
    background: var(--ibr-bg);
    color: var(--ibr-text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}
.text-gradient { background: linear-gradient(90deg, #4f46e5, #a855f7, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-secondary { color: var(--ibr-muted) !important; }

/* ---------- Glass components ---------- */
.glass {
    background: var(--ibr-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--ibr-glass-border);
    border-radius: 16px;
}
.card.glass { box-shadow: var(--ibr-shadow); }
.glass-nav { background: var(--ibr-glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--ibr-glass-border); }

/* ---------- Interactive feedback ---------- */
.btn, .btn-icon, .page-link, .form-control, .form-select, .user-chip {
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn-press:active, .btn:active { transform: scale(.97); }
.card-lift { cursor: default; transition: transform .2s ease, box-shadow .25s ease; }
.card-lift:hover { transform: translateY(-4px); box-shadow: 0 24px 60px rgba(46, 50, 120, .2); }
a.card-lift, .card-lift[role="button"] { cursor: pointer; }
.btn-icon {
    width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--ibr-glass-border);
    background: var(--ibr-glass); color: var(--ibr-text); display: inline-grid; place-items: center; font-size: 17px;
    /* FIX 1.1.8: ripple tidak lagi bocor keluar tombol (sebelumnya lingkaran putih
       raksasa muncul di topnav karena btn-icon tanpa positioning/overflow) */
    position: relative; overflow: hidden; cursor: pointer;
}
/* FIX 1.1.8: elemen interaktif wajib terlihat bisa diklik */
[data-bs-toggle="dropdown"], .nav-link-group, [data-toggle-group], [data-open-drawer] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ibr-primary); outline-offset: 2px; border-radius: 4px; }
body.sb-locked { overflow: hidden; }
.btn-icon:hover { background: var(--ibr-primary-soft); color: var(--ibr-primary); }
.btn-icon:active { transform: scale(.92); }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.5); transform: scale(0); animation: ripple .5s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }
.btn { position: relative; overflow: hidden; }

/* ---------- Layout ---------- */
.app-wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--ibr-sidebar-w); flex-shrink: 0; position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040;
    background: var(--ibr-glass); backdrop-filter: blur(16px); border-right: 1px solid var(--ibr-glass-border);
    display: flex; flex-direction: column; transition: transform .25s ease, width .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; }
.brand-logo {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 8px 20px rgba(79,70,229,.4);
}
.brand-logo.sa { background: linear-gradient(135deg, #dc2626, #f59e0b); }
.brand-text { font-weight: 800; line-height: 1.05; }
.brand-text small { display: block; font-size: 10px; color: var(--ibr-muted); font-weight: 600; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0; border-radius: 10px;
    color: var(--ibr-text); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.sidebar-nav a:hover { background: var(--ibr-primary-soft); }
.sidebar-nav a.active { background: var(--ibr-primary); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.35); }
.sidebar-nav a i.bi { font-size: 16px; width: 20px; text-align: center; }
.nav-submenu { display: none; padding-left: 16px !important; }
.nav-group.open .nav-submenu { display: block; }
.nav-group .chevron { transition: transform .2s; font-size: 11px; }
.nav-group.open .chevron { transform: rotate(180deg); }
.nav-link-group.active { color: var(--ibr-primary) !important; font-weight: 700; }
.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--ibr-glass-border); display: grid; gap: 8px; }
.tenant-chip {
    display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ibr-text);
    background: var(--ibr-primary-soft); padding: 8px 12px; border-radius: 10px; text-decoration: none; overflow: hidden;
}
.version-chip {
    display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 700;
    color: var(--ibr-muted); border: 1px dashed var(--ibr-glass-border); padding: 6px 10px; border-radius: 10px;
    text-decoration: none; letter-spacing: .3px;
}
.version-chip:hover { color: var(--ibr-primary); border-color: var(--ibr-primary); background: var(--ibr-primary-soft); }
.sidebar.collapsed { transform: translateX(calc(var(--ibr-sidebar-w) * -1)); }
.main-area.collapsed-main { margin-left: 0 !important; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
.main-area { flex: 1; margin-left: var(--ibr-sidebar-w); display: flex; flex-direction: column; min-width: 0; transition: margin .25s ease; }
.main-area.sb-collapsed { margin-left: 0; }

.topnav {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; background: var(--ibr-glass); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ibr-glass-border);
}
.topnav-title { font-weight: 700; }
.content-area { padding: 20px; flex: 1; }

/* ---------- Stat cards ---------- */
.stat-card {
    display: flex; align-items: center; gap: 12px; padding: 14px; height: 100%;
    background: var(--ibr-glass); backdrop-filter: blur(14px);
    border: 1px solid var(--ibr-glass-border); border-radius: 16px; box-shadow: var(--ibr-shadow);
    transition: transform .2s ease, box-shadow .25s ease;
}
a .stat-card:hover { transform: translateY(-3px); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; color: #fff; flex-shrink: 0; }
.stat-value { font-weight: 800; font-size: 1.25rem; line-height: 1.2; }
.stat-label { font-size: 11.5px; color: var(--ibr-muted); font-weight: 600; }

/* ---------- Topnav widgets ---------- */
.user-chip {
    display: flex; align-items: center; gap: 8px; border: 1px solid var(--ibr-glass-border);
    background: var(--ibr-glass); border-radius: 99px; padding: 4px 12px 4px 4px; color: var(--ibr-text);
}
.user-chip:hover { background: var(--ibr-primary-soft); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.notif-badge {
    position: absolute; top: -4px; right: -4px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 99px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px;
}
.notif-menu { width: 340px; max-width: 92vw; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--ibr-glass-border); font-size: 13px; }
.notif-item.unread { background: var(--ibr-primary-soft); }
.notif-item:hover { background: var(--ibr-primary-soft); }
.notif-item i { font-size: 18px; margin-top: 2px; }

/* ---------- Tables & forms ---------- */
.app-table { font-size: 13.5px; }
.app-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--ibr-muted); font-weight: 700; border-bottom: 1px solid var(--ibr-glass-border); }
.app-table td { vertical-align: middle; }
.table :where(th, td) { border-color: var(--ibr-glass-border) !important; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-control, .form-select { background: var(--ibr-glass); border-color: var(--ibr-glass-border); color: var(--ibr-text); }
.form-control:focus, .form-select:focus { border-color: var(--ibr-primary); box-shadow: 0 0 0 .2rem var(--ibr-primary-soft); background: var(--ibr-glass); color: var(--ibr-text); }
.form-check-input:checked { background-color: var(--ibr-primary); border-color: var(--ibr-primary); }
.form-switch-lg .form-check-input { width: 3em; height: 1.5em; }
.badge-status { font-size: 10.5px; letter-spacing: .3px; padding: 5px 9px; border-radius: 7px; }

/* ---------- Impersonation banner ---------- */
.impersonation-banner {
    position: sticky; top: 0; z-index: 1050; background: linear-gradient(90deg, #dc2626, #ea580c);
    color: #fff; text-align: center; padding: 8px; font-weight: 600; font-size: 13.5px;
}

/* ---------- Auth ---------- */
/* Catatan: halaman auth (login/register/forgot/reset) memakai layout self-contained
   resources/views/layouts/auth.php dengan gaya card Heroku (class hx-*) —
   CSS-nya inline di layout, TIDAK bergantung pada file ini agar anti-gagal CDN. */

/* ---------- WhatsApp preview bubble ---------- */
.wa-bubble { max-width: 380px; border-radius: 16px; padding: 14px 16px; background: #dcf8c6; color: #07301f; box-shadow: var(--ibr-shadow); margin: 0 auto; font-size: 13.5px; }
[data-theme="dark"] .wa-bubble { background: #14462c; color: #d9f2e4; }
.wa-head { font-weight: 700; color: #128c7e; border-bottom: 1px solid rgba(0,0,0,.08); padding-bottom: 6px; margin-bottom: 8px; }

/* ---------- FIX 1.1.8: komponen Bootstrap mengikuti tema (light+dark) ---------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--ibr-panel);
    --bs-dropdown-link-color: var(--ibr-text);
    --bs-dropdown-link-hover-color: var(--ibr-text);
    --bs-dropdown-link-hover-bg: var(--ibr-primary-soft);
    --bs-dropdown-link-active-color: #fff;
    --bs-dropdown-link-active-bg: var(--ibr-primary);
    --bs-dropdown-border-color: var(--ibr-glass-border);
    box-shadow: var(--ibr-shadow);
}
.dropdown-divider { border-color: var(--ibr-glass-border) !important; opacity: 1; }
.modal-content { --bs-modal-bg: var(--ibr-panel); border-color: var(--ibr-glass-border); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(180%); }
.card { --bs-card-bg: var(--ibr-glass); border-color: var(--ibr-glass-border); }
.card-header, .card-footer { background: transparent; border-color: var(--ibr-glass-border) !important; color: var(--ibr-text); }
.list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-color: var(--ibr-text);
    --bs-list-group-border-color: var(--ibr-glass-border);
    --bs-list-group-action-color: var(--ibr-text);
    --bs-list-group-action-hover-bg: var(--ibr-primary-soft);
    --bs-list-group-action-hover-color: var(--ibr-text);
    --bs-list-group-active-bg: var(--ibr-primary);
    --bs-list-group-active-border-color: var(--ibr-primary);
}
.nav-tabs { --bs-nav-tabs-border-color: var(--ibr-glass-border); --bs-nav-link-color: var(--ibr-muted); --bs-nav-link-hover-color: var(--ibr-text); }
.nav-tabs .nav-link.active { background: var(--ibr-glass); color: var(--ibr-text); border-color: var(--ibr-glass-border) var(--ibr-glass-border) transparent; }
.toast { --bs-toast-bg: var(--ibr-panel); --bs-toast-border-color: var(--ibr-glass-border); }
.page-link { --bs-pagination-bg: var(--ibr-glass); --bs-pagination-color: var(--ibr-text); --bs-pagination-border-color: var(--ibr-glass-border); --bs-pagination-hover-bg: var(--ibr-primary-soft); --bs-pagination-hover-color: var(--ibr-primary); --bs-pagination-active-bg: var(--ibr-primary); --bs-pagination-active-border-color: var(--ibr-primary); --bs-pagination-disabled-bg: transparent; --bs-pagination-disabled-color: var(--ibr-muted); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ibr-text); --bs-table-border-color: var(--ibr-glass-border); --bs-table-striped-bg: rgba(128, 128, 170, .06); --bs-table-hover-bg: var(--ibr-primary-soft); --bs-table-hover-color: var(--ibr-text); }
.accordion { --bs-accordion-bg: var(--ibr-glass); --bs-accordion-color: var(--ibr-text); --bs-accordion-border-color: var(--ibr-glass-border); --bs-accordion-btn-color: var(--ibr-text); --bs-accordion-active-bg: var(--ibr-primary-soft); }
.breadcrumb { --bs-breadcrumb-divider-color: var(--ibr-muted); } .breadcrumb-item.active { color: var(--ibr-muted); }
.alert { border-color: transparent; }
.bg-body-tertiary { background: rgba(128,128,160,.12) !important; }

/* ---------- Mobile ---------- */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
    background: var(--ibr-glass); backdrop-filter: blur(16px); border-top: 1px solid var(--ibr-glass-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
    flex: 1; display: grid; place-items: center; gap: 2px; color: var(--ibr-muted); text-decoration: none; font-size: 10.5px; padding: 4px 0;
}
.bottom-nav a i { font-size: 19px; }
.bottom-nav a.active { color: var(--ibr-primary); font-weight: 700; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: 30px 0 60px rgba(0,0,0,.2); }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
    .main-area { margin-left: 0; }
    .bottom-nav { display: flex; }
    .content-area { padding: 14px 12px 84px; }
    .stat-value { font-size: 1.05rem; }
    .fab { position: fixed; right: 18px; bottom: 84px; z-index: 1030; width: 54px; height: 54px; border-radius: 50%; font-size: 24px; display: grid; place-items: center; background: var(--ibr-primary); color: #fff; box-shadow: 0 12px 30px rgba(79,70,229,.5); }
}
@media (min-width: 992px) { .fab { display: none; } }

/* ---------- FIX 1.1.8: halaman Versi & Upgrade ---------- */
.ver-hero {
    background: linear-gradient(135deg, rgba(79,70,229,.14), rgba(168,85,247,.10) 55%, rgba(236,72,153,.08));
    border: 1px solid var(--ibr-glass-border); border-radius: 18px; padding: 26px 24px; box-shadow: var(--ibr-shadow);
}
.ver-hero .ver-num { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.ver-hero .ver-icon {
    width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 10px 26px rgba(79,70,229,.45); flex-shrink: 0;
}
.info-tile {
    display: flex; align-items: center; gap: 12px; padding: 13px 14px; height: 100%;
    background: var(--ibr-glass); border: 1px solid var(--ibr-glass-border); border-radius: 14px;
}
.info-tile i { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; color: var(--ibr-primary); background: var(--ibr-primary-soft); flex-shrink: 0; }
.info-tile .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ibr-muted); }
.info-tile .v { font-size: 13.5px; font-weight: 700; word-break: break-word; }
.ver-timeline { position: relative; padding-left: 30px; }
.ver-timeline::before { content: ''; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--ibr-primary), rgba(79,70,229,.05)); border-radius: 2px; }
.ver-item { position: relative; padding: 0 0 22px 0; }
.ver-item:last-child { padding-bottom: 0; }
.ver-item::before {
    content: ''; position: absolute; left: -27px; top: 4px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--ibr-panel); border: 3px solid var(--ibr-primary); box-shadow: 0 0 0 4px var(--ibr-primary-soft);
}
.ver-item.ver-latest::before { background: var(--ibr-primary); }
.ver-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ver-ver { font-weight: 800; font-size: 15px; }
.ver-date { font-size: 12px; color: var(--ibr-muted); font-weight: 600; }
.ver-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ibr-text); }
.ver-list li { margin-bottom: 4px; }
.ver-list li::marker { color: var(--ibr-primary); }
.badge-ver { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 4px 9px; border-radius: 7px; text-transform: uppercase; }
.badge-ver.feature { background: rgba(34,197,94,.15); color: #16a34a; }
.badge-ver.bugfix { background: rgba(245,158,11,.15); color: #d97706; }
.badge-ver.security { background: rgba(239,68,68,.15); color: #dc2626; }
.badge-ver.release { background: var(--ibr-primary-soft); color: var(--ibr-primary); }
.up-step {
    display: flex; gap: 14px; padding: 16px; background: var(--ibr-glass); border: 1px solid var(--ibr-glass-border);
    border-radius: 14px; height: 100%; position: relative;
}
.up-step-num {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-weight: 800; font-size: 15px;
    box-shadow: 0 6px 16px rgba(79,70,229,.4);
}
.up-step h6 { font-weight: 700; margin-bottom: 4px; }
.up-step p { font-size: 12.5px; color: var(--ibr-muted); margin-bottom: 0; }
.cmd-box {
    background: rgba(15, 17, 32, .92); color: #c9d1f5; border-radius: 10px; padding: 10px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-x: auto;
    border: 1px solid rgba(255,255,255,.08); margin: 6px 0 0;
}
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--ibr-glass-border); font-size: 13px; }
.check-item:last-child { border-bottom: 0; }
.check-item i { color: var(--ibr-primary); font-size: 15px; margin-top: 1px; }
.asset-check { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--ibr-glass-border); border-radius: 10px; font-size: 12.5px; background: var(--ibr-glass); }
.asset-check + .asset-check { margin-top: 8px; }
.asset-check code { font-size: 11.5px; }

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(120,120,160,.35); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

.bg-soft { background: var(--ibr-primary-soft); }
.perm-group { background: var(--ibr-primary-soft); border-color: var(--ibr-glass-border) !important; }
pre { color: var(--ibr-text); }
