/* ============================================================
   oz-responsive.css — OZ Sports Mobile Responsive Supplement
   Loaded on all three areas: admin, user portal, website
   ============================================================ */

/* ── Global Touch & iOS Fixes ─────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

/* Prevent iOS auto-zoom on focused inputs (needs ≥16px font) */
@media (max-width: 767px) {
  input:not([type=range]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* iOS rubber-band scroll fix for full-height layouts */
html, body { -webkit-overflow-scrolling: touch; }

/* Safe area insets for notched iPhones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  /* Admin page content */
  .page-content {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  /* User portal bottom nav */
  .oz-bottom-nav {
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }
}

/* ── Admin Panel ─────────────────────────────────────────────── */

/* Hamburger swipe hint animation on first load */
@keyframes oz-hint-slide {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(6px); }
  60%  { transform: translateX(0); }
  100% { transform: translateX(0); }
}
.btn-hamburger { animation: oz-hint-slide 1.2s ease 1.5s 1; }

/* Stat cards — never go below 140px */
@media (max-width: 1023px) {
  .stat-card .value { font-size: 22px; }
  .stat-card .label { font-size: 10.5px; }
}

/* Card headers that contain long titles + buttons */
@media (max-width: 767px) {
  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .card-header .btn { width: 100%; justify-content: center; }

  /* Topbar: hide admin name label, keep avatar */
  .topbar-admin span { display: none; }
  .topbar-admin { padding: 4px 8px 4px 4px !important; gap: 4px !important; }

  /* Form grids inside modals collapse to single column */
  .modal-panel [style*="grid-template-columns:1fr 1fr"],
  .modal-panel [style*="grid-template-columns: 1fr 1fr"],
  .modal-panel [style*="grid-template-columns:1fr 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* Print-safe table min-width so columns don't collapse to nothing */
.table-wrap table { min-width: 520px; }

/* Better touch targets for table action buttons */
@media (max-width: 1023px) {
  .btn-sm  { min-height: 36px; padding: 6px 12px !important; }
  .btn-xs  { min-height: 32px; }
}

/* Pagination on small screens */
@media (max-width: 639px) {
  nav[role="navigation"] ul,
  nav[role="navigation"] .flex { flex-wrap: wrap; gap: 4px; }
  nav[role="navigation"] span[aria-current="page"] { font-size: 13px; }
}

/* Tab bar scrollable on very small screens */
@media (max-width: 479px) {
  .tab-bar {
    width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .tab-btn { scroll-snap-align: start; white-space: nowrap; flex-shrink: 0; }
}

/* Dashboard 2-col card grid */
.dashboard-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 1023px) {
  .dashboard-cols { grid-template-columns: 1fr; }
}

/* ── User Portal ─────────────────────────────────────────────── */

/* Inner-page tables (user portal uses Tailwind, these supplement) */
@media (max-width: 1023px) {
  .oz-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .oz-table table { min-width: 480px; width: 100%; border-collapse: collapse; }
}

/* Cards with inline grid styles (book-court zone cards) */
@media (max-width: 639px) {
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Wallet / stats summary blocks */
@media (max-width: 767px) {
  [class*="lg:grid-cols-3"][class*="grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Website ─────────────────────────────────────────────────── */

/* Smooth page transitions (website uses fixed nav so content needs top padding) */
@media (max-width: 1023px) {
  /* Ensure hero sections clear the fixed nav */
  section:first-of-type:not(nav) { scroll-margin-top: 64px; }
}

/* Images in website sections should never overflow */
img { max-width: 100%; height: auto; }

/* Website contact form on mobile */
@media (max-width: 767px) {
  [class*="lg:grid-cols-5"],
  [class*="lg:grid-cols-4"],
  [class*="lg:grid-cols-3"] {
    grid-template-columns: 1fr !important;
  }
}

/* Footer grid on tiny screens */
@media (max-width: 479px) {
  [class*="md:grid-cols-2"][class*="lg:grid-cols-4"],
  [class*="md:grid-cols-2"][class*="lg:grid-cols-3"] {
    grid-template-columns: 1fr !important;
  }
}

/* Hero section text — prevent overflow on 320px screens */
@media (max-width: 374px) {
  h1 { font-size: clamp(1.5rem, 8vw, 2.5rem) !important; }
  h2 { font-size: clamp(1.25rem, 6vw, 2rem) !important; }
}

/* Stats bar on website (row of numbers) */
@media (max-width: 639px) {
  [class*="flex"][class*="gap-8"] > div,
  [class*="flex"][class*="gap-6"] > div {
    min-width: 0;
  }
}

/* Button stacks on xs screens — make CTA buttons full-width */
@media (max-width: 479px) {
  .oz-cta-buttons {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .oz-cta-buttons a,
  .oz-cta-buttons button {
    text-align: center !important;
    width: 100% !important;
  }
}

/* ── Utilities ───────────────────────────────────────────────── */

/* Visually hidden but accessible */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* Prevent horizontal scroll on the whole page */
body { overflow-x: hidden; }

/* Focus rings for keyboard nav */
:focus-visible {
  outline: 2px solid #0F3460;
  outline-offset: 2px;
}
