/* ═══════════════════════════════════════════════════════════
   DonnieSMS · Deep Dark Purple Theme & Layout
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg:         #0f0420;
  --surface:    #1a0a2e;
  --surface-2:  #251242;
  --border:     #3d1e5f;
  --accent:     #a855f7;
  --accent-hi:  #c084fc;
  --text:       #f0e9ff;
  --muted:      #9d8fb5;
  --ok:         #4ade80;
  --bad:        #f87171;
  --warn:       #fbbf24;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 8px 30px rgba(0, 0, 0, 0.45);
}

/* ───── Resets & Global ───── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hi); }
p, h1, h2, h3, h4, span, td, th, div { word-break: break-word; overflow-wrap: break-word; }

/* ───── App Layout ───── */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: radial-gradient(circle at 100% 0%, #2a1048 0%, transparent 50%), var(--bg);
  position: relative;
}

/* ───── Sidebar (Mobile: Off-Canvas) ───── */
.sidebar {
  width: 280px;
  max-width: 85vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 15px rgba(0,0,0,0.5);
}
.sidebar.active { transform: translateX(0); }
.sidebar-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.sidebar-header .brand { font-weight: 800; font-size: 1.25rem; color: var(--text); white-space: nowrap; }
.close-sidebar { display: block; background: none; border: none; color: var(--muted); font-size: 1.5rem; cursor: pointer; padding: 0.5rem; }

.sidebar-links { padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; overflow-y: auto; }
.sidebar-links a { display: flex; align-items: center; gap: 12px; padding: 0.85rem 1rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; transition: all 0.2s; font-size: 0.95rem; }
.sidebar-links a i { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-links a:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.sidebar-links a.active { background: linear-gradient(90deg, rgba(168, 85, 247, 0.15) 0%, transparent 100%); color: var(--accent-hi); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sidebar-divider { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 1.5rem 0 0.5rem 1rem; font-weight: 700; }

/* ───── Mobile Top Bar ───── */
.mobile-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: rgba(15, 4, 32, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  width: 100%;
}
.mobile-topbar .brand {
  font-weight: 800;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--accent-hi), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.btn-icon { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 1.2rem; cursor: pointer; padding: 0.4rem 0.6rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-icon:active { background: rgba(168, 85, 247, 0.2); }

/* ───── Sidebar Overlay ───── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 90; backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.3s; }
.sidebar-overlay.active { display: block; opacity: 1; }

/* ───── Main Content ───── */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 0; width: 100%; }
.container { width: 100%; max-width: 940px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

/* ───── Mobile Bottom Navigation ───── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 10px 0;
  color: var(--muted);
  font-size: 0.7rem;
  gap: 4px;
  text-decoration: none;
  transition: all 0.2s;
}
.bottom-nav .nav-item i { font-size: 1.2rem; }
.bottom-nav .nav-item.active { color: var(--accent); }
.bottom-nav .nav-item:active { background: rgba(168, 85, 247, 0.1); }

/* ───── Typography & Headers ───── */
.hero { text-align: center; margin-bottom: 2rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(135deg, var(--accent-hi), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.2; }
.hero p { margin-top: .5rem; color: var(--muted); }
.balance-text { font-size: clamp(2rem, 8vw, 3rem); font-weight: 800; color: var(--accent); margin: 0.5rem 0; line-height: 1.1; white-space: nowrap; }

/* ───── Cards & Forms ───── */
.card { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); width: 100%; overflow: hidden; }
.card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; }

.form { display: grid; gap: 1rem; width: 100%; }
.form label { display: block; font-size: .85rem; margin-bottom: .4rem; color: var(--muted); font-weight: 500; }
.form input, .form select, .form textarea { width: 100%; padding: .75rem .9rem; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 1rem; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25); }

/* ───── Buttons ───── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1.25rem; background: rgba(0, 0, 0, 0.35); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-hi); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #7c3aed); border-color: transparent; color: #fff; }
.btn-primary:hover:not(:disabled) { color: #fff; box-shadow: 0 8px 24px rgba(168, 85, 247, 0.4); transform: translateY(-1px); }
.btn-danger { background: rgba(248, 113, 113, 0.1); border-color: var(--bad); color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem .8rem; font-size: .85rem; }

/* ───── Tables (Mobile First: Cards) ───── */
.table-wrap { width: 100%; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { display: none; }
tr { display: block; margin-bottom: 1rem; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem; }
td { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(61, 30, 95, 0.4); padding: 0.75rem 0.5rem; text-align: right; font-size: 0.9rem; width: 100%; }
td:last-child { border-bottom: 0; }
td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; padding-right: 1rem; text-align: left; flex-shrink: 0; }

/* ───── Alerts ───── */
.alert { padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1rem; font-size: .92rem; text-align: center; width: 100%; }
.alert-error { background: rgba(248, 113, 113, 0.1); border-color: var(--bad); color: #fecaca; }
.alert-success { background: rgba(74, 222, 128, 0.1); border-color: var(--ok); color: #bbf7d0; }
.alert-info { background: rgba(168, 85, 247, 0.1); border-color: var(--accent); color: var(--accent-hi); }

/* ───── Footer ───── */
.foot { text-align: center; margin-top: 2rem; padding: 1rem; font-size: .8rem; color: var(--muted); }

/* ───── Utilities ───── */
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .85rem; word-break: break-all; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.action-group { display: flex; flex-direction: column; gap: 0.5rem; justify-content: flex-end; width: 100%; }

/* ───── Rent Page: Search & List ───── */
.search-container { position: relative; padding: 1rem; background: var(--surface); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.search-icon { position: absolute; left: 1.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; }
.search-input { width: 100%; padding: 0.8rem 1rem 0.8rem 2.8rem; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25); }
.service-list { display: flex; flex-direction: column; max-height: 600px; overflow-y: auto; }
.service-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); transition: background 0.2s; background: transparent; }
.service-item:last-child { border-bottom: none; }
.service-item:hover { background: rgba(255, 255, 255, 0.02); }
.service-info { display: flex; align-items: center; gap: 0.5rem; }
.service-name { font-weight: 600; font-size: 1rem; color: var(--text); }
.service-country { font-size: 0.8rem; color: var(--muted); font-weight: 500; background: rgba(255, 255, 255, 0.05); padding: 2px 6px; border-radius: 4px; }
.service-action { display: flex; align-items: center; gap: 1rem; }
.service-price { font-weight: 700; color: var(--accent-hi); font-size: 0.95rem; }
.service-action .btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; border-radius: 6px; }
.no-results { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.no-results i { font-size: 2rem; margin-bottom: 1rem; color: var(--border); }
.no-results p { font-size: 0.95rem; }

/* ───── Premium Dashboard Styles ───── */
.balance-card {
  background: linear-gradient(135deg, #6b21a8 0%, #4c1d95 100%);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.balance-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none; /* FIX: Allows clicking the NGN button */
}

.discover-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.discover-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  cursor: pointer;
}
.discover-item .icon-box {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: transform 0.2s;
}
.discover-item:active .icon-box {
  transform: scale(0.92);
}
.discover-item span {
  font-size: 0.75rem;
  color: var(--text);
  font-weight: 500;
}

/* ───── PWA Install Prompt Styling ───── */
.pwa-prompt { position: fixed; bottom: -150px; left: 50%; transform: translateX(-50%); width: calc(100% - 2rem); max-width: 400px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 1.25rem; z-index: 9999; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8); transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.pwa-prompt.show { bottom: 90px; }
@media (min-width: 769px) { .pwa-prompt.show { bottom: 2rem; } }
.pwa-content { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.pwa-icon { width: 48px; height: 48px; border-radius: 10px; }
.pwa-text h3 { font-size: 1.05rem; margin-bottom: 0.2rem; color: var(--text); }
.pwa-text p { font-size: 0.85rem; color: var(--muted); line-height: 1.3; }
.pwa-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ───── Notification Badge ───── */
.notif-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--bad); color: #fff;
  font-size: 0.65rem; font-weight: bold;
  padding: 2px 5px; border-radius: 10px;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   MEDIA QUERIES
   ═══════════════════════════════════════════════════════════ */

/* 1. SMALL MOBILE (320px - 375px) */
@media (max-width: 375px) {
  .container { padding: 1rem 0.75rem 2rem; }
  .hero h1 { font-size: 1.6rem; }
  .card { padding: 1rem; }
  .btn { padding: .6rem 1rem; font-size: 0.85rem; }
  .mobile-topbar { padding: 0.75rem; }
  td { flex-direction: column; align-items: flex-start; text-align: left; gap: 0.25rem; }
  td::before { padding-right: 0; }
  .action-group { flex-direction: column; }
  .action-group .btn { width: 100%; }
  .service-item { padding: 0.85rem 1rem; }
  .service-price { font-size: 0.85rem; }
  .service-country { font-size: 0.7rem; padding: 1px 4px; }
  .service-action { gap: 0.5rem; }
  .discover-grid { grid-template-columns: repeat(3, 1fr); }
  .discover-item .icon-box { width: 50px; height: 50px; font-size: 1.2rem; }
}

/* 2. NORMAL MOBILE (376px - 480px) */
@media (min-width: 376px) and (max-width: 480px) {
  .container { padding: 1.25rem 1rem 2.5rem; }
  .action-group { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
}

/* 3. LARGE MOBILE (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {
  .container { padding: 1.5rem 1.25rem 3rem; }
  .hero h1 { font-size: 2rem; }
  td { text-align: right; flex-direction: row; align-items: center; }
  td::before { padding-right: 1rem; }
}

/* 4. TABLETS (601px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {
  .container { padding: 2rem 2rem 4rem; }
  .card { padding: 1.5rem; }
  .hero h1 { font-size: 2.2rem; }
  tr { padding: 1rem; }
}

/* 5. SMALL LAPTOPS & DESKTOPS (769px +) */
@media (min-width: 769px) {
  .app-layout { flex-direction: row; }
  .sidebar { transform: translateX(0); width: 260px; box-shadow: none; }
  .close-sidebar { display: none; }
  .mobile-topbar { display: none; }
  .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 260px; }
  .container { padding: 3rem 2rem 4rem; }
  .bottom-nav { display: none !important; }
  
  /* Restore Desktop Tables */
  thead { display: table-header-group; }
  tbody { display: table-row-group; }
  table { display: table; text-align: left; }
  tr { display: table-row; background: transparent; border: none; border-radius: 0; margin-bottom: 0; padding: 0; }
  th, td { display: table-cell; padding: 1rem; border-bottom: 1px solid var(--border); width: auto; text-align: left; }
  td::before { display: none !important; }
  th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
  tr:hover td { background: rgba(255, 255, 255, 0.02); }
  .action-group { flex-direction: row; }
}

/* 6. LAPTOPS (1025px - 1440px) */
@media (min-width: 1025px) {
  .container { max-width: 1100px; padding: 3.5rem 2rem 5rem; }
  .sidebar { width: 280px; }
  .main-content { margin-left: 280px; }
}

/* 7. LARGE DESKTOPS (1441px +) */
@media (min-width: 1441px) {
  .container { max-width: 1280px; }
  body { font-size: 1.05rem; }
}

/* MOBILE ONLY: Show Bottom Nav */
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .main-content { padding-bottom: 80px; }
  .foot { margin-bottom: 60px; }
}






/* ───── Custom Bottom-Sheet Popup ───── */
.custom-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
}

.custom-popup.active {
  opacity: 1;
  pointer-events: auto;
}

.popup-content {
  background: var(--surface);
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 2rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  border-top: 2px solid var(--accent);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.custom-popup.active .popup-content {
  transform: translateY(0);
}


/* ───── Global Slide-Up Modal ───── */
.global-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 999999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.global-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.global-modal-content {
  background: var(--surface);
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 2rem 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  text-align: center;
}

.global-modal.active .global-modal-content {
  transform: translateY(0);
}