:root {
    --primary: #0d6efd;
    --success: #198754;
    --warning: #ffc107;
    --danger:  #dc3545;
}

body {
    background: #f5f7fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* ── PAGE LOADER OVERLAY ──────────────── */
#page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}
#page-loader.show {
    opacity: 1;
    visibility: visible;
}
#page-loader .loader-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    text-align: center;
    min-width: 220px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: loaderPop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes loaderPop {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
#page-loader .loader-spinner {
    width: 44px; height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto .85rem;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#page-loader .loader-msg {
    font-size: .9rem;
    font-weight: 600;
    color: #334155;
}
#page-loader .loader-sub {
    font-size: .76rem;
    color: #94a3b8;
    margin-top: .3rem;
}

/* bKash variant */
#page-loader.bkash .loader-spinner {
    border-top-color: #e2136e;
}
#page-loader.bkash .loader-box {
    border-top: 4px solid #e2136e;
}

/* ── BUTTON LOADING STATE ─────────────── */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: .85;
}
.btn-loading .btn-text { visibility: hidden; }
.btn-loading::after {
    content: '';
    position: absolute;
    width: 1.1rem; height: 1.1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .65s linear infinite;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    opacity: .7;
}

/* ── CARD ─────────────────────────────── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* ── STAT CARDS ───────────────────────── */
.stat-card {
    border-radius: 12px;
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card .icon {
    font-size: 3rem;
    opacity: .2;
    position: absolute;
    right: 1rem;
    bottom: .5rem;
}
.stat-card .value { font-size: 1.8rem; font-weight: 700; }
.stat-card .label { font-size: .85rem; opacity: .85; }

/* ── NAVBAR ───────────────────────────── */
.navbar-brand { font-size: 1.15rem; letter-spacing: .3px; }

/* ── FORMS ────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}

/* ── STATUS BADGE ─────────────────────── */
.badge { font-size: .78rem; padding: .4em .7em; border-radius: 6px; }

/* ── TABLE ────────────────────────────── */
.table th { font-weight: 600; font-size: .85rem; background: #f8f9fa; }
.table td { vertical-align: middle; font-size: .9rem; }

/* ── ADMIN TOP NAV ────────────────────── */
.admin-topnav {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    min-height: 56px;
}
.admin-topnav * { box-sizing: border-box; }
.admin-topnav .navbar-brand,
.admin-topnav .navbar-brand:hover {
    color: #ffffff;
    font-size: 1rem;
    text-decoration: none;
}
.admin-topnav .navbar-toggler {
    background: transparent;
    border: 1px solid #475569;
    padding: .3rem .55rem;
}
.admin-topnav .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.admin-topnav .navbar-collapse {
    background: #1e293b;
}
.admin-topnav .nav-link {
    color: #94a3b8;
    font-size: .88rem;
    padding: .45rem .8rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background .15s, color .15s;
    display: inline-block;
}
.admin-topnav .nav-link:hover {
    background: rgba(255,255,255,.08);
    color: #ffffff;
}
.admin-topnav .nav-link.active {
    background: rgba(255,255,255,.12);
    color: #ffffff;
    font-weight: 600;
}
.admin-topnav .admin-user-label {
    color: #64748b;
    font-size: .82rem;
}
.admin-body { background: #f1f5f9; min-height: 100vh; }
.admin-content { max-width: 1200px; margin: 0 auto; }

/* ── AUTH PAGES ───────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    padding: 2.5rem;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.auth-card .logo {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: .25rem;
}

/* ── CATEGORY CARDS ───────────────────── */
.category-card {
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
    border-radius: 12px;
}
.category-card:hover,
.category-card.selected {
    border-color: var(--primary);
    background: #eff6ff;
}
.category-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── RECHARGE / bKash ─────────────────── */
.bkash-btn {
    background: #e2136e;
    color: #fff;
    border: none;
    padding: .75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    transition: all .2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}
.bkash-btn:hover { background: #c71160; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 15px rgba(226,19,110,.35); }
.bkash-btn:active { transform: translateY(0); }
.bkash-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── TOAST NOTIFICATIONS ──────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    pointer-events: none;
}
.app-toast {
    background: #1e293b;
    color: #fff;
    padding: .6rem 1.4rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    animation: toastIn .25s ease;
    transition: opacity .3s;
    white-space: nowrap;
}
.app-toast.toast-success { background: #16a34a; }
.app-toast.toast-error   { background: #dc2626; }
@keyframes toastIn {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── RESPONSIVE ───────────────────────── */
@media (max-width: 767px) {
    .stat-card .value { font-size: 1.4rem; }
    .admin-content { padding-left: .75rem !important; padding-right: .75rem !important; }
}
