/* ═══════════════════════════════════════════════════════════
   Responzivní chování
   Připojuje se za base.css. Řeší administraci na tabletu
   a mobilu a hrubé přetékání obsahu v úzkých oknech.
   ═══════════════════════════════════════════════════════════ */

/* ── Základ ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

img, video, canvas, svg { max-width: 100%; height: auto; }

/* Dlouhé řetězce (VIN, e-maily, URL) nesmí roztáhnout stránku */
body { overflow-wrap: break-word; }


/* ── Ovládání menu administrace ─────────────────────────── */

.adm-burger {
  display: none;
  position: fixed;
  top: 9px; left: 12px;
  z-index: 640;
  width: 38px; height: 34px;
  align-items: center; justify-content: center;
  background: #18182e; color: #fff;
  border: none; border-radius: 8px;
  font-size: 17px; line-height: 1; cursor: pointer;
  font-family: inherit;
}

.adm-backdrop {
  display: none;
  position: fixed; inset: 0;
  z-index: 610;
  background: rgba(15, 23, 42, .55);
}

#vAdmin.menu-open .adm-backdrop { display: block; }


/* ═══════════════════════════════════════════════════════════
   Tablet – do 1024 px
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {

  .adml { grid-template-columns: 200px 1fr; }

  .adm-ct { padding: 16px 18px 28px; }

  /* Mřížky karet zúžit na dva sloupce */
  .adm-ct [style*="repeat(auto-fill"],
  .adm-ct [style*="repeat(auto-fit"] {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  }

  .adm-ct [style*="grid-template-columns:repeat(4"],
  .adm-ct [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}


/* ═══════════════════════════════════════════════════════════
   Mobil – do 768 px
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Postranní panel se vysune přes obsah */
  .adml {
    grid-template-columns: 1fr;
    height: 100vh;
  }

  .adm-sb {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 262px;
    z-index: 620;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 32px rgba(0, 0, 0, .35);
  }

  #vAdmin.menu-open .adm-sb { transform: none; }

  .adm-burger { display: flex; }

  .adm-topbar {
    padding: 0 14px 0 60px;   /* místo pro tlačítko menu */
    height: 52px;
  }

  .adm-tb-title { font-size: 13px; }

  /* Na úzkém displeji stačí název sekce */
  .adm-tb-title span:not(:last-child) { display: none; }

  .adm-ct { padding: 14px 14px 26px; }

  /* Karty se statistikami pod sebe po dvou */
  .adm-stats { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Všechny mřížky v administraci na jeden sloupec */
  .adm-ct [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Tabulky posouvat vodorovně místo přetékání */
  .adm-ct table { min-width: 560px; }
  .adm-ct > div > div[style*="overflow-x"] { -webkit-overflow-scrolling: touch; }

  /* Modální okna přes celou šířku */
  #aw-modal-ov > div { max-width: 100% !important; margin: 0 !important; }
  #aw-modal-ov { padding: 12px !important; }

  /* Formuláře v modálech pod sebe */
  #aw-modal-ov [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Oznámení nepřekrývat celou šířku */
  .aw-toast {
    left: 12px; right: 12px;
    max-width: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════
   Malý mobil – do 480 px
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 480px) {

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

  .adm-ct { padding: 12px 11px 24px; }

  .adm-topbar { padding-left: 56px; }

  .adm-tb-btn { padding: 4px 9px; font-size: 11px; }

  /* Ve výpisech skrýt méně podstatné sloupce */
  .adm-ct table th:nth-child(n+6),
  .adm-ct table td:nth-child(n+6) { display: none; }

  .adm-ct table { min-width: 0; }
}


/* ═══════════════════════════════════════════════════════════
   Veřejné weby – společná pojistka
   Šablony mají vlastní styly, tohle jen zabrání přetečení.
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {

  .site-wrap [style*="grid-template-columns:repeat(3"],
  .site-wrap [style*="grid-template-columns: repeat(3"],
  .site-wrap [style*="grid-template-columns:repeat(4"],
  .site-wrap [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  }

  .site-wrap [style*="display:flex"] { flex-wrap: wrap; }
}

@media (max-width: 640px) {

  .site-wrap [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Velké nadpisy zmenšit */
  .site-wrap h1 { font-size: clamp(26px, 8vw, 38px) !important; }
  .site-wrap h2 { font-size: clamp(20px, 6vw, 28px) !important; }

  /* Vodorovné odsazení sekcí */
  .site-wrap [style*="padding:80px"],
  .site-wrap [style*="padding:70px"],
  .site-wrap [style*="padding:60px"] {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  .site-wrap table { display: block; overflow-x: auto; }
}


/* ═══════════════════════════════════════════════════════════
   AutoWeb a RealityWeb
   Tyhle dva mají styly v CSS třídách, ne v inline stylech,
   takže potřebují vlastní zlomy.
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {

  .ab-strip-inner,
  .ab-svcs-grid,
  .rw-agents-grid,
  .rw-mspecs        { grid-template-columns: repeat(2, 1fr) !important; }

  .ab-filter-row    { grid-template-columns: repeat(3, 1fr) !important; }

  .rw-test-grid     { grid-template-columns: repeat(2, 1fr) !important; }

  .rw-mbody         { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {

  /* Hero a dvousloupcové bloky pod sebe */
  .ab-hero-inner,
  .ab-buyback-inner,
  .ab-car-specs,
  .ab-form-row,
  .ab-modal-specs-grid,
  .rw-cta-form,
  .rw-calc-inputs   { grid-template-columns: 1fr !important; }

  .ab-car-grid      { grid-template-columns: 1fr !important; }

  .ab-filter-row    { grid-template-columns: repeat(2, 1fr) !important; }

  .ab-nav-links,
  .rw-nav-links     { display: none !important; }

  .ab-modal,
  .rw-modal         { max-width: 100% !important; margin: 0 !important;
                      border-radius: 0 !important; }
}

@media (max-width: 560px) {

  .ab-strip-inner,
  .ab-svcs-grid,
  .ab-filter-row,
  .rw-agents-grid,
  .rw-mspecs,
  .rw-test-grid     { grid-template-columns: 1fr !important; }
}


/* ── Tisk ───────────────────────────────────────────────── */

@media print {
  .adm-sb, .adm-topbar, .adm-burger, .adm-backdrop,
  .aw-toast, #aw-modal-ov > div > div:last-child { display: none !important; }

  .adml { grid-template-columns: 1fr; height: auto; }
  .adm-ct { overflow: visible; padding: 0; }
  #aw-modal-ov { position: static; background: none; padding: 0; }
  #aw-modal-ov > div { box-shadow: none; max-width: 100%; }
}
