/* ============================================================
   INFINITY Topup — PREMIUM UI LAYER
   ------------------------------------------------------------
   This file ONLY re-skins the existing site visually.
   It does not add/remove/rename any HTML, JS, IDs, classes,
   routes or behaviour. It must be linked AFTER style.css so
   these rules can safely override colors/spacing/shadows.
   Load order in <head>:
     <link rel="stylesheet" href="/assets/css/style.css">
     <link rel="stylesheet" href="/assets/css/premium-ui.css">
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap');

/* ------------------------------------------------------------
   1. DESIGN TOKENS (overrides the :root vars declared in
   style.css — everything using var(--primary) etc. re-skins
   automatically, nothing structural touched).
   ------------------------------------------------------------ */
:root {
  /* Brand palette — premium indigo/violet, Stripe/Linear inspired */
  --primary:        #6d5ef8;
  --primary-dark:   #5642e0;
  --secondary:      #f59e0b;
  --dark:           #0f1222;
  --light:          #f6f7fb;
  --gray:           #6b7280;
  --white:          #ffffff;
  --blue:           #2563eb;
  --indigo:         #6d5ef8;

  /* New premium tokens */
  --radius-sm:      10px;
  --radius:         16px;
  --radius-lg:      22px;
  --border-radius:  16px; /* keep legacy var in sync */

  --ease:           cubic-bezier(.16,1,.3,1);
  --transition:     all .28s var(--ease);

  --shadow-xs:      0 1px 2px rgba(15,18,34,.04);
  --shadow-sm:      0 2px 10px rgba(15,18,34,.06);
  --shadow:         0 10px 30px rgba(15,18,34,.08);
  --shadow-lg:      0 20px 45px rgba(15,18,34,.14);
  --shadow-glow:    0 8px 24px rgba(109,94,248,.35);

  --surface:        #ffffff;
  --surface-2:      #f6f7fb;
  --border-subtle:  rgba(15,18,34,.08);

  --glass-bg:       rgba(255,255,255,.72);
  --glass-border:   rgba(255,255,255,.5);
  --glass-blur:     18px;

  color-scheme: light;
}

body.dark-mode {
  --dark:           #e7e9f5;
  --light:           #0b0d18;
  --gray:           #9aa3b8;
  --surface:        #14162a;
  --surface-2:      #0b0d18;
  --border-subtle:  rgba(255,255,255,.08);

  --glass-bg:       rgba(20,22,42,.62);
  --glass-border:   rgba(255,255,255,.08);

  --shadow-xs:      0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:      0 2px 12px rgba(0,0,0,.35);
  --shadow:         0 10px 30px rgba(0,0,0,.45);
  --shadow-lg:      0 20px 50px rgba(0,0,0,.55);

  color-scheme: dark;
}

/* Smooth theme transition across the whole app */
body,
.top-navbar, .left-sidebar, .bottom-nav, .marquee, .modal-content,
.stat-card, .topup-card, .help-fab-main, table, table th, table td,
input, textarea, select, button,
[class*="bg-white"], [class*="bg-gray-"], [class*="border"] {
  transition: background-color .35s var(--ease),
              color .35s var(--ease),
              border-color .35s var(--ease),
              box-shadow .35s var(--ease);
}

/* ------------------------------------------------------------
   2. BASE TYPOGRAPHY
   ------------------------------------------------------------ */
body {
  font-family: 'Inter', 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif !important;
  background: var(--light);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
body.dark-mode { background: #0b0d18 !important; }

h1, h2, h3, h4, .logo-main, .sb-name, .ab-name {
  font-family: 'Manrope', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------
   3. TOP NAVBAR — glass header
   ------------------------------------------------------------ */
.top-navbar,
header.top-navbar {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  padding: 12px 20px;
}

.top-navbar .wallet-badge {
  background: linear-gradient(135deg, rgba(109,94,248,.12), rgba(109,94,248,.05));
  border: 1px solid rgba(109,94,248,.25);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
body.dark-mode .top-navbar .wallet-badge {
  background: linear-gradient(135deg, rgba(109,94,248,.22), rgba(109,94,248,.08));
  color: #c7c1ff;
  border-color: rgba(109,94,248,.35);
}

.top-navbar .btn-login {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  border-radius: 999px;
  padding: 9px 20px;
  box-shadow: var(--shadow-glow);
  letter-spacing: .01em;
}
.top-navbar .btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(109,94,248,.45);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important;
}

/* ------------------------------------------------------------
   4. MARQUEE
   ------------------------------------------------------------ */
.marquee {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  box-shadow: var(--shadow-xs);
}

/* ------------------------------------------------------------
   5. SLIDER
   ------------------------------------------------------------ */
.slider-container {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-subtle);
}
.dot { background: rgba(255,255,255,.55); }
.dot.active { background: var(--white); box-shadow: 0 0 0 2px rgba(255,255,255,.25); }

/* ------------------------------------------------------------
   6. CARDS — games / products / stats / topup
   ------------------------------------------------------------ */
.card-hover,
[onclick] .card-hover,
a.card-hover,
div.card-hover {
  border-radius: var(--radius);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.topup-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
}
.topup-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.stat-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
}

/* Generic white surfaces used across the site (Tailwind bg-white cards) */
.bg-white {
  border-radius: var(--radius);
}
.rounded-xl, .rounded-lg, .rounded-2xl {
  border-radius: var(--radius) !important;
}
.shadow, .shadow-sm, .shadow-md, .shadow-lg {
  box-shadow: var(--shadow-sm) !important;
}

/* ------------------------------------------------------------
   7. BUTTONS
   ------------------------------------------------------------ */
.btn-buy {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 999px;
  box-shadow: var(--shadow-glow);
  letter-spacing: .01em;
}
.btn-buy:hover {
  transform: translateY(-2px) scale(1);
  box-shadow: 0 14px 32px rgba(109,94,248,.4);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-outline {
  border-radius: 999px;
  border: 1.5px solid var(--primary);
}
.btn-outline:hover {
  box-shadow: var(--shadow-glow);
}

.proceed-btn, .check-id-btn {
  border-radius: var(--radius-sm);
}

.help-fab-main {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(6px);
}
.help-fab-main:hover { box-shadow: 0 10px 30px rgba(109,94,248,.5); }
.help-fab-sub a { border-radius: 999px; box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------
   8. FORM FIELDS — modern inputs everywhere (login/profile/admin)
   ------------------------------------------------------------ */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea,
select {
  border-radius: var(--radius-sm) !important;
  border: 1.5px solid var(--border-subtle) !important;
  background: var(--surface) !important;
  padding: 11px 14px;
  font-family: 'Inter', sans-serif;
  box-shadow: var(--shadow-xs);
  outline: none;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
textarea:focus,
select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(109,94,248,.15) !important;
}
body.dark-mode input:not([type="checkbox"]):not([type="radio"]),
body.dark-mode textarea,
body.dark-mode select {
  background: var(--surface) !important;
  border-color: rgba(255,255,255,.12) !important;
  color: var(--dark) !important;
}
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
  box-shadow: 0 0 0 4px rgba(109,94,248,.28) !important;
}

/* ------------------------------------------------------------
   9. LEFT SIDEBAR — premium glass panel (keeps off-canvas logic)
   ------------------------------------------------------------ */
.left-sidebar {
  background: linear-gradient(165deg, #171a30 0%, #0e0f1e 60%, #0a0b16 100%) !important;
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 8px 0 40px rgba(0,0,0,.45);
}
.sidebar-header { background: rgba(255,255,255,.03); }
.sidebar-nav a { border-radius: var(--radius-sm); }
.sidebar-nav a:hover {
  background: rgba(109,94,248,.16);
  transform: translateX(4px);
}
.sidebar-nav a .nav-icon { transition: transform .25s var(--ease); }
.sidebar-nav a:hover .nav-icon { transform: scale(1.12); }
.overlay { backdrop-filter: blur(4px); background: rgba(8,9,16,.55); }

/* ------------------------------------------------------------
   10. BOTTOM NAV — glass, floating feel
   ------------------------------------------------------------ */
.bottom-nav {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -8px 30px rgba(15,18,34,.08);
}
.bottom-nav a { transition: color .2s var(--ease), transform .2s var(--ease); }
.bottom-nav a:hover { background: transparent; transform: translateY(-2px); }
.bottom-nav a.active { position: relative; }
.bottom-nav a.active i { transform: translateY(-1px); }

/* ------------------------------------------------------------
   11. THEME TOGGLE SWITCH — refined
   ------------------------------------------------------------ */
.dark-toggle-track {
  background: #e2e4f3;
  box-shadow: inset 0 1px 3px rgba(15,18,34,.15);
}
.dark-toggle-thumb {
  box-shadow: 0 2px 6px rgba(15,18,34,.25);
}
.dark-toggle input:checked ~ .dark-toggle-track {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

/* ------------------------------------------------------------
   12. ICONS — consistent, professional feel
   ------------------------------------------------------------ */
.nav-icon i, .fa, .fas, .fab, .far {
  transition: transform .2s var(--ease), color .2s var(--ease);
}

/* ------------------------------------------------------------
   13. FOOTER
   ------------------------------------------------------------ */
footer.bg-gray-900 {
  background: linear-gradient(180deg, #0f1122 0%, #090a14 100%) !important;
}

/* ------------------------------------------------------------
   14. MODALS
   ------------------------------------------------------------ */
.modal-content, .modal-box {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border-subtle);
}

/* ------------------------------------------------------------
   15. ADMIN PANEL — subtle premium pass (kept structural rules)
   ------------------------------------------------------------ */
.admin-left-sidebar {
  background: linear-gradient(165deg, #171a30 0%, #0e0f1e 60%, #0a0b16 100%) !important;
}
.sidebar-link { border-radius: var(--radius-sm); }
.sidebar-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  box-shadow: var(--shadow-glow);
}
table th { border-radius: 0; }
table { border-radius: var(--radius); overflow: hidden; }

/* ------------------------------------------------------------
   16. SCROLLBAR — polish (non-functional, cosmetic only)
   ------------------------------------------------------------ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(109,94,248,.35);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(109,94,248,.55); background-clip: padding-box; }

/* ------------------------------------------------------------
   17. FOCUS VISIBILITY (accessibility, no logic change)
   ------------------------------------------------------------ */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------
   18. RESPONSIVE REFINEMENTS
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .top-navbar { padding: 10px 14px; }
  .slider-container { border-radius: var(--radius); }
}

/* ------------------------------------------------------------
   HEADER FIX — long brand name ("INFINITY Topup") must never
   wrap to a 2nd line or push the Login button out of shape.
   Loaded last, so it safely overrides the earlier header rules.
   ------------------------------------------------------------ */
.top-navbar,
header.top-navbar { gap: 8px; }

/* left group (hamburger + logo) can shrink; right group never does */
.top-navbar > div:first-child { min-width: 0; flex: 1 1 auto; }
.top-navbar > div:last-child  { flex: 0 0 auto; flex-wrap: nowrap; white-space: nowrap; }

.site-logo { min-width: 0; }
.site-logo .logo-text { min-width: 0; }
.site-logo .logo-text .logo-main,
.site-logo .logo-text .logo-sub {
  white-space: nowrap;      /* "BD" can no longer drop to the next line */
  overflow: hidden;
  text-overflow: ellipsis;  /* last-resort safety on very tiny screens */
}

/* Login button: icon + text always on ONE line */
.top-navbar .btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;
}
.top-navbar .btn-login i { margin: 0 !important; }

@media (max-width: 480px) {
  .top-navbar,
  header.top-navbar { padding: 8px 10px; }

  .top-navbar > div { gap: 6px !important; }
  .top-navbar > div:first-child button { margin-right: 0 !important; }

  .site-logo { gap: 6px; }
  .site-logo .logo-icon { height: 52px; }
  .navbar-logo-img { max-height: 52px; }

  /* scales with screen width: ~12px on a 360px phone */
  .site-logo .logo-text .logo-main {
    font-size: clamp(0.66rem, 3.3vw, 1rem);
    letter-spacing: 0;
  }
  .site-logo .logo-text .logo-sub { font-size: 0.55rem; letter-spacing: 0.08em; }

  .top-navbar .btn-login { padding: 7px 12px; font-size: 0.78rem; gap: 4px; }
  .top-navbar .wallet-badge { padding: 5px 10px; font-size: 0.8rem; }
  .top-navbar .dark-toggle { margin-right: 0 !important; }
}

@media (max-width: 360px) {
  .site-logo .logo-icon { display: none; }   /* free up room on very small phones */
}

/* ------------------------------------------------------------
   LOGO — a bit bigger in the header (desktop + mobile), and kept
   invisible until site-logo.js has it ready (no broken icon/flicker).
   The 4s animation is a pure-CSS failsafe so it can never stay hidden.
   ------------------------------------------------------------ */
.top-navbar .site-logo .logo-icon { height: 52px; }
.top-navbar .navbar-logo-img { max-height: 52px; }

img.js-dynamic-logo {
  opacity: 0;
  animation: logoFailsafe 0.01s linear 4s forwards;
}
img.js-dynamic-logo.logo-ready {
  opacity: 1;
  animation: none;
  transition: opacity 0.25s ease;
}
@keyframes logoFailsafe { to { opacity: 1; } }
