/* =========================================================
   SAM TOPUP — New UI (2026)
   - Single design system (no duplicates)
   - Works with Bootstrap 5.3 color modes (data-bs-theme)
   - RTL friendly
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
  --sam-radius: 18px;
  --sam-radius-sm: 14px;
  --sam-radius-xs: 8px;

  /* Brand Primitives (Fallback defaults) */
  --sam-brand-primary: #f59e0b;
  --sam-brand-primary-rgb: 245, 158, 11;
  --sam-brand-secondary: #3b82f6;
  --sam-brand-secondary-rgb: 59, 130, 246;
  --sam-accent: var(--sam-brand-secondary);
  --sam-accent-2: #a855f7;
  --sam-success: #22c55e;
  --sam-warning: var(--sam-brand-primary);

  /* Dark Theme Semantics (Default) */
  --sam-bg-canvas: #050814;
  --sam-bg-canvas-rgb: 5, 8, 20;
  --sam-surface-1: #0b1120;
  --sam-surface-2: #131c31;
  --sam-surface-elevated: #1e293b;
  --sam-surface-glass: rgba(15, 23, 42, 0.75);

  --sam-border-subtle: rgba(255, 255, 255, 0.08);
  --sam-border-default: rgba(255, 255, 255, 0.14);
  --sam-border-strong: rgba(255, 255, 255, 0.25);

  --sam-text-primary: #f8fafc;
  --sam-text-secondary: #94a3b8;
  --sam-text-muted: #64748b;
  --sam-text-on-primary: #0f172a;

  --sam-shadow-dark: 0 18px 55px rgba(0, 0, 0, 0.35);
  --sam-shadow-light: 0 18px 55px rgba(2, 6, 23, 0.10);

  color-scheme: dark;
}

:root[data-theme="light"],
:root[data-bs-theme="light"] {
  color-scheme: light;

  /* Light Theme Semantics */
  --sam-bg-canvas: #f8fafc;
  --sam-bg-canvas-rgb: 248, 250, 252;
  --sam-surface-1: #ffffff;
  --sam-surface-2: #f1f5f9;
  --sam-surface-elevated: #e2e8f0;
  --sam-surface-glass: rgba(255, 255, 255, 0.85);

  --sam-border-subtle: rgba(15, 23, 42, 0.06);
  --sam-border-default: rgba(15, 23, 42, 0.12);
  --sam-border-strong: rgba(15, 23, 42, 0.22);

  --sam-text-primary: #0f172a;
  --sam-text-secondary: #475569;
  --sam-text-muted: #64748b;
  --sam-text-on-primary: #0f172a;

  --bs-body-bg: var(--sam-bg-canvas);
  --bs-body-bg-rgb: var(--sam-bg-canvas-rgb);
  --bs-body-color: var(--sam-text-primary);
  --bs-secondary-color: var(--sam-text-secondary);
  --bs-tertiary-color: var(--sam-text-muted);
  --bs-border-color: var(--sam-border-default);
  --bs-card-bg: var(--sam-surface-1);
  --bs-modal-bg: var(--sam-surface-1);
}

:root[data-theme="dark"],
:root[data-bs-theme="dark"] {
  --bs-body-bg: var(--sam-bg-canvas);
  --bs-body-bg-rgb: var(--sam-bg-canvas-rgb);
  --bs-body-color: var(--sam-text-primary);
  --bs-secondary-color: var(--sam-text-secondary);
  --bs-tertiary-color: var(--sam-text-muted);
  --bs-border-color: var(--sam-border-default);
  --bs-card-bg: var(--sam-surface-1);
  --bs-modal-bg: var(--sam-surface-1);
}

/* Smooth Theme Transitions */
.sam-theme-transitioning,
.sam-theme-transitioning *,
.sam-theme-transitioning *::before,
.sam-theme-transitioning *::after {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease !important;
  transition-delay: 0s !important;
}

/* Semantic Typography & Utility Tokens */
.sam-text-primary { color: var(--sam-text-primary) !important; }
.sam-text-secondary { color: var(--sam-text-secondary) !important; }
.sam-text-muted { color: var(--sam-text-muted) !important; }
.sam-bg-canvas { background-color: var(--sam-bg-canvas) !important; }
.sam-surface-1 { background-color: var(--sam-surface-1) !important; }
.sam-surface-2 { background-color: var(--sam-surface-2) !important; }

/* Light Mode Universal Contrast Hardening */
:root[data-theme="light"] .card:not(.bg-primary):not(.bg-danger):not(.bg-success):not(.bg-warning):not(.bg-gradient) .text-white,
:root[data-theme="light"] .modal-content:not(.bg-primary):not(.bg-danger):not(.bg-success):not(.bg-warning) .text-white,
:root[data-theme="light"] .admin-card:not(.bg-primary):not(.bg-danger):not(.bg-success):not(.bg-warning) .text-white,
:root[data-theme="light"] .neo-card .text-white,
:root[data-theme="light"] .hero-content .text-white,
:root[data-theme="light"] .table .text-white {
  color: var(--sam-text-primary) !important;
}

:root[data-theme="light"] .text-light:not(.btn):not(.badge) {
  color: var(--sam-text-secondary) !important;
}

:root[data-theme="light"] .bg-secondary.bg-opacity-10,
:root[data-theme="light"] .bg-secondary.bg-opacity-25 {
  background-color: rgba(15, 23, 42, 0.05) !important;
}

:root[data-theme="light"] .border-secondary {
  border-color: rgba(15, 23, 42, 0.12) !important;
}

:root[data-theme="light"] .bg-dark:not(.badge):not(.btn):not(.banner-img):not(.dropdown-menu-dark) {
  background-color: var(--sam-surface-1) !important;
  color: var(--sam-text-primary) !important;
}

/* ---------- Base ---------- */
html, body{ height: 100%; }
body{
  font-family: 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
}

/* Soft background glow */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .55;
  background:
    radial-gradient(900px 550px at 90% -10%, color-mix(in srgb, var(--sam-accent) 24%, transparent), transparent 60%),
    radial-gradient(850px 520px at 10% 0%, color-mix(in srgb, var(--sam-accent-2) 18%, transparent), transparent 55%);
}

/* Links */
a{ text-decoration: none; }
a:hover{ text-decoration: none; }

/* ---------- Surfaces / Cards ---------- */
.neo-card,
.card,
.modal-content,
.dropdown-menu{
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 84%, transparent);
  box-shadow: var(--sam-shadow-dark);
}

:root[data-theme="light"] .neo-card,
:root[data-theme="light"] .card,
:root[data-theme="light"] .modal-content,
:root[data-theme="light"] .dropdown-menu{
  box-shadow: var(--sam-shadow-light);
  background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
}

.neo-link{ color: inherit; }
.neo-link:hover{ color: inherit; transform: translateY(-1px); }

/* ---------- Navbar ---------- */
.topup-nav{
  width: min(1200px, 94%);
  margin: 14px auto 10px;
  padding: 10px 14px;
  border-radius: 22px;
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 86%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--sam-shadow-dark);
}

:root[data-theme="light"] .topup-nav{
  box-shadow: var(--sam-shadow-light);
}

.navbar-brand-wrapper{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.sam-brand-logo {
  height: 36px;
  width: 36px;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  vertical-align: middle;
}
.sam-brand-logo:hover {
  transform: scale(1.06);
}
.sam-brand-logo.sam-logo-dark {
  display: none !important;
}
.sam-brand-logo.sam-logo-light {
  display: inline-block !important;
}

[data-theme="dark"] .sam-brand-logo.sam-logo-dark,
[data-bs-theme="dark"] .sam-brand-logo.sam-logo-dark {
  display: inline-block !important;
  border-radius: 8px;
}
[data-theme="dark"] .sam-brand-logo.sam-logo-light,
[data-bs-theme="dark"] .sam-brand-logo.sam-logo-light {
  display: none !important;
}

[data-theme="light"] .sam-brand-logo.sam-logo-dark,
[data-bs-theme="light"] .sam-brand-logo.sam-logo-dark {
  display: none !important;
}
[data-theme="light"] .sam-brand-logo.sam-logo-light,
[data-bs-theme="light"] .sam-brand-logo.sam-logo-light {
  display: inline-block !important;
  border-radius: 8px;
}

.logo-orbit{
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 78%, transparent);
  display:flex; align-items:center; justify-content:center;
  position: relative;
}
.logo-orbit-core{
  width: 10px; height: 10px; border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--sam-accent-2) 75%, #000 0%));
  box-shadow: 0 0 18px color-mix(in srgb, var(--sam-accent-2) 55%, transparent);
}
.logo-orbit-satellite{
  position: absolute;
  width: 6px; height: 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--sam-accent) 85%, #fff 15%);
  left: 3px; top: 5px;
  box-shadow: 0 0 14px color-mix(in srgb, var(--sam-accent) 50%, transparent);
}
.topup-brand-text{
  font-weight: 900;
  letter-spacing: .4px;
  background: linear-gradient(110deg, var(--sam-accent), var(--sam-accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Nav links */
.topup-nav .nav-link{
  color: var(--bs-body-color) !important;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  transition: .18s ease;
}
.topup-nav .nav-link:hover{
  background: color-mix(in srgb, var(--sam-accent) 12%, transparent);
  color: var(--bs-body-color) !important;
  transform: translateY(-1px);
}

/* logout */
.nav-logout{
  color: color-mix(in srgb, var(--sam-warning) 90%, var(--bs-body-color)) !important;
}
.nav-logout:hover{
  background: color-mix(in srgb, var(--sam-warning) 14%, transparent);
}

/* Theme toggle button inside nav */
a.nav-link[data-theme-toggle]{
  width: 48px;
  height: 48px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items:center;
  justify-content:center;
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 82%, transparent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--sam-accent) 18%, transparent);
}

/* Mobile nav (custom toggle used in header.php) */
#mainNav{
  transition: .18s ease;
}
@media (max-width: 991.98px){
  #mainNav{
    display: none;
    margin-top: 10px;
    padding: 10px;
    border-radius: var(--sam-radius);
    border: 1px solid var(--bs-border-color);
    background: color-mix(in srgb, var(--bs-body-bg) 90%, transparent);
    box-shadow: var(--sam-shadow-dark);
  }
  #mainNav.show{ display: block; }
  .topup-nav .navbar-nav{ gap: 6px; }
  .topup-nav .nav-link{ text-align: center; }
}

/* ---------- Buttons ---------- */
.btn-gradient{
  background: linear-gradient(135deg, var(--sam-accent), var(--sam-accent-2));
  border: 0;
  color: #fff !important;
  font-weight: 800;
  border-radius: 999px;
  padding: .55rem 1.15rem;
  box-shadow: 0 14px 34px color-mix(in srgb, var(--sam-accent-2) 22%, transparent);
}
.btn-gradient:hover{
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.btn-neo{
  background: linear-gradient(135deg, color-mix(in srgb, var(--sam-accent) 85%, #fff 0%), color-mix(in srgb, var(--sam-accent-2) 85%, #fff 0%));
  border: 0;
  color:#fff !important;
  border-radius: 14px;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--sam-accent) 18%, transparent);
}

/* ---------- Hero ---------- */
.hero-section{
  padding-top: 6px;
  padding-bottom: 8px;
}
.bg-gradient-hero{
  background: color-mix(in srgb, var(--sam-accent) 20%, transparent) !important;
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color) !important;
  border-radius: 999px;
}

.hero-title{
  font-weight: 900;
  line-height: 1.2;
}
.hero-subtitle{
  color: color-mix(in srgb, var(--bs-body-color) 70%, transparent);
}
.hero-stats .hero-stat{
  border: 1px solid var(--bs-border-color);
  border-radius: var(--sam-radius-sm);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bs-body-bg) 86%, transparent);
}
.hero-stat-number{ font-weight: 900; }
.hero-stat-label{ color: color-mix(in srgb, var(--bs-body-color) 65%, transparent); font-size: .85rem; }

/* Slider */
.hero-slider-card{
  position: relative;
  overflow: hidden;
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--sam-shadow-dark);
}
:root[data-theme="light"] .hero-slider-card{ box-shadow: var(--sam-shadow-light); }
.hero-slider-img{ height: 360px; object-fit: cover; }
@media (max-width: 576px){
  .hero-slider-img{ height: 260px; }
}
.hero-slider-overlay{
  position:absolute;
  inset:0;
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.68));
}
.carousel-caption-custom{
  position:absolute;
  bottom: 14px;
  right: 14px;
  left: 14px;
  padding: 14px;
  border-radius: var(--sam-radius);
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px);
  color: #fff;
}

/* ---------- Quick links ---------- */
.quick-link-card{ border-radius: 22px; }

/* ---------- Game/Offer cards ---------- */
.game-card, .offer-card{
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  overflow: hidden;
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
  transition: .18s ease;
}
.game-card:hover, .offer-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 18px 45px color-mix(in srgb, var(--sam-accent) 12%, transparent);
}
.game-img, .offer-img{ height: 150px; object-fit: cover; width: 100%; }
@media (max-width: 576px){ .game-img, .offer-img{ height: 120px; } }

/* ---------- Game details (game.php?id=) ---------- */
.game-details-image-wrapper{
  width: 320px;
  max-width: 100%;
  flex: 0 0 auto;
}
.game-details-img{
  width: 100%;
  height: 280px;
  /* عرض صورة اللعبة بدون تشويه (مفيد للّوجوهات والصور الطولية) */
  object-fit: contain;
  padding: 12px;
  background: color-mix(in srgb, var(--bs-body-bg) 86%, rgba(0,0,0,.08));
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
}
@media (max-width: 576px){
  .game-details-image-wrapper{ width: 100%; }
  .game-details-img{ height: 220px; }
}

/* ---------- Forms ---------- */
.form-control, .form-select{
  border-radius: 14px;
  background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
}
.form-control:focus, .form-select:focus{
  box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--sam-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--sam-accent) 55%, var(--bs-border-color));
}

/* ---------- Notifications dropdown ---------- */
.notif-bell-btn{
  position: relative;
  background: transparent;
  border: none;
  color: var(--bs-body-color) !important;
  font-size: 1.2rem;
  padding: 4px 6px;
}
.notif-dot{
  position: absolute;
  top: 4px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239,68,68,0.9);
}
.notif-count{
  position: absolute;
  top: -4px;
  left: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.notif-dropdown{
  position: absolute;
  top: 130%;
  left: 0;
  transform: translateX(-10%);
  min-width: 260px;
  background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--sam-shadow-dark);
  padding: 6px 0;
  display: none;
  z-index: 10000;
}
:root[data-theme="light"] .notif-dropdown{ box-shadow: var(--sam-shadow-light); }
.notif-dropdown-header{
  padding: 8px 12px;
  font-size: .9rem;
  font-weight: 800;
  border-bottom: 1px solid var(--bs-border-color);
}
.notif-item{
  display:block;
  padding: 10px 12px;
  font-size: .86rem;
  color: var(--bs-body-color);
  border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 70%, transparent);
}
.notif-item:hover{ background: color-mix(in srgb, var(--sam-accent) 10%, transparent); }
.notif-item.empty{ opacity: .75; }
.notif-title{ font-weight: 800; }
.notif-meta{ font-size: .78rem; opacity: .8; }
.notif-footer{ padding: 8px 12px; font-size: .82rem; }

/* ---------- Footer ---------- */
.footer-neo{
  width: min(1200px, 94%);
  margin: 0 auto 20px;
  border-radius: 22px;
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
  box-shadow: var(--sam-shadow-dark);
}
:root[data-theme="light"] .footer-neo{ box-shadow: var(--sam-shadow-light); }
.footer-icon{
  display:inline-flex;
  width: 42px; height: 42px;
  align-items:center; justify-content:center;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
  margin: 0 4px;
}
.footer-icon:hover{ transform: translateY(-1px); }

/* ---------- Widgets (verify + help bot) ---------- */
.verify-float-btn{
  position: fixed;
  top: var(--verify-top, 92px);
  left: 18px;
  z-index: 1055;
  border: 1px solid var(--bs-border-color);
  background: linear-gradient(135deg, color-mix(in srgb, var(--sam-warning) 40%, transparent), color-mix(in srgb, var(--sam-accent) 12%, transparent));
  color: var(--bs-body-color);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--sam-shadow-dark);
}
:root[data-theme="light"] .verify-float-btn{ box-shadow: var(--sam-shadow-light); }

.help-bot-fab{
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1055;
  width: 54px; height: 54px;
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  background: linear-gradient(135deg, color-mix(in srgb, var(--sam-accent) 20%, transparent), color-mix(in srgb, var(--sam-accent-2) 18%, transparent));
  color: var(--bs-body-color);
  box-shadow: var(--sam-shadow-dark);
}
:root[data-theme="light"] .help-bot-fab{ box-shadow: var(--sam-shadow-light); }


/* ---------- Admin Navbar ---------- */
.admin-nav{
  width: min(1200px, 94%);
  margin: 14px auto 10px;
  padding: 10px 14px;
  border-radius: 22px;
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 86%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--sam-shadow-dark);
  position: sticky;
  top: 10px;
  z-index: 1030;
}
:root[data-theme="light"] .admin-nav{ box-shadow: var(--sam-shadow-light); }
.admin-nav .nav-link{ color: var(--bs-body-color) !important; border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.admin-nav .nav-link:hover{ background: color-mix(in srgb, var(--sam-accent) 12%, transparent); transform: translateY(-1px); }

.admin-nav .navbar-toggler{
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  padding: 8px 10px;
}
.admin-nav .navbar-toggler:focus{ box-shadow: 0 0 0 3px color-mix(in srgb, var(--sam-accent) 18%, transparent); }


/* ---------- Home banners ---------- */
.banner-img{ aspect-ratio: 16/7; object-fit: cover; }

/* ---------- Contact card ---------- */
.contact-card{
  border: 1px solid var(--bs-border-color);
  border-radius: var(--sam-radius);
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
}

/* ---------- Login box ---------- */
.login-box{
  position: fixed;
  bottom: 86px;
  right: 18px;
  z-index: 1055;
  min-width: 190px;
  padding: 10px 12px;
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 90%, transparent);
  box-shadow: var(--sam-shadow-dark);
}
:root[data-theme="light"] .login-box{ box-shadow: var(--sam-shadow-light); }
@media (max-width: 576px){
  .login-box{
    right: 50%;
    transform: translateX(50%);
    bottom: 80px;
  }
}

/* ---------- Onboarding bot ---------- */
.onboard-bot{
  position: fixed;
  bottom: 86px;
  left: 18px;
  z-index: 1055;
}
.bot-bubble{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
  box-shadow: var(--sam-shadow-dark);
  backdrop-filter: blur(10px);
  position: relative;
}
:root[data-theme="light"] .bot-bubble{ box-shadow: var(--sam-shadow-light); }
.bot-tail{
  position:absolute;
  bottom:-9px;
  left: 26px;
  width: 18px; height: 18px;
  background: color-mix(in srgb, var(--bs-body-bg) 92%, transparent);
  border-left: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  transform: rotate(45deg);
}
.bot-avatar{
  width: 44px; height: 44px;
  border-radius: 16px;
  border: 1px solid var(--bs-border-color);
  background: linear-gradient(135deg, color-mix(in srgb, var(--sam-accent) 16%, transparent), color-mix(in srgb, var(--sam-accent-2) 14%, transparent));
  position: relative;
  flex: 0 0 44px;
}
.bot-eye{
  position:absolute;
  top: 16px;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--bs-body-color);
  opacity: .75;
}
.eye-l{ left: 12px; }
.eye-r{ right: 12px; }
.bot-text{ flex: 1; }
.bot-title{ font-weight: 900; }
.bot-msg{ opacity: .85; line-height: 1.45; }

@media (max-width: 576px){
  .onboard-bot{ left: 12px; right: 12px; bottom: 80px; }
  .bot-bubble{ max-width: calc(100vw - 24px); }
}



/* =========================================================
   Fresh Components (2026 refresh)
   ========================================================= */

/* ---------- Navbar (mobile polish) ---------- */
.topup-nav .navbar-toggler{
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  padding: 8px 10px;
}
.topup-nav .navbar-toggler:focus{ box-shadow: 0 0 0 3px color-mix(in srgb, var(--sam-accent) 18%, transparent); }
.topup-nav .navbar-collapse{
  border-top: 1px solid color-mix(in srgb, var(--bs-border-color) 70%, transparent);
  margin-top: 10px;
  padding-top: 10px;
}
@media (min-width: 992px){
  .topup-nav .navbar-collapse{
    border-top: 0; margin-top: 0; padding-top: 0;
  }
}

/* ---------- Banner / Carousel (fixed height, no jumping) ---------- */
#homeBanners{
  border-radius: var(--sam-radius);
  overflow: hidden;
}
#homeBanners .carousel-item{
  height: 240px;
}
#homeBanners .banner-img{
  width: 100%;
  height: 240px;
  object-fit: cover;
}
@media (max-width: 576px){
  #homeBanners .carousel-item{ height: 160px; }
  #homeBanners .banner-img{ height: 160px; }
}

/* Banner caption readability (light/dark) */
#homeBanners .carousel-caption{
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bs-body-bg) 55%, transparent);
  backdrop-filter: blur(10px);
  text-align: start;
}
#homeBanners .carousel-caption h5{
  margin: 0;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}
:root[data-bs-theme="light"] #homeBanners .carousel-caption{
  background: color-mix(in srgb, #fff 78%, transparent);
}
:root[data-bs-theme="light"] #homeBanners .carousel-caption h5{
  color: #111;
  text-shadow: none;
}

/* ---------- "كيف تتم عملية الشحن" cards ---------- */
.how-it-works .step-box{
  position: relative;
  padding: 16px 16px 18px;
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent);
  box-shadow: var(--sam-shadow-dark);
}
:root[data-bs-theme="light"] .how-it-works .step-box{ box-shadow: var(--sam-shadow-light); }
.how-it-works .step-number{
  width: 66px;
  height: 66px;
  font-size: 1.25rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 900;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--sam-accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--sam-accent) 35%, transparent);
}

/* ---------- Category/game description excerpt ---------- */
.neo-desc{
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Game package cards ---------- */
.game-card{
  border-radius: var(--sam-radius);
  background: color-mix(in srgb, var(--bs-body-bg) 86%, transparent);
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--sam-shadow-dark);
  transition: transform .18s ease, box-shadow .18s ease;
}
:root[data-bs-theme="light"] .game-card{ box-shadow: var(--sam-shadow-light); }
.game-card:hover{
  transform: translateY(-2px);
}
.game-card .card-title{
  font-weight: 900;
}
.game-card .badge{
  border-radius: 999px;
}

/* ---------- Chat (remove hard-coded colors, support light/dark) ---------- */
.chat-page-wrapper{
  width: min(1200px, 94%);
  margin: 10px auto 24px;
}
.chat-container{
  display:flex;
  gap: 12px;
  min-height: calc(100vh - 180px);
  border-radius: var(--sam-radius);
  border: 1px solid var(--bs-border-color);
  overflow: hidden;
  background: color-mix(in srgb, var(--bs-body-bg) 82%, transparent);
}
.chat-sidebar{
  width: 32%;
  min-width: 260px;
  background: color-mix(in srgb, var(--bs-body-bg) 72%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--bs-border-color) 85%, transparent);
  display:flex;
  flex-direction:column;
}
.chat-sidebar-header{
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 900;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 85%, transparent);
}
.chat-search{
  padding: 10px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 85%, transparent);
}
.chat-list{
  flex:1;
  overflow:auto;
  padding: 8px;
}
.chat-item{
  cursor:pointer;
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid transparent;
  transition: background .15s ease, transform .15s ease;
}
.chat-item:hover{
  background: color-mix(in srgb, var(--sam-accent) 10%, transparent);
  transform: translateY(-1px);
}
.chat-item.active{
  background: color-mix(in srgb, var(--sam-accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--sam-accent) 30%, transparent);
}
.chat-item-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.chat-last-msg{
  color: var(--bs-secondary-color);
  font-size: .85rem;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-main{
  flex:1;
  display:flex;
  flex-direction:column;
  min-width: 0;
}
.chat-header{
  padding: 12px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 85%, transparent);
}
.chat-messages{
  flex:1;
  overflow:auto;
  padding: 14px;
}
.chat-bubble{
  max-width: min(640px, 92%);
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--bs-border-color);
  margin-bottom: 10px;
}
.chat-bubble.user{
  margin-left: auto;
  background: color-mix(in srgb, var(--sam-accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--sam-accent) 32%, transparent);
}
.chat-bubble.admin{
  margin-right: auto;
  background: color-mix(in srgb, var(--bs-tertiary-bg) 70%, transparent);
}
.chat-input-area{
  border-top: 1px solid color-mix(in srgb, var(--bs-border-color) 85%, transparent);
  padding: 10px 12px;
  display:flex;
  gap: 10px;
}
.chat-input-area .chat-input{
  flex:1;
}
@media (max-width: 768px){
  .chat-container{ flex-direction: column; }
  .chat-sidebar{ width: 100%; min-width: 0; border-left: 0; border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 85%, transparent); }
}


/* Chat message bubbles generated by JS */
.msg{
  max-width: min(640px, 92%);
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--bs-border-color);
  margin-bottom: 10px;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-user{
  margin-left: auto;
  background: color-mix(in srgb, var(--sam-accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--sam-accent) 32%, transparent);
}
.msg-admin{
  margin-right: auto;
  background: color-mix(in srgb, var(--bs-tertiary-bg) 70%, transparent);
}
.msg-time{
  margin-top: 6px;
  font-size: .75rem;
  color: var(--bs-secondary-color);
  opacity: .9;
}


/* ===================== Home: Categories block ===================== */
.cat-block{
  background: var(--neo-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--neo-shadow);
  height: 100%;
  transition: transform .18s ease, box-shadow .18s ease;
}

.cat-block:hover{
  transform: translateY(-2px);
}

.cat-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cat-meta{
  color: var(--bs-secondary-color);
  font-size: .85rem;
  margin-top: 2px;
}

.cat-mini-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.mini-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  color: inherit;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.mini-item:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0,0,0,.10);
  border-color: rgba(99,102,241,.35);
}

.mini-item img{
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.05);
}

.mini-name{
  font-weight: 700;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search box on home (sections) */
.games-search .form-control{
  border-radius: 999px;
  border: 1px solid var(--bs-border-color);
  background: var(--neo-surface);
  color: var(--bs-body-color);
}
.games-search .form-control::placeholder{ color: var(--bs-secondary-color); }

/* ===================== Home: Section title ===================== */
.section-title{
  font-weight: 800;
  letter-spacing: .2px;
}

/* Simple reveal animation (optional) */
.fade-slide{
  opacity: 1;
  transform: none;
}

/* ===================== Home: Points card ===================== */
.points-badge{
  border: 1px solid var(--bs-border-color);
  border-radius: 18px;
  background: var(--neo-surface);
  box-shadow: var(--neo-shadow);
  padding: 14px;
}
.points-label{ color: var(--bs-secondary-color); font-size: .9rem; }
.points-value{ font-weight: 900; font-size: 1.6rem; line-height: 1; margin-top: 4px; }

/* Mobile tweaks */
@media (max-width: 575.98px){
  /* Mobile: turn categories into a smooth horizontal slider */
  .cat-mini-grid{
    display: flex;
    grid-template-columns: unset;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .cat-mini-grid::-webkit-scrollbar{ height: 6px; }

  .mini-item{
    min-width: 240px;
    scroll-snap-align: start;
  }

  .mini-item img{ width: 56px; height: 56px; }
  .neo-icon{ width: 60px; height: 60px; font-size: 1.75rem; }
  .neo-thumb{ width: 72px; height: 72px; }
  .how-it-works .step-number{ width: 56px; height: 56px; font-size: 1.15rem; }
}


/* ===================== Shared: Small UI atoms ===================== */
.neo-icon{
  width: 68px;
  height: 68px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  color: var(--neo-accent);
  font-size: 1.95rem;
  flex-shrink: 0;
}

.neo-thumb{
  width: 78px;
  height: 78px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,.08);
  flex-shrink: 0;
}

/* ===================== SweetAlert2 Global Styling ===================== */
.sam-swal-popup {
  border-radius: 20px !important;
  font-family: 'Tajawal', 'Cairo', system-ui, sans-serif !important;
  padding: 1.5rem !important;
}

[data-theme="dark"] .sam-swal-popup,
[data-bs-theme="dark"] .sam-swal-popup,
body.dark .sam-swal-popup {
  background: #111827 !important;
  color: #f3f4f6 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 25px rgba(245, 158, 11, 0.08) !important;
}

[data-theme="dark"] .swal2-title,
[data-bs-theme="dark"] .swal2-title {
  color: #f9fafb !important;
  font-weight: 800 !important;
}

[data-theme="dark"] .swal2-html-container,
[data-bs-theme="dark"] .swal2-html-container {
  color: #9ca3af !important;
}

[data-theme="dark"] .swal2-timer-progress-bar {
  background: #f59e0b !important;
}

[data-theme="light"] .sam-swal-popup,
[data-bs-theme="light"] .sam-swal-popup {
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

/* ===================== Universal Marketplace Shell Styling ===================== */
.universal-product-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.universal-product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 0 15px rgba(245, 158, 11, 0.12) !important;
}

.transform-scale-hover {
  transition: transform 0.35s ease;
}

.universal-product-card:hover .transform-scale-hover {
  transform: scale(1.05);
}

.trust-card {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.trust-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.35) !important;
}

.mobile-bottom-nav {
  height: 64px;
}

@media (max-width: 991.98px) {
  body {
    padding-bottom: 74px !important;
  }
}

.autocomplete-dropdown .autocomplete-item {
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  color: #f3f4f6;
  text-decoration: none;
}

.autocomplete-dropdown .autocomplete-item:hover,
.autocomplete-dropdown .autocomplete-item.active {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* ==========================================================================
   Phase 2: Comprehensive Component Contrast Hardening (WCAG 2.1 AA Compliant)
   ========================================================================== */

/* 1. Global SVG & Icon Colorability */
svg.sam-icon,
.sam-colorable-icon svg,
i.bi {
  color: inherit;
  fill: currentColor;
}

/* 2. Search Bar Component Adaptive Styling */
:root[data-theme="light"] .store-search-container .input-group {
  background-color: var(--sam-surface-1, #ffffff) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}
:root[data-theme="light"] .store-search-container input[type="search"] {
  color: var(--sam-text-primary, #0f172a) !important;
}
:root[data-theme="light"] .store-search-container input[type="search"]::placeholder {
  color: var(--sam-text-muted, #64748b) !important;
}
:root[data-theme="light"] #searchDepartmentBtn {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
}
:root[data-theme="light"] .autocomplete-dropdown {
  background-color: var(--sam-surface-1, #ffffff) !important;
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.15) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12) !important;
}
:root[data-theme="light"] .autocomplete-dropdown .autocomplete-item {
  color: var(--sam-text-primary, #0f172a) !important;
}
:root[data-theme="light"] .autocomplete-dropdown .autocomplete-item:hover,
:root[data-theme="light"] .autocomplete-dropdown .autocomplete-item.active {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
}

/* 3. Modals & Dialogs Adaptive Styling */
:root[data-theme="light"] .modal-content {
  background-color: var(--sam-surface-1, #ffffff) !important;
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15) !important;
}
:root[data-theme="light"] .modal-header,
:root[data-theme="light"] .modal-footer {
  border-color: rgba(15, 23, 42, 0.08) !important;
}
:root[data-theme="light"] .modal-content .form-control {
  background-color: rgba(15, 23, 42, 0.04) !important;
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.15) !important;
}

/* 4. Dropdowns Adaptive Styling */
:root[data-theme="light"] .dropdown-menu {
  background-color: var(--sam-surface-1, #ffffff) !important;
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1) !important;
}
:root[data-theme="light"] .dropdown-item {
  color: var(--sam-text-primary, #0f172a) !important;
}
:root[data-theme="light"] .dropdown-item:hover,
:root[data-theme="light"] .dropdown-item:focus {
  background-color: rgba(245, 158, 11, 0.1) !important;
  color: #b45309 !important;
}
:root[data-theme="light"] .dropdown-divider {
  border-color: rgba(15, 23, 42, 0.08) !important;
}
:root[data-theme="light"] .dropdown-menu-dark {
  background-color: var(--sam-surface-1, #ffffff) !important;
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}

/* 5. Tables Adaptive Styling */
:root[data-theme="light"] .table {
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}
:root[data-theme="light"] .table th {
  color: var(--sam-text-secondary, #334155) !important;
  background-color: rgba(15, 23, 42, 0.03) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}
:root[data-theme="light"] .table td {
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}
:root[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(15, 23, 42, 0.02) !important;
}
:root[data-theme="light"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(245, 158, 11, 0.06) !important;
}

/* 6. Buttons & Badges Adaptive Contrast */
:root[data-theme="light"] .btn-outline-secondary {
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.22) !important;
}
:root[data-theme="light"] .btn-outline-secondary:hover,
:root[data-theme="light"] .btn-outline-secondary.active {
  background-color: var(--sam-brand-primary, #f59e0b) !important;
  border-color: var(--sam-brand-primary, #f59e0b) !important;
  color: #000000 !important;
}
:root[data-theme="light"] .btn-outline-light {
  color: var(--sam-text-primary, #0f172a) !important;
  border-color: rgba(15, 23, 42, 0.22) !important;
}
:root[data-theme="light"] .btn-outline-light:hover {
  background-color: rgba(15, 23, 42, 0.08) !important;
  color: var(--sam-text-primary, #0f172a) !important;
}

/* 7. Mobile Bottom Navigation Adaptive Contrast */
:root[data-theme="light"] .mobile-bottom-nav {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-top-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
}

/* 8. Coming Soon Pill & Catalogs in Light Mode */
:root[data-theme="light"] .coming-soon-pill {
  background-color: rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}
:root[data-theme="light"] .coming-soon-pill .text-light {
  color: var(--sam-text-primary, #0f172a) !important;
}

/* =========================================================
   PHONE & TABLET RESPONSIVE SYSTEM (Mobile & Tablet Mode)
   - Universal Touch & Safe-Area Optimizations
   - Mobile Phones (< 576px)
   - Phablets & Landscape Phones (576px - 767.98px)
   - Tablets Portrait (768px - 991.98px)
   - Tablets Landscape (992px - 1199.98px)
   ========================================================= */

/* --- Universal Mobile & Tablet Base Touch Optimizations --- */
@media (pointer: coarse) {
  a, button, input, select, .btn, .dropdown-item, .mobile-nav-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Prevent auto-zoom on inputs in iOS / Safari */
@media (max-width: 767.98px) {
  input[type="text"],
  input[type="search"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Safe-area insets & bottom clearance for fixed mobile bottom nav */
@media (max-width: 991.98px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
  
  .footer-marketplace {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
  }
  
  .mobile-bottom-nav {
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Prevent sticky-top from covering screen on tablet/phone layouts */
  .sticky-top {
    position: static !important;
  }
  
  /* Smooth touch momentum scrolling */
  .table-responsive,
  .overflow-x-auto,
  .horizontal-scroll-row,
  .autocomplete-dropdown div {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

/* --- Mobile Phones Mode (< 576px) --- */
@media (max-width: 575.98px) {
  /* Fluid Typography Scaling */
  h1, .h1, .display-4, .display-5, .display-6 {
    font-size: clamp(1.45rem, 5.5vw, 2.1rem) !important;
    line-height: 1.25 !important;
  }
  
  h2, .h2 {
    font-size: clamp(1.25rem, 4.8vw, 1.65rem) !important;
    line-height: 1.3 !important;
  }

  h3, .h3 {
    font-size: clamp(1.1rem, 4.2vw, 1.4rem) !important;
  }

  /* Storefront Navbar on Small Phones */
  .navbar-brand-wrapper {
    gap: 0.4rem !important;
  }
  .navbar-brand-wrapper img {
    max-height: 32px !important;
  }
  .topup-brand-text {
    font-size: 1.05rem !important;
  }

  /* Collapsible Nav Menu Dropdown Drawer */
  #mainNav {
    background: var(--sam-surface-1, #0f172a);
    border: 1px solid var(--sam-border-default, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 1rem;
    margin-top: 0.75rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  }
  #mainNav .nav-link {
    padding: 0.65rem 1rem !important;
    border-radius: 10px;
    font-size: 0.95rem;
  }
  #mainNav .nav-link:hover,
  #mainNav .nav-link.active {
    background: rgba(245, 158, 11, 0.12);
  }

  /* Hero Section on Phone */
  .hero-section {
    padding-top: 1rem !important;
    padding-bottom: 1.5rem !important;
  }
  .hero-section .lead {
    font-size: 0.88rem !important;
    margin-bottom: 1.25rem !important;
  }
  .hero-section .d-flex.flex-wrap.gap-3 {
    gap: 0.5rem !important;
  }
  .hero-section .btn {
    width: 100%;
    justify-content: center;
  }
  #featuredOffersCarousel .carousel-item > div {
    height: 230px !important;
  }

  /* Product Cards & Universal Grid on Phone */
  .universal-product-card {
    border-radius: 14px !important;
  }
  .universal-product-card .card-body {
    padding: 0.65rem !important;
  }
  .universal-product-card h5 {
    font-size: 0.85rem !important;
    margin-bottom: 0.25rem !important;
  }
  .universal-product-card p {
    font-size: 0.72rem !important;
    min-height: 1.8rem !important;
    margin-bottom: 0.5rem !important;
  }
  .universal-product-card .btn {
    font-size: 0.75rem !important;
    padding: 0.35rem 0.6rem !important;
  }

  /* Search Bar Phone Scaling */
  .store-search-container {
    margin: 0.5rem auto !important;
  }
  .store-search-container .input-group {
    padding: 2px !important;
  }
  #searchDepartmentBtn {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.78rem !important;
  }
  #searchDepartmentBtn span {
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #globalStoreSearch {
    font-size: 0.85rem !important;
    padding: 0.35rem 0.5rem !important;
  }

  /* CMS Content & Cards on Phone */
  .cms-content {
    font-size: 0.95rem !important;
    line-height: 1.7 !important;
  }
  .cms-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cms-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 10px;
  }

  /* Modals on Phone */
  .modal-dialog {
    margin: 0.5rem !important;
    max-width: calc(100% - 1rem) !important;
  }
  .modal-content {
    border-radius: 18px !important;
  }

  /* DataTables & Admin Tables on Phone */
  .table {
    font-size: 0.8rem !important;
  }
  .table th, .table td {
    padding: 0.5rem 0.4rem !important;
  }

  /* Footer on Phone */
  .footer-marketplace {
    padding-top: 2rem !important;
    margin-top: 2.5rem !important;
  }
  .footer-marketplace .col-6 {
    margin-bottom: 1rem;
  }
}

/* --- Tablets Mode (576px - 991.98px) --- */
@media (min-width: 576px) and (max-width: 991.98px) {
  /* Tablet Typography */
  h1, .h1, .display-4, .display-5, .display-6 {
    font-size: clamp(1.8rem, 4vw, 2.5rem) !important;
  }
  
  h2, .h2 {
    font-size: clamp(1.4rem, 3.2vw, 1.85rem) !important;
  }

  /* Storefront Navbar on Tablet */
  .topup-brand-text {
    font-size: 1.25rem !important;
  }
  
  #mainNav {
    background: var(--sam-surface-1, #0f172a);
    border: 1px solid var(--sam-border-default, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 1.25rem;
    margin-top: 0.75rem;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.3);
  }

  /* Hero Section on Tablet */
  #featuredOffersCarousel .carousel-item > div {
    height: 280px !important;
  }

  /* Product Cards & Universal Grid on Tablet */
  .universal-product-card {
    border-radius: 16px !important;
  }
  .universal-product-card .card-body {
    padding: 0.85rem !important;
  }

  /* Search Bar Tablet Scaling */
  .store-search-container {
    max-width: 92% !important;
  }

  /* CMS Content & Layout on Tablet */
  .cms-content {
    font-size: 1rem !important;
  }
  .cms-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Admin & Seller Sidebars on Tablet */
  .admin-sidebar {
    width: 280px !important;
  }
  .admin-card {
    border-radius: 14px !important;
  }
}

/* --- Mobile Bottom Nav Enhanced States --- */
.mobile-bottom-nav {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease;
}
.mobile-nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  min-height: 44px;
  border-radius: 10px;
  transition: all 0.2s ease;
}
.mobile-nav-link:active {
  transform: scale(0.92);
}
.mobile-nav-link.active {
  color: var(--sam-brand-primary, #f59e0b) !important;
}
.mobile-nav-link.active i {
  color: var(--sam-brand-primary, #f59e0b) !important;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.4));
}

/* Light Mode Overrides for Mobile Navigation */
:root[data-theme="light"] #mainNav,
:root[data-bs-theme="light"] #mainNav {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}
:root[data-theme="light"] #mainNav .nav-link,
:root[data-bs-theme="light"] #mainNav .nav-link {
  color: #1e293b !important;
}
:root[data-theme="light"] #mainNav .nav-link:hover,
:root[data-theme="light"] #mainNav .nav-link.active,
:root[data-bs-theme="light"] #mainNav .nav-link:hover,
:root[data-bs-theme="light"] #mainNav .nav-link.active {
  color: #b45309 !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

/* =========================================================
   Unified Badge Design Tokens (Light/Dark Safe)
   ========================================================= */
.badge-pill-custom {
  padding: 0.32rem 0.8rem !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  line-height: 1.3 !important;
  vertical-align: middle;
}

/* Seller Tier Badges */
.badge-seller-new {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}
:root[data-theme="light"] .badge-seller-new,
:root[data-bs-theme="light"] .badge-seller-new {
  background: rgba(100, 116, 139, 0.12) !important;
  color: #334155 !important;
  border-color: rgba(100, 116, 139, 0.25) !important;
}

.badge-seller-verified {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(59, 130, 246, 0.35) !important;
}
:root[data-theme="light"] .badge-seller-verified,
:root[data-bs-theme="light"] .badge-seller-verified {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #1d4ed8 !important;
  border-color: rgba(37, 99, 235, 0.25) !important;
}

.badge-seller-top-rated {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}
:root[data-theme="light"] .badge-seller-top-rated,
:root[data-bs-theme="light"] .badge-seller-top-rated {
  background: rgba(217, 119, 6, 0.12) !important;
  color: #b45309 !important;
  border-color: rgba(217, 119, 6, 0.3) !important;
}

.bg-gradient-purple,
.badge-seller-elite {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(196, 181, 253, 0.5) !important;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.35);
}

/* Operational & Status Badges */
.badge-status-active {
  background: rgba(16, 185, 129, 0.16) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}
:root[data-theme="light"] .badge-status-active,
:root[data-bs-theme="light"] .badge-status-active {
  background: rgba(5, 150, 105, 0.12) !important;
  color: #047857 !important;
  border-color: rgba(5, 150, 105, 0.28) !important;
}

.badge-status-trial {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}
:root[data-theme="light"] .badge-status-trial,
:root[data-bs-theme="light"] .badge-status-trial {
  background: rgba(217, 119, 6, 0.12) !important;
  color: #b45309 !important;
  border-color: rgba(217, 119, 6, 0.3) !important;
}

.badge-status-danger,
.badge-status-pastdue,
.badge-status-disabled {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
}
:root[data-theme="light"] .badge-status-danger,
:root[data-bs-theme="light"] .badge-status-danger,
:root[data-theme="light"] .badge-status-pastdue,
:root[data-bs-theme="light"] .badge-status-pastdue,
:root[data-theme="light"] .badge-status-disabled,
:root[data-bs-theme="light"] .badge-status-disabled {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #b91c1c !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
}

.badge-status-canceled,
.badge-status-inactive {
  background: rgba(107, 114, 128, 0.15) !important;
  color: #9ca3af !important;
  border: 1px solid rgba(107, 114, 128, 0.25) !important;
}
:root[data-theme="light"] .badge-status-canceled,
:root[data-bs-theme="light"] .badge-status-canceled,
:root[data-theme="light"] .badge-status-inactive,
:root[data-bs-theme="light"] .badge-status-inactive {
  background: rgba(107, 114, 128, 0.12) !important;
  color: #4b5563 !important;
  border-color: rgba(107, 114, 128, 0.2) !important;
}

.badge-status-info {
  background: rgba(6, 182, 212, 0.16) !important;
  color: #22d3ee !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
}
:root[data-theme="light"] .badge-status-info,
:root[data-bs-theme="light"] .badge-status-info {
  background: rgba(8, 145, 178, 0.12) !important;
  color: #0e7490 !important;
  border-color: rgba(8, 145, 178, 0.25) !important;
}
