/**
 * Responsywność całej strony WWW Strzelnica CEL
 * Telefon: ≤767px | Tablet: 768–1023px | Komputer: ≥1024px
 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* iOS Safari — bez zoomu przy focusie w polach formularza */
@media (max-width: 1023px) {
  input,
  select,
  textarea,
  button {
    font-size: max(16px, 1em);
  }
}

/* Tylko strona WWW — nie ograniczaj html/body panelu admin */
html:has(.shooting-range-app),
body:has(.shooting-range-app),
html:has(body.booking-page),
body.booking-page {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

img,
video,
svg,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

/* Bezpieczne marginesy na tablet/telefon */
@media (max-width: 1023px) {
  main .narrow-container,
  header .narrow-container,
  footer .narrow-container {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}

/* === NAGŁÓWEK: tablet + telefon — menu hamburger zamiast pełnej nawigacji === */
@media (max-width: 1023px) {
  header .sc-www-nav-center,
  header .sc-www-header-actions,
  header nav.hidden.md\:flex,
  header .hidden.md\:flex.items-center.gap-4:not(.sc-www-profile-slot) {
    display: none !important;
  }

  header button.md\:hidden,
  header button[class*='md:hidden'] {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    position: relative;
    z-index: 61;
  }

  header .sc-www-header-bar,
  header .narrow-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: nowrap;
  }

  header .sc-www-profile-slot {
    display: flex !important;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
    order: 10;
  }

  header .sc-www-profile-slot .sc-www-profile-btn,
  header .sc-www-profile-slot .sc-www-profile-link,
  header .sc-www-profile-slot button,
  header .sc-www-profile-slot a {
    display: inline-flex !important;
    visibility: visible !important;
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
  }

  header button.sc-www-profile-btn,
  header a.sc-www-profile-link {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
  }

  header a[href*='logo'],
  header .flex-shrink-0:first-child {
    flex-shrink: 1;
    min-width: 0;
  }

  header img.h-12,
  header img[class*='h-12'] {
    height: 2.25rem;
    width: auto;
  }
}

@media (min-width: 1024px) {
  header button.md\:hidden,
  header button[class*='md:hidden'] {
    display: none !important;
  }

  .sc-mobile-menu-panel {
    display: none !important;
  }
}

/* Baner „nowość” — mniejsza czcionka na wąskich ekranach */
@media (max-width: 767px) {
  header a[class*='bg-[#262626]'],
  header .border-b.border-neutral-800 {
    font-size: 8px !important;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    line-height: 1.35;
  }
}

/* === TELEFON === */
@media (max-width: 767px) {
  main.shooting-range-main {
    padding-top: 7rem;
  }

  main.shooting-range-main[class*='pt-'] {
    padding-top: 7rem !important;
  }

  /* Ukryj duplikaty React po załadowaniu API */
  main .narrow-container > [data-sc-suppressed='1'],
  #sc-arsenal-root [data-sc-suppressed='1'],
  #sc-cennik-root [data-sc-suppressed='1'],
  #sc-pakiety-root [data-sc-suppressed='1'] {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hero — mniejsze nagłówki */
  main h1.text-4xl,
  main h1.text-5xl,
  main h1.text-6xl,
  main .text-4xl,
  main .text-5xl,
  main .text-6xl {
    font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
    line-height: 1.15 !important;
  }

  main h2.text-3xl,
  main h2.text-4xl {
    font-size: clamp(1.35rem, 6vw, 1.875rem) !important;
    line-height: 1.2 !important;
  }

  /* Siatki Tailwind — jedna kolumna na telefonie */
  main .grid[class*='md:grid-cols-2'],
  main .grid[class*='md:grid-cols-3'],
  main .grid[class*='lg:grid-cols-2'],
  main .grid[class*='lg:grid-cols-3'],
  main .grid[class*='lg:grid-cols-4'],
  section .grid[class*='md:grid-cols-2'],
  section .grid[class*='md:grid-cols-3'],
  section .grid[class*='lg:grid-cols-2'] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Flex rzędy — zawijanie */
  main .flex:not(.sc-filter-scroll):not(.sc-mobile-menu-nav) {
    flex-wrap: wrap;
  }

  /* Rezerwacja — przewijanie tabel / siatki */
  main .overflow-x-auto,
  .shooting-range-app .overflow-x-auto,
  #booking-root .overflow-x-auto {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  main table,
  .shooting-range-app table {
    max-width: 100%;
  }

  /* Panel rezerwacji (app.js) */
  .shooting-range-app .scheduler-grid,
  .shooting-range-app .scheduler-portrait-body,
  .shooting-range-app #scheduler-body {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shooting-range-app .axis-card,
  .shooting-range-app .booking-axis-card {
    min-width: 0;
  }

  /* Kontakt / formularze */
  main form input,
  main form textarea,
  main form select,
  main form button[type='submit'] {
    max-width: 100%;
  }

  main .max-w-xl,
  main .max-w-2xl,
  main .max-w-3xl {
    max-width: 100%;
  }

  /* Stopka — linki prawne w kolumnie */
  .sc-footer-legal {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  footer.sc-www-site-footer,
  footer.bg-neutral-900 {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  footer.sc-www-site-footer .grid,
  footer.bg-neutral-900 .grid {
    gap: 2rem;
  }

  /* Baner cookies — bez 100vw (powoduje poziomy scroll na iOS) */
  .sc-cookie-banner-root {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .sc-cookie-banner-panel {
    max-width: 100%;
  }

  .sc-cookie-banner-panel h3 {
    font-size: 10px;
    line-height: 1.3;
  }

  .sc-cookie-banner-panel p {
    font-size: 13px;
    line-height: 1.45;
  }

  .sc-cookie-privacy-link {
    display: inline-block;
    margin-top: 0.35rem;
  }

  /* Przełącznik języka — kompaktowy */
  header .sc-lang-switcher-btn {
    min-width: 40px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* === TABLET === */
@media (min-width: 768px) and (max-width: 1023px) {
  main.shooting-range-main {
    padding-top: 6.5rem;
  }

  main h1.text-6xl,
  main .text-6xl {
    font-size: clamp(2.25rem, 5vw, 3rem) !important;
  }

  /* Dwie kolumny tam, gdzie sensowne */
  main .grid[class*='lg:grid-cols-3'],
  main .grid[class*='lg:grid-cols-4'] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  footer.sc-www-site-footer .grid,
  footer.bg-neutral-900 .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
  }

  footer.sc-www-site-footer .grid > :last-child,
  footer.bg-neutral-900 .grid > :last-child {
    grid-column: 1 / -1;
  }
}

/* Filtry — przewijanie poziome */
.sc-filter-scroll {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

@media (max-width: 1023px) {
  .sc-filter-scroll {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
    scrollbar-width: thin;
  }

  .sc-filter-scroll > button {
    flex-shrink: 0;
  }
}

/* Menu mobilne (hamburger) */
.sc-mobile-menu-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.sc-mobile-menu-open .sc-mobile-menu-panel {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.sc-mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

.sc-mobile-menu-inner {
  position: absolute;
  top: 0;
  right: 0;
  width: min(88vw, 320px);
  height: 100%;
  background: #111;
  border-left: 1px solid #333;
  padding-top: calc(5.5rem + env(safe-area-inset-top, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  padding-left: 1.25rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  -webkit-overflow-scrolling: touch;
}

body.sc-mobile-menu-open .sc-mobile-menu-inner {
  transform: translateX(0);
}

.sc-mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sc-mobile-menu-nav a {
  display: flex;
  align-items: center;
  padding: 0.85rem 0.5rem;
  color: #d4d4d4;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 44px;
}

.sc-mobile-menu-nav a:hover,
.sc-mobile-menu-nav a:focus {
  color: #fff;
}

.sc-mobile-menu-reserve {
  margin-top: 1.5rem;
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 1rem;
  background: var(--primary, #d1291e);
  border: 1px solid var(--primary, #d1291e);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
}

/* Arsenał — telefon */
@media (max-width: 767px) {
  #sc-arsenal-root h1 {
    font-size: 1.875rem !important;
    line-height: 1.2;
  }

  #sc-arsenal-root h4 {
    font-size: 1.15rem;
    word-break: break-word;
  }

  #sc-arsenal-root .p-6 {
    padding: 1rem;
  }

  #sc-arsenal-root [data-sc-grid] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Wydarzenia — kalendarz */
@media (max-width: 767px) {
  .sc-events-calendar,
  .sc-events-calendar-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

/* Modale auth / voucher — pełna szerokość na telefonie */
@media (max-width: 767px) {
  .sc-auth-modal-panel,
  .sc-voucher-modal-panel,
  [class*='modal-panel'],
  [class*='Modal-panel'] {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 12px !important;
  }
}

/* === Rezerwacja WWW (/pl/rezerwacja) — telefon i tablet === */
@media (max-width: 767px) {
  body.booking-page {
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.booking-page .sc-www-header-inner {
    flex-wrap: wrap;
    padding: 0 max(12px, env(safe-area-inset-left, 0px)) 0 max(12px, env(safe-area-inset-right, 0px));
    gap: 10px;
  }

  body.booking-page .sc-www-nav {
    display: flex;
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 14px;
    padding: 6px 0 2px;
    scrollbar-width: none;
  }

  body.booking-page .sc-www-nav::-webkit-scrollbar {
    display: none;
  }

  body.booking-page .sc-www-nav a {
    flex-shrink: 0;
    font-size: 11px;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  body.booking-page .sc-www-reserve-btn {
    padding: 8px 12px;
    font-size: 10px;
  }

  body.booking-page .booking-stepper-wrap {
    padding-top: calc(7.5rem + env(safe-area-inset-top, 0px));
  }

  body.booking-page .booking-container,
  body.booking-page .container {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
  }

  body.booking-page .calendar-card,
  body.booking-page .scheduler-card {
    padding: 14px 12px;
  }

  body.booking-page .axis-picker {
    grid-template-columns: 1fr;
  }

  body.booking-page .booking-mobile-bar {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  body.booking-page button,
  body.booking-page .btn,
  body.booking-page .slot-cell,
  body.booking-page .nav-arrow {
    touch-action: manipulation;
  }
}

/* Panel klienta /profil — mobile */
@media (max-width: 1023px) {
  html[data-sc-profil-page='1'],
  html[data-sc-profil-page='1'] body {
    overflow-x: clip;
  }

  html[data-sc-profil-page='1'] .shooting-range-app {
    min-height: 100dvh;
    overflow-x: clip;
  }

  html[data-sc-profil-page='1'] .sidebar .nav-item,
  html[data-sc-profil-page='1'] .sidebar .nav-logout {
    touch-action: manipulation;
    min-height: 44px;
  }

  html[data-sc-profil-page='1'] .promo-bar {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    font-size: 11px;
    line-height: 1.35;
  }
}

/* === A2 — scroll lock menu + tap targets 48px === */
body.sc-mobile-menu-open {
  overflow: hidden !important;
}

.sc-mobile-menu-nav a {
  min-height: 48px;
  padding: 0.9rem 0.5rem;
}

.sc-mobile-menu-reserve {
  min-height: 48px;
}

/* === A3 — sticky pasek kontaktu (mobile) === */
.sc-mobile-contact-bar {
  display: none;
}

@media (max-width: 767px) {
  .sc-mobile-contact-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    background: #111;
    border-top: 1px solid #333;
    padding: 0.35rem max(0.5rem, env(safe-area-inset-left, 0px)) calc(0.35rem + env(safe-area-inset-bottom, 0px)) max(0.5rem, env(safe-area-inset-right, 0px));
    gap: 0.35rem;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  }

  body.sc-has-mobile-contact-bar {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }

  body.sc-has-mobile-contact-bar.sc-mobile-menu-open {
    padding-bottom: 0;
  }

  body.sc-has-mobile-contact-bar .sc-cookie-banner-root {
    bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }

  .sc-mobile-contact-bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 48px;
    padding: 0.35rem 0.25rem;
    color: #e5e5e5;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sc-mobile-contact-bar-btn span:first-child {
    font-size: 18px;
    line-height: 1;
  }

  .sc-mobile-contact-bar-btn:active {
    background: rgba(255, 255, 255, 0.1);
  }

  /* === A6 — skrót pod hero === */
  .sc-mobile-hero-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 auto;
    max-width: 1280px;
    padding: 0.75rem max(16px, env(safe-area-inset-left, 0px)) 0.75rem max(16px, env(safe-area-inset-right, 0px));
    background: #161616;
    border-bottom: 1px solid #2e2e2e;
  }

  .sc-mobile-hero-strip-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #d4d4d4;
  }

  .sc-mobile-hero-strip-link {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary, #d1291e);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* === A5 — CTA telefoniczny kontakt === */
  .sc-kontakt-phone-cta {
    min-height: 48px;
    margin-top: 0.75rem;
  }

  main .mb-16.flex.justify-center {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* === D3 — mapa bez scroll trap === */
  .sc-kontakt-map iframe {
    pointer-events: none;
  }

  .sc-kontakt-map-ready iframe {
    pointer-events: auto;
  }

  .sc-kontakt-map::after {
    content: 'Otwórz w Maps';
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 5;
    padding: 0.5rem 1rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    pointer-events: none;
  }

  .sc-kontakt-map-ready::after {
    display: none;
  }

  /* === D1 — typografia mobile min 16px === */
  main p,
  footer p,
  .shooting-range-app p {
    font-size: max(16px, 1rem);
    line-height: 1.5;
  }

  /* === A7 — kafel Kręgielnia w ofercie === */
  #sc-kregielnia-oferta.sc-kregielnia-oferta-card {
    scroll-margin-top: 5rem;
  }
}
