/**
 * Responsywność całej strony WWW Strzelnica CEL
 * Telefon: ≤767px | Tablet: 768–1023px | Komputer: ≥1024px
 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Tylko strona WWW — nie ograniczaj html/body panelu admin */
html:has(.shooting-range-app),
body:has(.shooting-range-app) {
  overflow-x: clip;
}

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 {
    margin-left: auto;
    flex-shrink: 0;
  }

  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 */
  .sc-cookie-banner-root {
    width: 100%;
    max-width: 100vw;
    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(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 12px !important;
  }
}
