/* ══════════════════════════════════════════════════════════════
   APIsewa — Authentic Professional Dashboard
   Inspired by top Nepali fintechs (eSewa, Khalti, Fonepay)
   Design: Clean, high-contrast, corporate SaaS, trustworthy.
   ══════════════════════════════════════════════════════════════ */
:root {
    /* Brand Palette - Deep Trustworthy Corporate Blue */
    --brand-primary: #1e40af; /* Deep Blue */
    --brand-secondary: #2563eb;
    --brand-accent: #f59e0b; /* Amber/Gold for highlights */
    
    /* Layout Colors */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a; /* Slate 900 */
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;
    
    /* Borders & Lines */
    --border-light: #e2e8f0;
    --border-input: #cbd5e1;
    
    /* Text Colors */
    --text-main: #334155;
    --text-heading: #0f172a;
    --text-muted: #64748b;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    
    /* Semantic Colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    
    /* Metrics */
    --radius: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Inter', -apple-system, sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main); 
    min-height: 100vh; 
    font-size: 14px; 
    line-height: 1.5; 
    -webkit-font-smoothing: antialiased; 
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    color: var(--text-heading);
    font-weight: 600;
}

a { color: var(--brand-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography & Elements ───────────────────────── */
code { 
    background: #f1f5f9; 
    color: var(--brand-primary); 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 13px; 
    font-family: Consolas, monospace; 
}

.svg-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* ── Buttons ─────────────────────────────────────── */
.btn { 
    padding: 10px 16px; 
    border: none; 
    border-radius: var(--radius); 
    font-family: 'Inter', sans-serif; 
    font-weight: 500; 
    font-size: 14px; 
    cursor: pointer; 
    transition: background 0.2s, border 0.2s; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-secondary); }
.btn-accent { background: var(--success); color: #fff; }
.btn-accent:hover { background: #059669; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-outline { background: #fff; border: 1px solid var(--border-input); color: var(--text-heading); }
.btn-outline:hover { background: var(--bg-body); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Inputs ──────────────────────────────────────── */
.input-group { margin-bottom: 18px; }
.input-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-heading); margin-bottom: 6px; }
.input-group input, .select-sm {
    width: 100%; padding: 10px 14px; background: #fff; border: 1px solid var(--border-input);
    border-radius: var(--radius); color: var(--text-heading); font-family: inherit; font-size: 14px;
    transition: border-color 0.2s; outline: none;
}
.input-group input:focus, .select-sm:focus { border-color: var(--brand-secondary); }
.input-group input::placeholder { color: var(--text-muted); }
.select-sm { padding: 8px 12px; width: auto; min-width: 140px; cursor: pointer; }

/* ── Auth Screen (Centered Layout) ────────────────────── */
.auth-center-layout {
    display: flex; min-height: 100vh; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% -20%, #eff6ff 0%, #f8fafc 100%);
    padding: 24px;
}
.auth-card-container {
    width: 100%; max-width: 440px;
    background: #fff; padding: 48px 40px;
    border-radius: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
}
.auth-card-container h2 { font-size: 24px; margin-bottom: 32px; color: var(--text-heading); text-align: center; }

.btn-google {
    width: 100%; padding: 12px; background: #fff; border: 1px solid var(--border-input);
    border-radius: var(--radius); font-weight: 600; color: var(--text-heading);
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin-bottom: 24px; cursor: pointer; transition: background 0.2s;
}
.btn-google:hover { background: #f8fafc; }
.btn-google img { width: 20px; height: 20px; }

.auth-divider {
    display: flex; align-items: center; text-align: center; color: var(--text-muted);
    font-size: 12px; margin-bottom: 24px; font-weight: 600; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; border-bottom: 1px solid var(--border-light);
}
.auth-divider:not(:empty)::before { margin-right: .5em; }
.auth-divider:not(:empty)::after { margin-left: .5em; }

.recaptcha-mockup {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border: 1px solid var(--border-input); border-radius: 3px;
    background: #f9f9f9; margin-bottom: 24px;
}
.recaptcha-mockup label { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.recaptcha-mockup input { width: 24px; height: 24px; cursor: pointer; }
.recaptcha-mockup .rc-logo { text-align: center; }
.recaptcha-mockup .rc-logo img { width: 32px; opacity: 0.7; }
.recaptcha-mockup .rc-logo span { display: block; font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.auth-links { display: flex; justify-content: space-between; margin-bottom: 24px; font-size: 13px; font-weight: 500; }
.auth-links a { color: var(--brand-secondary); }

.auth-switch { text-align: center; margin-top: 24px; }
.btn-merchant { width: 100%; margin-top: 16px; font-size: 15px; font-weight: 600; padding: 12px; border-color: var(--border-input); color: var(--text-heading); }

.error-msg { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; min-height: 20px; font-weight: 500; }
.success-msg { color: var(--success); font-size: 13px; text-align: center; margin-top: 12px; font-weight: 500; }




/* ── Dashboard Layout ────────────────────────────── */
.dashboard { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Top Navigation Bar ──────────────────────────── */
.top-navbar {
    background: var(--bg-sidebar);
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}
.navbar-logo {
    display: flex; align-items: center; gap: 16px;
}
.navbar-logo .svg-icon { width: 28px; height: 28px; fill: var(--brand-accent); }
.navbar-logo .logo-text { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }

.hamburger-btn {
    display: none; background: transparent; border: none; color: #fff;
    cursor: pointer; padding: 4px; border-radius: 4px;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.1); }
.hamburger-btn svg { width: 24px; height: 24px; fill: none; }

.mobile-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 90; opacity: 0; transition: opacity 0.3s ease;
}
.mobile-overlay.active { display: block; opacity: 1; }

.navbar-nav { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; }
.nav-item {
    display: flex; align-items: center; gap: 8px; padding: 0 16px; height: 100%;
    color: var(--text-sidebar); font-size: 14px; font-weight: 500;
    transition: color 0.2s; text-decoration: none; position: relative;
}
.nav-item:hover { color: #fff; text-decoration: none; }
.nav-item.active { color: var(--text-sidebar-active); }
.nav-item.active::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px;
    background: var(--brand-secondary); border-radius: 3px 3px 0 0;
}
.navbar-actions .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,0.2); }
.navbar-actions .btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); color: #fff; }

/* ── Main Content ────────────────────────────────── */
.main-content { width: 100%; max-width: 1400px; margin: 0 auto; padding: 40px; flex: 1; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border-light); }
.greeting h2 { font-size: 24px; margin-bottom: 4px; }
.greeting .subtitle { color: var(--text-muted); font-size: 14px; }

.wallet-badge {
    display: flex; flex-direction: column; align-items: flex-end;
    padding: 12px 24px; background: #fff; border-radius: var(--radius-lg);
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
}
.wallet-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 4px; }
.wallet-amount { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 600; color: var(--text-heading); }

/* ── Pages ────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Stats Grid ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 24px; }
.stat-card {
    padding: 24px; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    display: flex; align-items: flex-start; gap: 16px; box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon .svg-icon { width: 24px; height: 24px; }

.stat-info { flex: 1; }
.stat-label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.stat-value { display: block; font-size: 24px; font-weight: 600; color: var(--text-heading); font-family: 'Poppins', sans-serif; }

/* ── Cards ────────────────────────────────────────── */
.card {
    padding: 32px; background: #fff; border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.card h3 { font-size: 18px; margin-bottom: 24px; display: flex; align-items: center; gap: 8px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.card-header h3 { margin-bottom: 0; }

/* ── Wallet Hero ─────────────────────────────────── */
.wallet-hero { text-align: center; padding: 48px 32px; }
.wallet-hero h3 { justify-content: center; color: var(--text-muted); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.wallet-big-amount { font-size: 48px; font-weight: 700; color: var(--text-heading); margin-bottom: 24px; letter-spacing: -1px; }
.wallet-meta { display: flex; gap: 40px; justify-content: center; padding: 20px; background: var(--bg-body); border-radius: var(--radius); display: inline-flex; }
.wallet-meta span { color: var(--text-muted); font-size: 14px; }
.wallet-meta b { color: var(--text-heading); font-size: 16px; display: block; margin-top: 4px; font-family: 'Poppins', sans-serif;}

/* ── Tables ───────────────────────────────────────── */
.table-wrapper { overflow-x: auto; margin: 0 -32px; padding: 0 32px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th { padding: 16px 24px; color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-input); background: #f8fafc; }
td { padding: 16px 24px; border-bottom: 1px solid var(--border-light); color: var(--text-main); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Status Badges */
.badge { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block; text-align: center; }
.badge-paid, .badge-credit { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.badge-pending, .badge-commission { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.badge-expired, .badge-failed, .badge-debit { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

/* ── Code Block ──────────────────────────────────── */
.code-block {
    background: #0f172a; border-radius: var(--radius); padding: 24px; overflow-x: auto;
    font-family: Consolas, 'Courier New', monospace; font-size: 14px;
    color: #e2e8f0; line-height: 1.6; border: 1px solid #1e293b;
}
.code-block code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* ── Docs ─────────────────────────────────────────── */
.doc-section { margin-bottom: 32px; }
.doc-section h4 { font-size: 16px; margin-bottom: 12px; color: var(--text-heading); border-bottom: 1px solid var(--border-light); padding-bottom: 8px; }
.doc-section p { margin-bottom: 12px; }
.doc-section ul { list-style: none; margin-bottom: 12px; }
.doc-section li { padding: 8px 0; border-bottom: 1px dashed var(--border-light); }
.doc-section li:last-child { border-bottom: none; }

/* ── AI Bot Status Badges ────────────────────────── */
.fb-status { margin-bottom: 24px; }
.status-badge {
    display: inline-block; padding: 6px 16px; border-radius: 20px;
    font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
}
.status-active { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.status-inactive { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Service Catalog ────────────────────────────── */
.catalog-section { margin-bottom: 32px; }
.catalog-section h4 { font-size: 16px; margin-bottom: 4px; color: var(--text-heading); }
.catalog-section + .catalog-section { border-top: 1px solid var(--border-light); padding-top: 24px; }

.input-group small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; }

/* ── Misc ─────────────────────────────────────────── */
.key-value {
    font-family: Consolas, monospace; font-size: 13px; color: var(--text-heading);
    background: var(--bg-body); padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border-light);
    display: inline-block; word-break: break-all;
}
.empty-state { text-align: center; color: var(--text-muted); padding: 48px; font-size: 15px; }

/* ── Omnichannel UI ──────────────────────────────── */
.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-bottom: 24px; }
.channel-card {
    background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius);
    padding: 24px; cursor: pointer; transition: all 0.2s; position: relative;
    display: flex; flex-direction: column; height: 100%;
}
.channel-card:hover { border-color: var(--brand-primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); transform: translateY(-2px); }
.channel-card.disabled { cursor: not-allowed; opacity: 0.8; }
.channel-card.disabled:hover { border-color: var(--border-light); transform: none; box-shadow: none; }
.channel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.channel-header svg { width: 32px; height: 32px; fill: none; stroke: var(--brand-primary); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.channel-card.disabled .channel-header svg { stroke: var(--text-muted); }
.channel-card h4 { margin-bottom: 8px; font-size: 16px; color: var(--text-heading); }
.channel-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex-grow: 1; margin-bottom: 16px; }
.channel-action { font-size: 13px; font-weight: 600; color: var(--brand-primary); }

.badge { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 4px; letter-spacing: 0.5px; text-transform: uppercase; }
.badge-active { background: var(--brand-primary); color: #fff; }
.badge-soon { background: var(--bg-body); color: var(--text-muted); border: 1px solid var(--border-light); }

/* ── Topup Pulse Animation ───────────────────────── */
.topup-pulse {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    background: var(--success); animation: pulse-ring 1.5s infinite;
}
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ── Responsive ──────────────────────────────────── */

/* Large screens → 2-col stats */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet breakpoint */
@media (max-width: 900px) {
    .main-content { padding: 24px 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .card { padding: 24px; }
    .table-wrapper { margin: 0 -24px; padding: 0 24px; }
    .channel-grid { grid-template-columns: 1fr; }

    /* Auth card on tablet */
    .auth-center-layout { padding: 16px; }
    .auth-card-container { padding: 32px 28px; }
}

/* Mobile breakpoint */
@media (max-width: 768px) {

    /* ── Navbar: Mobile Hamburger Layout ── */
    .top-navbar { position: sticky; top: 0; z-index: 100; }
    .navbar-container {
        height: 64px; padding: 0 16px; align-items: center; justify-content: space-between; flex-direction: row; flex-wrap: nowrap;
    }
    
    .hamburger-btn { display: flex; align-items: center; justify-content: center; }
    
    .navbar-logo { flex: 0; width: auto; padding-bottom: 0; }
    .navbar-actions { position: static; }
    .navbar-actions .btn { padding: 6px 12px; font-size: 12px; }

    /* Sliding Sidebar Menu */
    .navbar-nav {
        position: fixed; top: 0; left: -280px; width: 280px; height: 100vh;
        background: var(--bg-sidebar); flex-direction: column; align-items: stretch;
        justify-content: flex-start; gap: 0; padding: 64px 0 24px; margin: 0;
        border-top: none; transition: left 0.3s ease; z-index: 105;
        border-right: 1px solid #1e293b;
    }
    .navbar-nav.menu-open { left: 0; }
    
    .nav-item {
        padding: 20px 24px; font-size: 18px; border-radius: 0;
        height: auto; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.05);
        background: transparent; font-weight: 500;
    }
    .nav-item:hover { background: rgba(255,255,255,0.05); }
    .nav-item.active { background: var(--brand-primary); color: #fff; }

    /* ── Main Content ── */
    .main-content { padding: 20px 16px; }

    /* ── Top Bar (Welcome + Balance) ── */
    .top-bar {
        flex-direction: column; align-items: stretch; gap: 16px;
        padding-bottom: 16px; margin-bottom: 24px;
    }
    .greeting h2 { font-size: 20px; }
    .greeting .subtitle { font-size: 13px; }
    .wallet-badge {
        align-items: center; flex-direction: row; justify-content: space-between;
        padding: 12px 16px;
    }
    .wallet-label { margin-bottom: 0; }
    .wallet-amount { font-size: 18px; }

    /* ── Stats Grid: single column ── */
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .stat-card { padding: 16px; gap: 12px; }
    .stat-icon { width: 40px; height: 40px; }
    .stat-icon .svg-icon { width: 20px; height: 20px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 12px; }

    /* ── Cards ── */
    .card { padding: 20px 16px; margin-bottom: 16px; }
    .card h3 { font-size: 16px; margin-bottom: 16px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 12px; }

    /* ── Wallet Hero ── */
    .wallet-hero { padding: 32px 16px; }
    .wallet-big-amount { font-size: 32px; letter-spacing: -0.5px; }
    .wallet-meta {
        flex-direction: column; gap: 12px; padding: 16px;
        text-align: center; display: flex; width: 100%;
    }
    .wallet-meta span { font-size: 13px; }
    .wallet-meta b { font-size: 15px; }

    /* ── Tables ── */
    .table-wrapper { margin: 0 -16px; padding: 0 16px; }
    th, td { padding: 10px 12px; font-size: 12px; }
    th { font-size: 10px; }

    /* ── Forms / Inputs ── */
    .input-group input { font-size: 16px; /* prevents iOS zoom on focus */ }

    /* ── Channel / Integration Cards ── */
    .channel-grid { grid-template-columns: 1fr; gap: 16px; }
    .channel-card { padding: 16px; }
    .channel-header svg { width: 24px; height: 24px; }
    .channel-card h4 { font-size: 14px; }
    .channel-card p { font-size: 12px; }

    /* ── Code Blocks ── */
    .code-block { padding: 16px; font-size: 12px; }

    /* ── Auth ── */
    .auth-center-layout { padding: 12px; }
    .auth-card-container { padding: 28px 20px; border-radius: 16px; }
    .auth-card-container h2 { font-size: 20px; margin-bottom: 24px; }

    /* ── Misc ── */
    .key-value { font-size: 11px; padding: 6px 10px; }
    .empty-state { padding: 32px 16px; font-size: 14px; }
    .doc-section h4 { font-size: 14px; }
}

/* Small phone (iPhone SE, etc) */
@media (max-width: 380px) {
    .navbar-container { padding: 10px 12px; }
    .nav-item { padding: 16px 20px; font-size: 16px; }
    .main-content { padding: 16px 12px; }
    .stat-card { padding: 12px; }
    .card { padding: 16px 12px; }
    .wallet-big-amount { font-size: 28px; }
    .greeting h2 { font-size: 18px; }
    .auth-card-container { padding: 24px 16px; }
}

