/* Mobile-first enhancements — JPCenter.lk */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html {
  -webkit-tap-highlight-color: transparent;
}

button,
.btn,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

input,
select,
textarea {
  font-size: 16px;
}

/* Nav */
.nav {
  min-height: 56px;
  height: auto;
  padding-top: calc(10px + var(--safe-top));
  padding-bottom: 10px;
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  gap: 12px;
}

.nav__logo {
  font-size: 16px;
  min-width: 0;
}

.nav__logo > div:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__burger {
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Mobile drawer */
.mobile-drawer {
  width: min(100%, 320px);
  padding:
    calc(16px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(24px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.mobile-drawer__title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.mobile-drawer__close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 22px;
  line-height: 1;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-drawer__nav {
  display: flex;
  flex-direction: column;
}

.mobile-drawer__nav a,
.mobile-drawer__nav button {
  min-height: 48px;
  display: flex;
  align-items: center;
}

.mobile-drawer__credits {
  display: inline-block;
  margin: 12px 0;
  align-self: flex-start;
}

.mobile-drawer .btn {
  margin-top: 12px;
  min-height: 48px;
}

.drawer-backdrop.open {
  display: block;
  touch-action: none;
}

body.drawer-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

@media (max-width: 900px) {
  .nav__links,
  .nav__actions {
    display: none !important;
  }

  .nav__burger {
    display: flex;
  }

  .container {
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }

  .hero {
    padding:
      calc(32px + var(--safe-top))
      calc(16px + var(--safe-right))
      32px
      calc(16px + var(--safe-left));
  }

  .hero__packages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero__trust {
    gap: 10px 14px;
  }

  .hero__trust-item {
    font-size: 11px;
  }

  .section {
    padding: 48px 0;
  }

  .features-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .cta-dark {
    padding: 40px 20px;
  }

  .modal-overlay {
    padding: 12px;
    padding-bottom: calc(12px + var(--safe-bottom));
    align-items: flex-end;
  }

  .modal {
    max-width: 100%;
    max-height: min(92vh, 720px);
    overflow-y: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .pkg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -4px;
    margin-right: -4px;
    padding-bottom: 4px;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .admin-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 44px;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provider-balance-card {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 18px 16px;
  }

  .provider-balance-card__meta {
    min-width: 0;
  }

  .access-code-card {
    max-width: none;
    padding: 16px;
  }

  .access-code-card__input {
    min-width: 0;
    width: 100%;
    font-size: 16px;
  }

  .access-code-card__row {
    flex-direction: column;
    align-items: stretch;
  }

  .access-code-card__row .btn {
    width: 100%;
    min-height: 44px;
  }

  .admin-pkg-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-pkg-row input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .admin-pkg-row .btn {
    flex: 1;
    min-height: 44px;
  }

  .admin-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-row input {
    width: 100%;
  }

  .table-wrap {
    margin-left: calc(-1 * (16px + var(--safe-left)));
    margin-right: calc(-1 * (16px + var(--safe-right)));
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }

  .admin-table {
    min-width: 640px;
    font-size: 13px;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px;
  }

  .report-link-cell {
    white-space: normal;
  }

  .customer-detail__head {
    flex-direction: column;
    gap: 16px;
  }

  .report-link-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .report-link-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .report-link-row__actions .btn {
    flex: 1;
    min-width: 120px;
  }

  .customer-dashboard {
    grid-template-columns: 1fr;
  }

  .customer-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .customer-search {
    width: 100%;
    flex-basis: auto;
  }

  .customer-list-wrap {
    max-height: 280px;
  }

  .settings-form input[type="text"],
  .settings-form input[type="number"] {
    max-width: none;
    width: 100%;
  }

  .settings-form .btn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.85rem;
  }

  .hero__sub {
    font-size: 14px;
    margin-bottom: 18px;
  }

  .hero__packages {
    grid-template-columns: 1fr;
  }

  .hero-pkg-box {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 14px 16px;
  }

  .hero-pkg-box__top {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }

  .hero-pkg-box__price {
    margin: 0;
    flex: 1;
    text-align: center;
  }

  .hero-pkg-box .btn {
    width: auto;
    min-width: 120px;
    white-space: nowrap;
  }

  .features-grid,
  .risk-grid,
  .stats,
  .footer__grid,
  .result-grid,
  .sample-rec__specs {
    grid-template-columns: 1fr 1fr;
  }

  .hero--found .sample-rec__specs {
    grid-template-columns: 1fr 1fr;
  }

  .verify-panel__body {
    padding: 16px;
  }

  .verify-form input {
    font-size: 16px;
    padding: 14px 16px;
  }

  .verify-form__paste {
    padding: 0 14px;
    font-size: 13px;
    min-width: 72px;
  }

  .btn--search {
    white-space: normal;
    min-height: 52px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.35;
  }

  .btn--search span {
    text-align: center;
  }

  .btn--lg {
    min-height: 48px;
    padding: 14px 18px;
  }

  .btn--sm {
    min-height: 40px;
  }

  .pricing-card {
    margin-top: 28px;
    padding: 24px 20px;
  }

  .pricing-card__price span {
    font-size: 2.25rem;
  }

  .pkg-grid {
    grid-template-columns: 1fr;
  }

  .report-item,
  .tx-item {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .report-item__actions {
    width: auto;
    flex-shrink: 0;
  }

  .report-item__actions .btn {
    flex: 0 0 auto;
    padding: 8px 10px;
    font-size: 12px;
  }

  .report-url-box {
    display: none;
  }

  .dash-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 24px;
  }

  .balance-card--compact {
    width: 100%;
    max-width: 220px;
    align-self: flex-end;
  }

  .balance-card__num {
    font-size: 2.5rem;
  }

  .dash-verify-form input {
    font-size: 17px;
    padding: 16px;
  }

  .dash-topup-alert {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-topup-alert .btn {
    width: 100%;
  }

  .auth-page__main {
    align-items: flex-start;
    padding:
      calc(24px + var(--safe-top))
      calc(16px + var(--safe-right))
      calc(24px + var(--safe-bottom))
      calc(16px + var(--safe-left));
  }

  .auth-card {
    padding: 24px 18px;
    border-radius: var(--radius-lg);
  }

  .auth-tabs {
    flex-direction: column;
  }

  .auth-tab {
    min-height: 44px;
  }

  .report-wrap {
    padding:
      20px calc(16px + var(--safe-right))
      calc(48px + var(--safe-bottom))
      calc(16px + var(--safe-left));
  }

  .report-hero {
    padding: 20px 16px;
  }

  .report-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .report-actions {
    flex-direction: column;
  }

  .report-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat-box__n {
    font-size: 1.25rem;
  }

  .footer__bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .nav__actions--report {
    display: none !important;
  }
}

@media (max-width: 380px) {
  .hero-pkg-box {
    flex-direction: column;
    text-align: center;
  }

  .hero-pkg-box .btn {
    width: 100%;
  }
}
