/* ==============================================================================
   🚀 AVATAR PAY - 100% Exact Pixel-Perfect Stylesheet Matching Screenshots
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --brand-theme-color: #e50914;
  --bg-main: #08090d;
  --bg-sidebar: #06070a;
  --bg-card: #0f1118;
  --bg-card-inner: #141824;
  --border-card: #181c26;
  --border-subtle: #1e2433;
  --text-main: #ffffff;
  --text-muted: #8b949e;
}

html.light {
  --bg-main: #f4f6f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-inner: #f1f5f9;
  --border-card: #e2e8f0;
  --border-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
}

.brand-font {
  font-family: 'Outfit', 'Cairo', sans-serif;
}

.mono-font {
  font-family: 'JetBrains Mono', monospace;
}

/* Sidebar */
.sidebar-container {
  background-color: var(--bg-sidebar);
  border-right: 1px solid #131620;
}
html.light .sidebar-container {
  border-right-color: #e2e8f0;
}

/* Navigation Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}
[dir="rtl"] .nav-link {
  text-align: right;
}
.nav-link:hover, .nav-link.active {
  background-color: #141824;
  color: #ffffff;
}
.nav-link.active i {
  color: #e50914;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.35rem 0.75rem 0.35rem 1.25rem;
  border-radius: 0.375rem;
  color: #94a3b8;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-sub-link:hover, .nav-sub-link.active {
  color: #ffffff;
}
.nav-sub-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #475569;
}
.nav-sub-link.active .nav-sub-dot {
  background-color: #e50914;
  box-shadow: 0 0 6px #e50914;
}

/* Buttons */
.btn-red-pill {
  background: linear-gradient(135deg, #e50914 0%, #b30000 100%);
  color: #ffffff;
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}
.btn-red-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.45);
}

.btn-secondary {
  background: #141824;
  color: #cbd5e1;
  border: 1px solid #1e2433;
  border-radius: 0.625rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: #1e2433;
  color: #ffffff;
}

.btn-purple-sm {
  background: #2b173e;
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}
.btn-purple-sm:hover {
  background: #3c1e57;
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.5);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #1e2433;
  transition: .3s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #e50914;
}
input:checked + .slider:before {
  transform: translateX(18px);
}

/* Cards & Surfaces */
.surface-card, .table-card {
  background-color: #0f1118;
  border: 1px solid #181c26;
  border-radius: 1rem;
}
html.light .surface-card, html.light .table-card {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

/* Form Inputs */
.codeex-input {
  background-color: #141824;
  border: 1px solid #1e2433;
  border-radius: 0.625rem;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}
.codeex-input:focus {
  border-color: #e50914;
}

/* Filter Tabs - Pill Styling matching Screenshot 2 */
.inv-filter-btn, .txn-filter-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}
.inv-filter-btn:hover, .txn-filter-btn:hover {
  background-color: #141824;
  color: #ffffff;
}
.inv-filter-btn.active, .txn-filter-btn.active {
  background-color: #1e2433;
  color: #ffffff;
  border-color: #2d3748;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Status Badges - Sleek Capsules matching Screenshot 2 */
.badge-status-approved, .badge-status-paid {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.badge-status-review {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.badge-status-pending {
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.badge-status-rejected, .badge-status-expired {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #141824;
  border: 1px solid #1e2433;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background-color: rgba(8, 9, 13, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden {
  display: none !important;
}
.modal-card {
  background-color: #0f1118;
  border: 1px solid #181c26;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
}

/* ========================================================================= */
/* 🌞 LIGHT MODE OVERHAUL (Page Outer Light Gray, Cards Crisp Pure White)   */
/* ========================================================================= */
html.light,
html.light body {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
}

html.light #admin-main-wrapper,
html.light main {
  background-color: #f8fafc !important;
}

html.light header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light .surface-card,
html.light .table-card,
html.light .sidebar-container,
html.light .invoice-card,
html.light .bg-\[\#0f1118\],
html.light .bg-\[\#06070a\],
html.light .bg-\[\#0d1017\],
html.light .bg-\[\#08090d\],
html.light [class*="bg-[#0d1017]"],
html.light [class*="bg-[#08090d]"],
html.light [class*="bg-[#0f1118]"],
html.light [class*="bg-[#06070a]"],
html.light [class*="bg-[#0b0d13]"],
html.light [class*="bg-[#0c1018]"],
html.light [class*="bg-[#050608]"],
html.light [class*="bg-[#090b10]"],
html.light [id^="inv-card-"],
html.light [id^="card-"],
html.light [id^="apikey-card-"],
html.light [id^="instapay-card-"],
html.light [id^="user-card-"],
html.light #invoices-list-container > div,
html.light #instapay-accounts-grid > div,
html.light #limits-container > div,
html.light #apikeys-list-container > div,
html.light #users-grid > div {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

html.light [class*="bg-[#141824]"],
html.light .bg-\[\#141824\] {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html.light [class*="border-[#181c26]"],
html.light [class*="border-[#1e2433]"],
html.light [class*="border-[#131620]"],
html.light [class*="border-slate-800"],
html.light [class*="border-slate-700"] {
  border-color: #e2e8f0 !important;
}

html.light .sidebar-container {
  background-color: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
  border-left: none !important;
}

html[dir="rtl"].light .sidebar-container {
  border-left: 1px solid #e2e8f0 !important;
  border-right: none !important;
}

html.light .text-white {
  color: #0f172a !important;
}

html.light .text-slate-300,
html.light .text-slate-200 {
  color: #334155 !important;
}

html.light .text-slate-400,
html.light .text-slate-500 {
  color: #64748b !important;
}

html.light .border-\[\#181c26\],
html.light .border-\[\#1e2433\],
html.light .border-\[\#131620\],
html.light .border-slate-800,
html.light .border-slate-700 {
  border-color: #e2e8f0 !important;
}

html.light .codeex-input,
html.light input[type="text"],
html.light input[type="email"],
html.light input[type="password"],
html.light input[type="number"],
html.light select,
html.light textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light .codeex-input:focus,
html.light input:focus,
html.light select:focus {
  border-color: #e50914 !important;
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.15) !important;
}

/* Sidebar Navigation - Exact Match to Screenshot 4 */
html.light .nav-link {
  color: #475569 !important;
}

html.light .nav-link:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .nav-link.active {
  background: #fff1f2 !important;
  color: #e50914 !important;
  border-radius: 0.5rem !important;
  border: none !important;
  box-shadow: none !important;
  font-weight: 700 !important;
}

html.light .nav-link.active i,
html.light .nav-link.active span {
  color: #e50914 !important;
}

html.light .nav-sub-link {
  color: #64748b !important;
}

html.light .nav-sub-link:hover,
html.light .nav-sub-link.active {
  color: #e50914 !important;
}

html.light .btn-secondary {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

html.light .btn-secondary:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .btn-purple-sm {
  background: #f5f3ff !important;
  color: #7c3aed !important;
  border: 1px solid #ddd6fe !important;
}
html.light .btn-purple-sm:hover {
  background: #ede9fe !important;
}

html.light .bg-\[\#141824\] {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html.light .bg-\[\#050608\],
html.light .bg-\[\#090b10\] {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Modals */
html.light .modal-card,
html.light #modal-qr-preview > div,
html.light #modal-payment-method > div,
html.light #modal-create-invoice > div,
html.light #modal-edit-invoice > div,
html.light #modal-instapay-account > div,
html.light #modal-create-apikey > div,
html.light #modal-user > div,
html.light #modal-log-details > div,
html.light #modal-edit-instapay > div {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

html.light .modal-overlay,
html.light .fixed.inset-0.bg-\[\#08090d\]\/85 {
  background-color: rgba(15, 23, 42, 0.4) !important;
}

/* Filter buttons */
html.light .inv-filter-btn,
html.light .txn-filter-btn,
html.light .log-level-btn,
html.light .btn-apikeys-filter,
html.light .btn-stream-filter {
  background-color: #ffffff !important;
  color: #64748b !important;
  border-color: #e2e8f0 !important;
}

html.light .inv-filter-btn.active,
html.light .txn-filter-btn.active,
html.light .log-level-btn.active,
html.light .btn-apikeys-filter.active,
html.light .btn-stream-filter.active {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
}

/* Tables and Status Badges - Exact Screenshot 4 Matching */
html.light thead {
  background-color: #f8fafc !important;
  color: #64748b !important;
  border-color: #e2e8f0 !important;
}

html.light tbody tr:hover {
  background-color: #f8fafc !important;
}

html.light .divide-\[\#151822\] > :not([hidden]) ~ :not([hidden]),
html.light .divide-\[\#0f131d\] > :not([hidden]) ~ :not([hidden]),
html.light .divide-\[\#181c26\] > :not([hidden]) ~ :not([hidden]) {
  border-color: #e2e8f0 !important;
}

/* Status Badges - Clean Pastel Aesthetic */
html.light .badge-status-approved {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}

html.light .badge-status-pending {
  background-color: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

html.light .badge-status-review {
  background-color: #e0e7ff !important;
  color: #4338ca !important;
  border: 1px solid #c7d2fe !important;
}

html.light .badge-status-rejected {
  background-color: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1px solid #fca5a5 !important;
}

/* Mobile Sidebar Drawer (Closed & Hidden by Default on Mobile & Tablet <= 1024px) */
@media (max-width: 1024px) {
  .sidebar-container {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: 270px !important;
    max-width: 85vw !important;
    z-index: 9999 !important;
    transform: translateX(100%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s, visibility 0.28s !important;
    box-shadow: -15px 0 35px rgba(0, 0, 0, 0.85) !important;
    background-color: #06070a !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }
  [dir="ltr"] .sidebar-container {
    right: auto !important;
    left: 0 !important;
    transform: translateX(-100%) !important;
    box-shadow: 15px 0 35px rgba(0, 0, 0, 0.85) !important;
  }
  .sidebar-container.sidebar-open {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
    opacity: 1 !important;
  }
  .mobile-sidebar-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background-color: rgba(4, 5, 8, 0.8) !important;
    backdrop-filter: blur(6px) !important;
    z-index: 9998 !important;
    transition: opacity 0.25s ease-in-out !important;
  }
}

/* 🌞 LIGHT MODE OVERHAUL FOR CHECKOUT */
html.light body {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
}

html.light #checkout-card,
html.light .checkout-card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.04) !important;
  color: #0f172a !important;
}

html.light #checkout-card header {
  border-color: #e2e8f0 !important;
}

html.light #checkout-card header span.brand-font,
html.light #checkout-card .text-white,
html.light #checkout-card h3 {
  color: #0f172a !important;
}

html.light #btn-checkout-lang,
html.light #btn-checkout-theme {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html.light #btn-checkout-lang:hover,
html.light #btn-checkout-theme:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .checkout-method-tile {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light .checkout-method-tile:hover {
  border-color: #e50914 !important;
  background-color: #fff1f2 !important;
}

html.light .checkout-method-tile.border-\[\#e50914\],
html.light .checkout-method-tile.active {
  background-color: #fff1f2 !important;
  border-color: #e50914 !important;
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.15) !important;
}

html.light .checkout-method-tile > div {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.light .checkout-method-tile span {
  color: #0f172a !important;
}

html.light #receiver-account-display {
  color: #0f172a !important;
}

html.light #btn-copy-account {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light #btn-copy-account:hover {
  background-color: #f1f5f9 !important;
}

html.light #input-sender-number {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light #checkout-dropzone {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html.light #checkout-dropzone:hover {
  border-color: #e50914 !important;
  background-color: #fff1f2 !important;
}

html.light #checkout-dropzone .w-9.h-9 {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

html.light #checkout-dropzone div.text-slate-200 {
  color: #0f172a !important;
}

html.light #view-wallet-steps .text-slate-300 {
  color: #475569 !important;
}

html.light #view-wallet-steps span.rounded-full.bg-slate-800 {
  background-color: #e2e8f0 !important;
  color: #334155 !important;
}

html.light #callout-amount {
  color: #b45309 !important;
}

html.light #view-instapay-qr > div {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.light #check-terms ~ span {
  color: #475569 !important;
}

html.light #section-status-banner {
  background-color: #f0fdf4 !important;
  border-color: #86efac !important;
}

html.light #status-main-title {
  color: #14532d !important;
}

html.light #status-sub-title {
  color: #15803d !important;
}
