/* ==========================================================================
   HadiSub — Mobile First & Responsive Design Stylesheet
   Precision Viewport Containment, Zero Screen Shift & Mobile Touch Perfection
   ========================================================================== */

/* ==========================================================================
   Universal Viewport Containment (Prevents Any Lateral / Horizontal Screen Shift)
   ========================================================================== */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Base media fluid constraints */
img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Prevent text overflows that trigger horizontal layout expansion */
p, h1, h2, h3, h4, h5, h6, span, a, td, th {
  overflow-wrap: break-word;
}

/* ==========================================================================
   Mobile Bottom Navigation Bar
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--nf-border);
  z-index: 1050;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-item {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--nf-slate);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 2px;
  border-radius: var(--nf-radius-sm);
  transition: var(--nf-transition);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-nav-link i {
  font-size: 20px;
  color: var(--nf-muted);
  transition: var(--nf-transition);
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  color: var(--nf-primary);
}

.mobile-nav-link.active i {
  color: var(--nf-primary);
}

/* Mobile Floating Action Button / Center highlight */
.mobile-nav-link.highlight-buy {
  color: var(--nf-primary-dark);
}

.mobile-nav-link.highlight-buy .buy-icon-wrap {
  width: 38px;
  height: 38px;
  background: var(--nf-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--nf-shadow-emerald);
  margin-top: -12px;
}

.mobile-nav-link.highlight-buy .buy-icon-wrap i {
  color: #fff;
  font-size: 18px;
}

/* Mobile Transaction Cards */
.mobile-txn-card {
  display: none;
  background: #ffffff;
  border: 1px solid var(--nf-border);
  border-radius: var(--nf-radius-md);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--nf-shadow-xs);
  transition: var(--nf-transition);
}

.mobile-txn-card:active {
  background: var(--nf-bg);
}

/* ==========================================================================
   Breakpoints: Large Tablets & Laptops (<= 991.98px)
   ========================================================================== */
@media (max-width: 991.98px) {
  .hero-headline {
    font-size: 2.5rem;
  }

  .dashboard-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .nf-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
    width: min(280px, 85vw);
    max-width: 85vw;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 1070;
    box-shadow: var(--nf-shadow-xl);
    transition: left 0.3s ease-in-out;
  }

  .nf-sidebar.show-sidebar {
    left: 0;
    display: flex !important;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1065;
    backdrop-filter: blur(4px);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .dashboard-main {
    padding: 20px 16px 80px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .mobile-bottom-nav {
    display: block;
  }
}

/* ==========================================================================
   Breakpoints: Tablets & Phones (<= 767.98px)
   ========================================================================== */
@media (max-width: 767.98px) {
  /* Apply bottom spacing for pages with mobile bottom navigation */
  body.has-bottom-nav,
  body:has(.mobile-bottom-nav) {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Prevent iOS Safari automatic viewport zoom and lateral shift on input focus */
  .nf-input,
  .form-control,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Prevent modal backdrop from injecting 17px right padding and shifting screen */
  body.modal-open {
    padding-right: 0 !important;
    overflow: hidden;
  }

  .modal-dialog {
    margin: 12px auto;
    max-width: calc(100vw - 24px);
  }

  .hero-headline {
    font-size: 2.1rem;
  }

  .hero-section {
    padding: 36px 0 26px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 20px;
  }

  .nf-card {
    padding: 18px 14px;
  }

  .nf-card-dark {
    padding: 20px 16px;
  }

  /* Touch inertia for responsive tables */
  .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nf-table {
    min-width: 520px;
  }

  /* Switch desktop table to card list where designated */
  .table-responsive-desktop-only {
    display: none !important;
  }

  .mobile-txn-card {
    display: block;
  }

  /* Network Selector Cards */
  .network-select-card {
    padding: 10px 6px;
  }

  .network-select-card .net-icon {
    width: 36px;
    height: 36px;
    font-size: 11px;
    margin-bottom: 6px;
  }

  .network-select-card .net-name {
    font-size: 11px;
  }

  }

/* ==========================================================================
   Breakpoints: Phones & Small Devices (<= 575.98px)
   ========================================================================== */
@media (max-width: 575.98px) {
  /* Container side padding adjustment to prevent edge clipping */
  .container, .container-fluid {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Hero Section */
  .hero-headline {
    font-size: 1.85rem;
    letter-spacing: -0.03em;
  }

  .hero-subtext {
    font-size: 0.95rem;
    margin-bottom: 22px;
  }

  .hero-pill-tag {
    font-size: 11.5px;
    padding: 5px 12px;
    margin-bottom: 16px;
  }

  .data-hero-card {
    padding: 16px 12px !important;
    border-radius: 16px;
  }

  /* Quick bundle chips */
  .bundle-chip-select {
    padding: 9px 6px !important;
  }

  .bundle-chip-select .fs-6 {
    font-size: 0.88rem !important;
  }

  /* Data Plan Cards */
  .data-plan-card {
    padding: 14px 12px;
  }

  .data-plan-card .plan-size {
    font-size: 19px;
  }

  .data-plan-card .plan-price {
    font-size: 16px;
    margin-top: 6px;
  }

  .data-plan-card .plan-badge {
    font-size: 9px;
    padding: 2px 6px;
    top: 10px;
    right: 10px;
  }

  /* Top Corporate Bar */
  .top-corporate-bar {
    font-size: 0.72rem;
    padding: 4px 0;
  }

  .top-corporate-bar .entity-name {
    font-size: 0.75rem;
  }

  /* Brand Logo & Name (Prevent Wrapping with Toggler) */
  .brand-name {
    font-size: 0.92rem;
  }

  .brand-tagline {
    font-size: 0.60rem;
  }

  .brand-logo-img {
    height: 36px !important;
    max-width: 130px !important;
  }

  .navbar-brand {
    gap: 8px;
    max-width: calc(100% - 52px);
    overflow: hidden;
  }

  .nf-navbar {
    padding: 8px 0;
  }

  /* Buttons on mobile */
  .btn-naira-primary, .btn-naira-secondary, .btn-naira-outline {
    font-size: 13px;
    padding: 10px 16px;
  }

  .btn-sm.btn-naira-primary,
  .btn-sm.btn-naira-secondary,
  .btn-sm.btn-naira-outline {
    font-size: 11.5px !important;
    padding: 5px 10px !important;
  }

  .btn-lg.btn-naira-primary,
  .btn-lg.btn-naira-secondary,
  .btn-lg.btn-naira-outline {
    font-size: 14.5px !important;
    padding: 11px 20px !important;
  }

  /* Toast Notification Container on Mobile (Pinned Center-Bottom Above Nav) */
  .nf-toast-container {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    align-items: stretch !important;
    gap: 8px;
    z-index: 1090;
  }

  .nf-toast {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px !important;
    box-shadow: var(--nf-shadow-lg) !important;
  }

  .nf-toast-title {
    font-size: 13px;
  }

  .nf-toast-msg {
    font-size: 12px;
  }

  /* Receipt Modal */
  .receipt-card {
    padding: 18px 14px;
    border-radius: 16px;
  }

  .receipt-icon-circle {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 10px;
  }

  .summary-row {
    font-size: 13px;
    padding: 8px 0;
  }

  /* Quick amount chips */
  .quick-amount-chip {
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* ==========================================================================
   Breakpoints: Extra-Small Phones (<= 400px e.g., 360px, 320px)
   ========================================================================== */
@media (max-width: 400px) {
  .hero-headline {
    font-size: 1.65rem;
  }

  .brand-name {
    font-size: 0.85rem;
  }

  .brand-tagline {
    font-size: 0.56rem;
  }

  .brand-logo-img {
    height: 32px !important;
    max-width: 100px !important;
  }

  .navbar-brand {
    gap: 6px;
  }

  .network-select-card {
    padding: 8px 4px;
    border-radius: 10px;
  }

  .network-select-card .net-icon {
    width: 30px;
    height: 30px;
    font-size: 10px;
    margin-bottom: 4px;
  }

  .network-select-card .net-name {
    font-size: 10px;
  }

  .network-badge-status {
    display: none !important;
  }

  .bundle-chip-select {
    padding: 7px 4px !important;
  }

  .bundle-chip-select .fs-6 {
    font-size: 0.82rem !important;
  }

  .role-pill-btn {
    padding: 2px 6px;
    font-size: 10px;
  }

  .badge-env {
    font-size: 9px;
    padding: 2px 5px;
  }
}

/* ==========================================================================
   UI POLISH V2 — Cleaner Feel, Native-App Touch Behaviour, Bottom-Sheet Receipt
   ========================================================================== */

/* --- Global touch & focus feel ------------------------------------------- */
* {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--nf-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  -webkit-overflow-scrolling: touch;
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Cleaner, slimmer scrollbars on desktop */
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

/* --- Sticky glass navbar (all viewphones/tablets) -------------------------- */
.nf-navbar {
  position: sticky;
  top: 0;
  z-index: 1040;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--nf-border-subtle);
}

/* --- Bottom nav: native-app feel ------------------------------------------ */
.mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
}

.mobile-nav-link {
  border-radius: var(--nf-radius-md);
  transition: var(--nf-transition-bounce);
}

.mobile-nav-link.active {
  background: var(--nf-primary-subtle);
  box-shadow: inset 0 0 0 1px var(--nf-primary-border);
}

/* Receipt state colors remain accurate for success, pending, failed and refunds. */
.receipt-icon-circle.pending {
  background: var(--nf-warning-subtle);
  color: #b45309;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.14);
}

.receipt-icon-circle.failed {
  background: var(--nf-danger-subtle);
  color: var(--nf-danger);
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12);
}

.receipt-icon-circle.refunded {
  background: var(--nf-info-subtle);
  color: #0284c7;
  box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.12);
}

/* Compact header controls still keep comfortable finger-sized hit areas. */
@media (max-width: 991.98px) {
  .navbar-toggler {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-naira-outline.d-lg-none {
    min-width: 44px;
  }
}

/* --- Bottom-Sheet Receipt Modal (phones) ---------------------------------- */
@media (max-width: 575.98px) {
  #nf-receipt-modal .modal-dialog {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    max-width: 100vw;
    width: 100vw;
    transform: translateY(0) !important;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  #nf-receipt-modal .modal-content {
    border-radius: 22px 22px 0 0 !important;
    padding-bottom: 8px;
  }

  #nf-receipt-modal .receipt-card {
    border-radius: 22px 22px 0 0 !important;
    padding: 20px 18px 24px !important;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.22) !important;
  }

  /* Drag handle for the bottom sheet look */
  #nf-receipt-modal .receipt-card::before {
    content: '';
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 9999px;
    background: #cbd5e1;
    margin: 0 auto 14px;
  }

  /* Pop-up animation feels like a native bottom sheet */
  #nf-receipt-modal.fade .modal-dialog {
    transform: translateY(100%) !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #nf-receipt-modal.fade.show .modal-dialog {
    transform: translateY(0) !important;
  }
}

/* --- Touch targets & input comfort (phones) -------------------------------- */
@media (max-width: 767.98px) {
  .btn-naira-primary,
  .btn-naira-secondary,
  .btn-naira-outline {
    min-height: 44px;
  }

  .form-control,
  .form-select {
    padding-top: 11px;
    padding-bottom: 11px;
    border-radius: var(--nf-radius-md);
  }

  .network-select-card,
  .bundle-chip-select,
  .data-plan-card,
  .quick-amount-chip {
    cursor: pointer;
    transition: var(--nf-transition-bounce);
  }

  .network-select-card:active,
  .bundle-chip-select:active,
  .data-plan-card:active,
  .quick-amount-chip:active {
    transform: scale(0.97);
  }

  button.nav-link {
    min-height: 44px;
  }

  .js-pricing-cat-btn,
  .js-pricing-net-btn,
  .code-copy-btn {
    min-height: 40px;
  }

  .code-copy-btn {
    min-width: 56px;
  }

  /* Page titles breathe less on phones for a cleaner vertical rhythm */
  .container.py-4,
  .container.px-4 {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
  }
}

/* --- Cleaner mobile header actions ------------------------------------------ */
@media (max-width: 575.98px) {
  /* Long hero pills should wrap instead of being clipped on 320px phones. */
  section .badge.rounded-pill.fs-6 {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    text-align: left;
  }

  .nf-navbar .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Balance pill stays visible but tighter */
  .nf-navbar .btn-naira-outline {
    font-size: 12px;
    padding: 7px 12px !important;
    min-height: 40px;
  }
}

/* --- Tablet width refinement (800–1100px feels less empty) ----------------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .container {
    max-width: 960px;
  }

  .hero-section {
    padding: 56px 0 40px;
  }
}

/* ==========================================================================
   Print Styling for Receipts
   ========================================================================== */
@media print {
  body * {
    visibility: hidden;
  }
  .receipt-card, .receipt-card * {
    visibility: visible;
  }
  .receipt-card {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
    box-shadow: none;
  }
  .no-print {
    display: none !important;
  }
}
