/* ============================================================
   mobile.css — Mobile responsive patches
   Add <link> to this AFTER app.css in header.php
   ============================================================ */

/* ── Force horizontal scroll on ALL tables ─────────────── */
.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  display: block;
}

/* ===== DESKTOP (default) ===== */
.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.table-responsive > table {
  width: 100%;
  max-width: 100%;
}

/* ===== MOBILE ONLY ===== */
@media (max-width: 767.98px) {
  .table-responsive {
    display: block;
  }

  .table-responsive > table {
    min-width: 600px;
    width: max-content;
  }
}

/* Tables with more columns need more room */
.table-responsive.table-wide > table,
.table-wide .table-responsive > table {
  min-width: 900px;
}

/* Show a subtle scroll indicator on mobile */
@media (max-width: 767.98px) {
  .table-responsive::after {
    content: '← scroll →';
    display: block;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 4px 0;
    border-top: 1px solid var(--border-color);
    letter-spacing: 0.05em;
  }
  .table-responsive:not(:has(+ *))::after,
  .table-responsive:only-child::after {
    display: none;
  }
}

/* ── API Docs Parameters Table ─────────────────────────── */
.api-params-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.api-params-table table {
  min-width: 500px;
}

/* ── Card & Layout Mobile fixes ────────────────────────── */
@media (max-width: 575.98px) {
  /* Tighter container padding */
  .container-xxl { padding: 0.75rem !important; }
  
  /* Stat cards — smaller text on very small screens */
  .stat-value { font-size: 1rem !important; }
  .stat-card { padding: 0.9rem 1rem; gap: 0.65rem; }
  .stat-icon { width: 40px !important; height: 40px !important; font-size: 1.1rem !important; }
  
  /* Service cards 2-col on small phones */
  .service-card .service-name { font-size: 0.72rem; }
  
  /* Slip card photo smaller on mobile */
  .slip-photo { width: 65px !important; height: 80px !important; }
  
  /* BVN card */
  .bvn-card-display { width: 100% !important; max-width: 340px; }
  .bvn-card-number { font-size: 1.1rem !important; letter-spacing: 0.05em !important; }

  /* Page headers wrap better */
  .d-flex.justify-content-between { flex-wrap: wrap; gap: 0.5rem; }

  /* Filter forms stack */
  .card-header form .row { --bs-gutter-x: 0.5rem; }
  
  /* Topbar wallet hidden on very small screens */
  .topbar-wallet { display: none !important; }
  
  /* Action buttons in tables — icon only */
  .btn-icon { width: 28px; height: 28px; }
  
  /* Breadcrumb smaller */
  .breadcrumb { font-size: 0.75rem; }

  /* Modal dialogs full-width on small screens */
  .modal-dialog { margin: 0.5rem; max-width: calc(100% - 1rem); }
  .modal-content { border-radius: var(--radius-lg); }

  /* Status chips compact */
  .status-chip { font-size: 0.65rem; padding: 0.2rem 0.5rem; }

  /* Auth card tighter */
  .auth-card { padding: 1.5rem 1rem; }

  /* Slip body fields stack on small screens */
  .slip-field { flex-direction: column; gap: 0.1rem; }
  .slip-field-label { min-width: unset; }

  /* Tab labels shorter */
  .nav-tabs .nav-link { padding: 0.4rem 0.6rem; font-size: 0.78rem; }
}

@media (max-width: 767.98px) {
  /* Table cells — allow wrapping for long content */
  .table td, .table th {
    white-space: nowrap;
    font-size: 0.8rem;
  }

  /* Pagination wraps nicely */
  .pagination { flex-wrap: wrap; }

  /* Card headers — allow filter forms to wrap */
  .card-header { flex-wrap: wrap; gap: 0.5rem; }
  .card-header form { width: 100%; }

  /* Full-width export/filter buttons */
  .card-header .btn { font-size: 0.78rem; }

  /* History tables — hide non-critical columns via priority classes */
  .col-hide-mobile { display: none !important; }
  
  /* Slip type group wraps */
  .slip-type-group { gap: 0.35rem; }
  .slip-type-label { padding: 0.35rem 0.65rem; font-size: 0.75rem; }
  
  /* Virtual account card */
  .virtual-account-card .va-number { font-size: 1.3rem; letter-spacing: 0.05em; }
  
  /* Balance display smaller */
  .balance-display { font-size: 1.8rem; }
}

/* ── Sidebar on mobile ─────────────────────────────────── */
@media (max-width: 991.98px) {
  .content-wrapper { margin-left: 0 !important; }

  /* Topbar stacks better */
  .layout-navbar { padding: 0 0.75rem; }
  .navbar-nav-right { gap: 0.25rem; }
}

/* ── API Docs mobile ───────────────────────────────────── */
@media (max-width: 767.98px) {
  .api-endpoint-url {
    font-size: 0.72rem;
    word-break: break-all;
  }
  .code-block {
    font-size: 0.72rem;
    padding: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .api-method-badge {
    font-size: 0.65rem;
  }
  /* API docs sidebar hidden on mobile */
  #apiDocsSidebar { display: none; }
}

/* ── Transaction / History tables — mobile optimization ── */
@media (max-width: 767.98px) {
  /* Transaction history — hide Balance Before/After columns */
  .txn-table .col-balance-before,
  .txn-table .col-balance-after { display: none; }

  /* Verification history — hide provider column */
  .verif-table .col-provider { display: none; }
  
  /* Validation history — hide slip type on small */
  .val-table .col-slip { display: none; }
}

/* ── WhatsApp Floating Button ───────────────────────────── */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: wa-pulse 2.5s infinite;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.6);
  background: #20ba5a;
}

.whatsapp-float svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.whatsapp-float .wa-tooltip {
  position: absolute;
  right: 60px;
  background: #25d366;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.whatsapp-float:hover .wa-tooltip { opacity: 1; }

@keyframes wa-pulse {
  0%   { box-shadow: 0 4px 16px rgba(37,211,102,0.45); }
  50%  { box-shadow: 0 4px 24px rgba(37,211,102,0.7), 0 0 0 8px rgba(37,211,102,0.1); }
  100% { box-shadow: 0 4px 16px rgba(37,211,102,0.45); }
}

/* ── Notice Banner (admin → agent broadcast) ───────────── */
.notice-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #4547d4 100%);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  color: #fff;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.notice-banner::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.notice-banner-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.notice-banner-close {
  position: absolute;
  top: 0.5rem; right: 0.75rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.notice-banner-close:hover { color: #fff; }

/* ── Scroll improvement for all overflowing containers ─── */
* { -webkit-overflow-scrolling: touch; }

/* ── Print: hide WhatsApp button ───────────────────────── */
@media print {
  .whatsapp-float { display: none !important; }
  .notice-banner  { display: none !important; }
}

/* ── Notification Dropdown Mobile Fix ───────────────────── */
@media (max-width: 767.98px) {
  .notification-dropdown {
    max-width: calc(100vw - 20px);
    min-width: 250px;
  }
}
