/* ==========================================================================
   MYTPSMS - Theme
   Primary: #1E5BFF | Background: #FFFFFF | Dark accent: #0F172A
   ========================================================================== */

:root {
  --mt-primary: #1E5BFF;
  --mt-primary-dark: #1547cc;
  --mt-primary-light: #5B8BFF;
  --mt-accent: #00D4B5;
  --mt-bg: #F4F7FE;
  --mt-surface: #FFFFFF;
  --mt-dark: #0F172A;
  --mt-text: #0F172A;
  --mt-muted: #64748B;
  --mt-border: #E6EAF2;
  --mt-radius: 14px;
  --mt-shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.04);
  --mt-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --mt-shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.16);
  --mt-ease: cubic-bezier(.4, 0, .2, 1);
  --bs-primary: var(--mt-primary);
  --bs-primary-rgb: 30, 91, 255;
  --bs-border-radius: .65rem;
  --bs-border-radius-lg: .85rem;
}

[data-bs-theme="dark"] {
  --mt-bg: #0B1220;
  --mt-surface: #121A2E;
  --mt-text: #E6EAF2;
  --mt-muted: #94A3B8;
  --mt-border: #1F2A44;
  --mt-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --mt-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --mt-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--mt-bg);
  color: var(--mt-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; }

/* Long inline values (API keys, references) shouldn't force horizontal scroll */
code { word-break: break-word; }
img { max-width: 100%; height: auto; }

a { text-decoration: none; transition: color .15s var(--mt-ease); }

::selection { background: rgba(30, 91, 255, 0.2); }

:focus-visible {
  outline: 2px solid var(--mt-primary);
  outline-offset: 2px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--mt-border);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--mt-muted); }

/* ---- Fade-up entrance animation ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
  animation: fadeInUp .6s var(--mt-ease) both;
}
.animate-fade-up.delay-1 { animation-delay: .08s; }
.animate-fade-up.delay-2 { animation-delay: .16s; }
.animate-fade-up.delay-3 { animation-delay: .24s; }

/* ---- Gradient text / hero utilities ---- */
.text-gradient {
  background: linear-gradient(135deg, var(--mt-primary-light) 0%, var(--mt-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-gradient {
  position: relative;
  background: linear-gradient(135deg, var(--mt-dark) 0%, var(--mt-primary) 100%);
  color: #fff;
  overflow: hidden;
}
.hero-gradient::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.10) 0, transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(0,212,181,0.18) 0, transparent 40%);
  pointer-events: none;
}
.hero-gradient > * { position: relative; z-index: 1; }

/* ---- Section heading helpers ---- */
.section-eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mt-primary);
  background: rgba(30, 91, 255, 0.1);
  border-radius: 999px;
  padding: .3rem .9rem;
  margin-bottom: .75rem;
}

/* ---- Buttons ---- */
.btn {
  font-weight: 600;
  transition: transform .15s var(--mt-ease), box-shadow .15s var(--mt-ease), background-color .15s var(--mt-ease), border-color .15s var(--mt-ease), color .15s var(--mt-ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background-color: var(--mt-primary);
  border-color: var(--mt-primary);
  box-shadow: 0 4px 14px rgba(30, 91, 255, 0.28);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--mt-primary-dark);
  border-color: var(--mt-primary-dark);
  box-shadow: 0 6px 18px rgba(30, 91, 255, 0.35);
  transform: translateY(-1px);
}
.btn-outline-primary {
  color: var(--mt-primary);
  border-color: var(--mt-primary);
}
.btn-outline-primary:hover {
  background-color: var(--mt-primary);
  border-color: var(--mt-primary);
  transform: translateY(-1px);
}
.btn-lg { border-radius: .9rem; }
.text-primary { color: var(--mt-primary) !important; }
.bg-primary { background-color: var(--mt-primary) !important; }

/* ---- Cards ---- */
.card {
  background-color: var(--mt-surface);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow-sm);
  transition: box-shadow .2s var(--mt-ease), transform .2s var(--mt-ease), border-color .2s var(--mt-ease);
}
.card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--mt-border);
  font-weight: 600;
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--mt-shadow-md);
  border-color: rgba(30, 91, 255, 0.25);
}
.stat-card {
  border-radius: var(--mt-radius);
  padding: 1.25rem 1.5rem;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(30, 91, 255, 0.1);
  color: var(--mt-primary);
  flex-shrink: 0;
}
.stat-card h3 { margin: 0; font-weight: 700; }
.stat-card .stat-label { color: var(--mt-muted); font-size: .85rem; }

/* Coloured stat icon variants */
.stat-icon.icon-primary { background: rgba(30, 91, 255, 0.10); color: var(--mt-primary); }
.stat-icon.icon-success { background: rgba(15, 157, 88, 0.12); color: #0F9D58; }
.stat-icon.icon-warning { background: rgba(224, 147, 11, 0.14); color: #E0930B; }
.stat-icon.icon-info    { background: rgba(0, 182, 160, 0.14); color: #00B6A0; }
[data-bs-theme="dark"] .stat-icon.icon-success { color: #4ADE91; }
[data-bs-theme="dark"] .stat-icon.icon-warning { color: #FFC75A; }
[data-bs-theme="dark"] .stat-icon.icon-info    { color: #3FE0CE; }

/* ---- Dashboard welcome banner ---- */
.welcome-card {
  position: relative;
  background: linear-gradient(135deg, var(--mt-dark) 0%, var(--mt-primary) 100%);
  color: #fff;
  border-radius: var(--mt-radius);
  padding: 1.75rem;
  overflow: hidden;
  box-shadow: var(--mt-shadow-md);
}
.welcome-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 20%, rgba(255,255,255,0.12) 0, transparent 40%),
    radial-gradient(circle at 88% 90%, rgba(0,212,181,0.22) 0, transparent 45%);
  pointer-events: none;
}
.welcome-card > * { position: relative; z-index: 1; }
.welcome-balance {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

/* ---- Quick-action tiles ---- */
.quick-tile {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem 1rem;
  border: 1px solid var(--mt-border);
  border-radius: 12px;
  background: var(--mt-surface);
  color: var(--mt-text);
  transition: transform .15s var(--mt-ease), box-shadow .15s var(--mt-ease), border-color .15s var(--mt-ease);
}
.quick-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--mt-shadow-sm);
  border-color: rgba(30, 91, 255, 0.35);
  color: var(--mt-text);
}
.quick-tile .qt-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 91, 255, 0.1);
  color: var(--mt-primary);
  font-size: 1.2rem;
  flex-shrink: 0;
}
.quick-tile .qt-title { font-weight: 600; line-height: 1.2; }
.quick-tile .qt-sub { color: var(--mt-muted); font-size: .8rem; }
.quick-tile i.qt-chevron { margin-left: auto; color: var(--mt-muted); }

/* ---- Form controls ---- */
.form-control, .form-select {
  border-color: var(--mt-border);
  background-color: var(--mt-surface);
  color: var(--mt-text);
  transition: border-color .15s var(--mt-ease), box-shadow .15s var(--mt-ease);
}
.form-control:focus, .form-select:focus {
  border-color: var(--mt-primary);
  box-shadow: 0 0 0 .2rem rgba(30, 91, 255, 0.15);
  background-color: var(--mt-surface);
  color: var(--mt-text);
}
.input-group-text {
  background-color: var(--mt-bg);
  border-color: var(--mt-border);
  color: var(--mt-muted);
}

/* ---- Auth pages ---- */
.auth-wrapper {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--mt-dark) 0%, var(--mt-primary) 100%);
  padding: 1.5rem;
}
.auth-back-link {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: .9rem;
  transition: color .15s var(--mt-ease);
}
.auth-back-link:hover { color: #fff; }
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--mt-surface);
  border-radius: 18px;
  padding: 2.25rem;
  box-shadow: var(--mt-shadow-lg);
  animation: fadeInUp .5s var(--mt-ease) both;
}
.auth-logo {
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--mt-primary);
}
.auth-logo span { color: var(--mt-dark); }
[data-bs-theme="dark"] .auth-logo span { color: #fff; }

/* ---- App shell ---- */
.app-navbar {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--mt-border);
  height: 64px;
}
[data-bs-theme="dark"] .app-navbar {
  background-color: rgba(18, 26, 46, 0.85);
}
.app-navbar .brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--mt-primary);
}
.app-navbar .brand span { color: var(--mt-text); }

/* ---- Marketing nav links (landing/pricing pages) ---- */
.navbar-link {
  position: relative;
  color: var(--mt-muted);
  font-weight: 600;
  text-decoration: none;
  transition: color .15s ease;
  padding-bottom: 2px;
}
.navbar-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--mt-primary);
  border-radius: 2px;
  transition: right .2s var(--mt-ease);
}
.navbar-link:hover,
.navbar-link.active {
  color: var(--mt-primary);
}
.navbar-link:hover::after,
.navbar-link.active::after {
  right: 0;
}

/* ---- Pricing page ---- */
.pricing-card {
  position: relative;
  border-radius: var(--mt-radius);
  transition: transform .2s var(--mt-ease), box-shadow .2s var(--mt-ease);
}
.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--mt-shadow-md);
}
.pricing-card .price-value {
  font-size: 2.25rem;
  font-weight: 800;
}
.pricing-card ul {
  list-style: none;
  padding-left: 0;
}
.pricing-card ul li {
  padding: .35rem 0;
  color: var(--mt-muted);
}
.pricing-card ul li i {
  color: var(--mt-primary);
  margin-right: .5rem;
}

.app-sidebar {
  width: 250px;
  background-color: var(--mt-surface);
  border-right: 1px solid var(--mt-border);
  min-height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
}
.app-sidebar .nav-link {
  color: var(--mt-muted);
  border-radius: 10px;
  padding: .65rem 1rem;
  font-weight: 500;
  margin: .15rem .75rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  transition: background-color .15s var(--mt-ease), color .15s var(--mt-ease), transform .1s var(--mt-ease);
}
.app-sidebar .nav-link.active,
.app-sidebar .nav-link:hover {
  background-color: rgba(30, 91, 255, 0.1);
  color: var(--mt-primary);
}
.app-sidebar .nav-link.active {
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--mt-primary);
}
.app-sidebar .nav-link:hover {
  transform: translateX(2px);
}
.app-sidebar .nav-section {
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--mt-muted);
  padding: 1rem 1.5rem .25rem;
  font-weight: 700;
}

.app-main {
  padding: 1.5rem;
}

.wallet-pill {
  background: rgba(30, 91, 255, 0.1);
  color: var(--mt-primary);
  border-radius: 999px;
  padding: .4rem 1rem;
  font-weight: 700;
  font-size: .9rem;
  transition: background-color .15s var(--mt-ease), transform .15s var(--mt-ease);
}
.wallet-pill:hover {
  background: rgba(30, 91, 255, 0.18);
  transform: translateY(-1px);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mt-border);
  background: transparent;
  color: var(--mt-text);
  cursor: pointer;
  transition: border-color .15s var(--mt-ease), color .15s var(--mt-ease), transform .2s var(--mt-ease);
}
.theme-toggle:hover { border-color: var(--mt-primary); color: var(--mt-primary); transform: rotate(15deg); }

/* ---- Order / status badges ---- */
.badge-status-pending,
.badge-status-active,
.badge-status-received,
.badge-status-completed,
.badge-status-cancelled,
.badge-status-refunded,
.badge-status-expired {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .01em;
}
.badge-status-pending  { background-color: #FFF3CD; color: #8A6D1A; }
.badge-status-active   { background-color: #DCEBFF; color: #1E5BFF; }
.badge-status-received { background-color: #D7F7E9; color: #0F9D58; }
.badge-status-completed{ background-color: #D7F7E9; color: #0F9D58; }
.badge-status-cancelled{ background-color: #F1F2F4; color: #64748B; }
.badge-status-refunded { background-color: #E6EAF2; color: #475569; }
.badge-status-expired  { background-color: #FDE2E1; color: #C0392B; }

[data-bs-theme="dark"] .badge-status-pending  { background-color: rgba(255,243,205,.15); color: #FFD874; }
[data-bs-theme="dark"] .badge-status-active   { background-color: rgba(30,91,255,.18); color: #7AA2FF; }
[data-bs-theme="dark"] .badge-status-received,
[data-bs-theme="dark"] .badge-status-completed { background-color: rgba(15,157,88,.18); color: #4ADE91; }
[data-bs-theme="dark"] .badge-status-cancelled { background-color: rgba(148,163,184,.18); color: #CBD5E1; }
[data-bs-theme="dark"] .badge-status-refunded { background-color: rgba(148,163,184,.18); color: #CBD5E1; }
[data-bs-theme="dark"] .badge-status-expired  { background-color: rgba(253,226,225,.15); color: #FF8C82; }

/* ---- Number display / OTP box ---- */
.otp-box {
  font-family: 'Courier New', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: .15em;
  color: var(--mt-primary);
  background: rgba(30, 91, 255, 0.08);
  border-radius: 10px;
  padding: .75rem 1.25rem;
  text-align: center;
}
.copyable {
  cursor: pointer;
}

.spinner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--mt-primary);
  display: inline-block;
  animation: pulse 1s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ---- Tables ---- */
.table { color: var(--mt-text); }
.table > :not(caption) > * > * { background-color: transparent; }
.table > tbody > tr {
  transition: background-color .12s var(--mt-ease);
}
.table > tbody > tr:hover {
  background-color: rgba(30, 91, 255, 0.04);
}

/* ---- Provider selection cards (buy.php) ---- */
.provider-card {
  cursor: pointer;
  transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.provider-card:hover {
  border-color: var(--mt-primary);
}
.provider-card.active {
  border-color: var(--mt-primary);
  box-shadow: 0 0 0 3px rgba(30, 91, 255, 0.12);
}
.provider-card .check-icon.d-none { display: none !important; }

/* ---- Mobile sidebar ---- */
/* ---- Searchable select (country / service pickers) ---- */
.searchable-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--mt-muted);
  cursor: pointer;
}
.searchable-toggle:disabled {
  cursor: default;
  opacity: 0.5;
}
.searchable-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1055;
  max-height: 280px;
  overflow-y: auto;
  background: var(--mt-surface);
  border: 1px solid var(--mt-border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  padding: 6px;
}
.searchable-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--mt-text);
  font-size: 0.9rem;
  cursor: pointer;
}
.searchable-menu-item:hover,
.searchable-menu-item.active {
  background-color: rgba(30, 91, 255, 0.08);
  color: var(--mt-primary);
}
.searchable-menu-empty {
  padding: 8px 10px;
  color: var(--mt-muted);
  font-size: 0.85rem;
  text-align: center;
}
.searchable-menu .sm-fav {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.searchable-menu .sm-fav:hover i { color: #E0930B !important; }

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: -260px;
    top: 64px;
    bottom: 0; /* anchor to the real viewport bottom (robust on iOS Safari) */
    z-index: 1040;
    transition: left .25s ease;
    width: 250px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    /* Let the menu scroll when it's taller than the screen, and leave room
       at the bottom so the last item clears the mobile tab bar + iOS home bar. */
    min-height: 0;
    height: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }
  /* Prefer dynamic viewport units where supported (iOS 16+): exact visible height */
  @supports (height: 100dvh) {
    .app-sidebar { height: calc(100dvh - 64px); bottom: auto; }
  }
  .app-sidebar.show { left: 0; }
  /* Lock the page behind the open menu so swipes scroll the menu, not the page */
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .app-main { overflow: hidden; }
  .app-sidebar.show { overscroll-behavior: contain; }
  /* While the menu is open, hide the bottom tab bar so it can't cover the last
     menu item, and let the menu use the full height down to the home bar. */
  body.sidebar-open .mobile-tab-bar { display: none !important; }
  .app-sidebar.show { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(15,23,42,.4);
    z-index: 1039;
  }
  .sidebar-backdrop.show { display: block; }

  /* Reserve space at the bottom for the mobile tab bar */
  .app-main {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
  }
}

/* ---- Mobile bottom tab bar (app shell) ---- */
.mobile-tab-bar {
  display: none;
}
@media (max-width: 991.98px) {
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1045;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--mt-border);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
  }
  [data-bs-theme="dark"] .mobile-tab-bar {
    background-color: rgba(18, 26, 46, 0.92);
  }
  .mobile-tab-bar a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    padding: .3rem 0;
    border-radius: 12px;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--mt-muted);
    transition: color .15s var(--mt-ease), background-color .15s var(--mt-ease);
  }
  .mobile-tab-bar a i {
    font-size: 1.3rem;
    line-height: 1;
  }
  .mobile-tab-bar a.active,
  .mobile-tab-bar a:active {
    color: var(--mt-primary);
    background-color: rgba(30, 91, 255, 0.08);
  }
}

/* Responsive width helper (Bootstrap has no w-sm-auto by default) */
@media (min-width: 576px) {
  .w-sm-auto { width: auto !important; }
}

/* ---- Small-screen refinements ---- */
@media (max-width: 575.98px) {
  .auth-card {
    padding: 1.5rem;
    border-radius: 14px;
  }
  .auth-wrapper {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 3.5rem;
  }
  .auth-back-link {
    top: .75rem;
    left: .75rem;
    font-size: .8rem;
  }
  .hero-gradient h1 {
    font-size: 1.9rem;
  }
  .hero-gradient .lead {
    font-size: 1rem;
  }
  /* Full-width hero CTAs = bigger tap targets on phones */
  .hero-gradient .btn-lg {
    width: 100%;
  }
  /* Compact marketing navbar buttons on phones */
  .app-navbar .btn {
    padding-left: .75rem;
    padding-right: .75rem;
  }
  /* Tighter tables on phones */
  .table {
    font-size: .82rem;
  }
  .table th, .table td {
    padding: .5rem .5rem;
  }
  .otp-box {
    font-size: 1.4rem !important;
    letter-spacing: .1em;
    padding: .6rem .9rem;
  }
}
