/* ============================================================
   Bd Pay Zone - Main Stylesheet
   Background: Black | Text: White
   ============================================================ */

/* FOUC Prevention - hide body until CSS loads */
html { visibility: hidden; }
html.loaded { visibility: visible; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1623;
    --bg-2: #0a1020;
    --bg-3: #161e2e;
    --border: #1e2a3a;
    --text: #f0f0f0;
    --text-2: #bbbbbb;
    --text-3: #777777;
    --primary: #f0f0f0;
    --primary-hover: #cccccc;
    --accent: #ffffff;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --sidebar-w: 220px;
    --sidebar-collapsed-w: 64px;
    --radius: 8px;
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ========== AUTH PAGES ========== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f0f0f; }
.auth-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { font-size: 24px; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 8px; letter-spacing: -0.5px; }
.auth-logo span { color: var(--text-3); }
.auth-sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 28px; }
.auth-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.2px; }
.form-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; color: var(--text); background: #1a1a1a; transition: border-color 0.15s; outline: none; }
.form-input:focus { border-color: var(--text); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: background 0.15s, color 0.15s; }
.btn-primary { background: #f0f0f0; color: #111; width: 100%; }
.btn-primary:hover { background: #d0d0d0; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.auth-switch { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 20px; }
.auth-switch a { color: var(--text); font-weight: 500; text-decoration: underline; }
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #450a0a; border: 1px solid #7f1d1d; color: #f87171; }
.alert-success { background: #14532d; border: 1px solid #166534; color: #4ade80; }

/* ========== DASHBOARD LAYOUT ========== */
/* wrap is just a block container — main handles its own left margin */
.wrap { display: block; min-height: 100vh; background: var(--bg-2); padding-top: 56px; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 56px; left: 0; height: calc(100vh - 56px); overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; z-index: 100; transform: translateX(-100%); transition: transform var(--transition-dur, 0.28s) cubic-bezier(0.4,0,0.2,1), width var(--transition-dur, 0.28s) cubic-bezier(0.4,0,0.2,1); }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.open { transform: translateX(0); }
.sidebar.open.collapsed { width: var(--sidebar-collapsed-w); min-width: var(--sidebar-collapsed-w); overflow-x: hidden; }
.logo { padding: 18px 16px; border-bottom: 1px solid var(--border); }
.logo-text { font-size: 17px; font-weight: 700; color: #f0f0f0; letter-spacing: -0.3px; }
.logo-text span { color: var(--text-3); }
.user-box { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.user-info-center { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.user-action-btns { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.user-action-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: opacity 0.15s, transform 0.15s; }
.user-action-btn:hover { opacity: 0.85; transform: scale(1.07); }
.user-action-profile { background: #2563eb; color: #fff; }
.user-action-logout { background: #c0392b; color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--text); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; color: #f0f0f0; }
.user-role { font-size: 11px; color: #777; }

/* Large avatar in sidebar */
.avatar-lg {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #2563eb;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #fff;
    flex-shrink: 0;
    overflow: hidden;
    border: 3px solid #2563eb;
}
.avatar-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-name-lg { font-size: 14px; font-weight: 600; color: #f0f0f0; line-height: 1.3; }
.nav-section { padding: 10px 8px 4px; }
.nav-label { font-size: 10px; color: #888; letter-spacing: 0.8px; padding: 0 8px; margin-bottom: 3px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 15px; color: #d0d0d0; cursor: pointer; transition: background 0.15s, color 0.15s; text-decoration: none; font-weight: 500; }
.nav-item:hover { background: #1e2a3a; color: #ffffff; }
.nav-item.active { background: #f0f0f0; color: #111; }
.nav-item.active svg { opacity: 1; }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.75; transition: width 0.2s, height 0.2s; }

/* Collapsed sidebar styles */
.sidebar.collapsed .nav-label { opacity: 0; height: 0; margin: 0; overflow: hidden; transition: opacity 0.2s; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar.collapsed .nav-item span, .sidebar.collapsed .nav-item-text { display: none; }
.sidebar.collapsed .nav-icon { width: 22px; height: 22px; opacity: 0.7; }
.sidebar.collapsed .nav-item.active .nav-icon { opacity: 1; }
.sidebar.collapsed .user-box { flex-direction: column; align-items: center; padding: 12px 0; gap: 6px; }
.sidebar.collapsed .user-info-center { display: none; }
.sidebar.collapsed .user-box > div:last-child { display: none; }
.sidebar.collapsed .nav-section { padding: 6px 0; }
.sidebar.collapsed .nav-item:hover .nav-icon { opacity: 1; }

/* Main area */
.main { display: flex; flex-direction: column; min-height: calc(100vh - 56px); margin-left: var(--sidebar-w); transition: margin-left var(--transition-dur, 0.28s) cubic-bezier(0.4,0,0.2,1); }
.sidebar-hidden .main { margin-left: 0; }
body:not(.sidebar-hidden) .main.collapsed-main { margin-left: var(--sidebar-collapsed-w); }
.sidebar.collapsed .avatar-lg { width: 40px; height: 40px; font-size: 14px; }


/* Content */
.content { padding: 16px 20px; flex: 1; }
.welcome-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; box-shadow: var(--shadow); }
.welcome-text p { font-size: 15px; font-weight: 600; color: #f0f0f0; }
.welcome-text small { font-size: 12px; color: #888; }
.balance-label { font-size: 10px; color: #888; letter-spacing: 0.5px; text-align: right; }
.balance-val { font-size: 22px; font-weight: 700; color: #f0f0f0; text-align: right; }

/* Section title */
.section-title { font-size: 12px; font-weight: 600; color: #777; margin-bottom: 10px; letter-spacing: 0.3px; text-transform: uppercase; }

/* Metric cards */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.metric-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; justify-content: space-between; align-items: flex-start; box-shadow: var(--shadow); }
.mc-left {}
.mc-label { font-size: 10px; color: #888; letter-spacing: 0.4px; margin-bottom: 4px; text-transform: uppercase; }
.mc-val { font-size: 20px; font-weight: 700; color: #f0f0f0; }
.mc-sub { font-size: 11px; color: #888; margin-top: 2px; }
.mc-icon { width: 32px; height: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.mc-icon.blue { background: #1e3a5f; }
.mc-icon.green { background: #14532d; }
.mc-icon.amber { background: #451a03; }
.mc-icon.red { background: #450a0a; }

/* Chart cards */
.metrics-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.chart-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart-title { font-size: 13px; font-weight: 600; color: #f0f0f0; margin-bottom: 4px; }
.chart-sub { font-size: 11px; color: #888; margin-bottom: 14px; }
.bar-wrap { display: flex; align-items: flex-end; gap: 5px; height: 100px; }
.bar { border-radius: 3px 3px 0 0; min-width: 14px; transition: opacity 0.2s; }
.bar-labels { display: flex; gap: 5px; margin-top: 4px; }
.bar-lbl { font-size: 9px; color: var(--text-3); flex: 1; text-align: center; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #bbb; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Table */
.table-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: #f0f0f0; }
.txn-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.txn-table th { padding: 8px 10px; text-align: left; color: #777; font-weight: 500; border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.txn-table td { padding: 9px 10px; color: #ccc; border-bottom: 1px solid var(--bg-3); }
.txn-table tr:last-child td { border-bottom: none; }
.txn-table tr:hover td { background: #222; }

/* Badges */
.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-blue { background: #1e3a5f; color: #60a5fa; }
.badge-green { background: #14532d; color: #4ade80; }
.badge-bkash { background: #2d0a1a; color: #e91e8c; }
.badge-nagad { background: #3d1f00; color: #f97316; }
.badge-amber { background: #451a03; color: #fbbf24; }
.badge-red { background: #450a0a; color: #f87171; }
.badge-gray { background: #2a2a2a; color: #9ca3af; }

/* Page title */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 18px; font-weight: 700; color: #f0f0f0; }
.page-sub { font-size: 13px; color: #888; margin-top: 2px; }

/* API Key box */
.apikey-box { background: #1e1e1e; border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; font-family: monospace; font-size: 13px; color: var(--text); word-break: break-all; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Sync tag */
.sync-tag { font-size: 11px; color: #aaa; display: flex; align-items: center; gap: 4px; }
.green-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }

/* ========== HEADER ========== */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    z-index: 200;
    box-shadow: var(--shadow);
}
.hamburger-btn {
    width: 40px; height: 40px;
    border: none; background: transparent; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    border-radius: 8px; padding: 8px;
    transition: background 0.15s;
    flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-2); }
.hamburger-btn span {
    display: block; width: 22px; height: 2px;
    background: var(--text); border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.header-logo { display: flex; align-items: center; }

/* Sidebar overlay - mobile only */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,0.22);
    z-index: 99;
}

/* (margin handled above) */

/* Responsive */
@media (max-width: 900px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .metrics-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    /* On mobile sidebar floats over content, no margin shift */
    .main { margin-left: 0 !important; }
    .sidebar-overlay.active { display: block; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
}
