/* Responsive fixes for every screen size (phones, tablets, laptops, large monitors).
   Loaded last so these rules win over the earlier stylesheets. */

/* words stay whole when the browser wraps lines */
.word { display: inline-block; white-space: nowrap; }

/* keep the page from scrolling sideways, and never let images or media overflow */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video { max-width: 100%; }

/* ----- header ----- */
@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 10px 16px; align-items: center; }
  .logo { font-size: 1.25rem; }
  .actions { margin-left: auto; }
  /* search takes its own full-width row (flex-basis, not width, decides the row) */
  .topbar .search { flex: 0 0 100%; max-width: none; margin: 0; order: 4; }
  .cats { order: 5; flex: 0 0 100%; width: 100%; gap: 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cats a { flex: none; }
}
@media (max-width: 380px) {
  .logo { font-size: 1.1rem; }
  .icon-btn { width: 40px; height: 40px; }
}

/* ----- home hero ----- */
.hero { min-width: 0; }
.hero > div { min-width: 0; }
.hero h1 { overflow-wrap: break-word; }
.hero-art { min-width: 0; }
.spin-badge { right: 8px; top: 4px; }
@media (max-width: 900px) {
  .hero { padding: 36px 0 20px; }
  .hero h1 { font-size: clamp(2.3rem, 11vw, 3.6rem); }
  .hero p { font-size: 1.02rem; }
  .hero-cta .btn { flex: 1 1 auto; text-align: center; }
  .hero-art { height: 260px; }
  .s1 { font-size: 3.6rem; }
  .s2 { font-size: 3.2rem; }
  .s3 { font-size: 2.8rem; }
  .spin-badge { width: 96px; height: 96px; font-size: .62rem; }
}

/* ----- grids and sections ----- */
.grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.sec-title { flex-wrap: wrap; }
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-img { height: 190px; }
  .card-img .emoji { font-size: 4rem; }
  .card-body { padding: 10px 10px 14px; }
  .name { font-size: .95rem; }
  .price b { font-size: 1.02rem; }
  .price s { font-size: .85rem; }
  .sec-title h2 { font-size: 1.5rem; }
  .cat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .cat-tile { padding: 14px 6px; font-size: .9rem; }
  .stats-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat-box { padding: 12px 6px; }
  .stat-box b { font-size: 1.45rem; }
  .stat-box { font-size: .8rem; }
  .banner { padding: 22px; }
  .banner h2 { font-size: 1.5rem; }
}
@media (min-width: 481px) and (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ----- shop ----- */
.shop-layout, .filters { min-width: 0; }
@media (max-width: 900px) {
  .shop-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}

/* ----- product page ----- */
.pdp > * { min-width: 0; }
.pdp-info h1 { overflow-wrap: anywhere; }
.actions-row .btn { flex: 1 1 auto; text-align: center; }
.pin .input { min-width: 0; }
@media (max-width: 900px) {
  .pdp { gap: 24px; }
  .pdp-visual { height: min(420px, 90vw); }
  .pdp-visual .emoji { font-size: 7rem; }
  .gal-thumb { width: 64px; height: 64px; }
}

/* ----- cart and checkout ----- */
.two > * { min-width: 0; }
.line { grid-template-columns: minmax(64px, 96px) minmax(0, 1fr) auto; gap: 12px; }
.line .name { overflow-wrap: anywhere; }
.thumb { width: 100%; max-width: 96px; height: auto; aspect-ratio: 1; }
@media (max-width: 480px) {
  .line { grid-template-columns: 72px minmax(0, 1fr); }
  .line-price { grid-column: 2; }
  .thumb { max-width: 72px; font-size: 2rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .input { width: 100%; }
  .panel { padding: 16px; border-radius: 18px; }
  .sum-row.total { font-size: 1.15rem; }
}

/* ----- toast and fixed bits stay inside the screen ----- */
.toast { max-width: calc(100vw - 32px); text-align: center; }
.scroll-bar { z-index: 120; }

/* ----- admin: tables scroll inside their box, never the whole page ----- */
.wrap { max-width: 100%; }
@media (max-width: 900px) {
  .admin { padding: 20px 14px 40px; }
  .admin-head { flex-direction: column; align-items: flex-start; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .grid3, .two-col { grid-template-columns: 1fr; }
  .toolbar .search-box { min-width: 0; width: 100%; }
  .toolbar > * { max-width: 100%; }
  .modal-card { padding: 16px; max-height: 92vh; }
  .brow { grid-template-columns: minmax(0, 90px) minmax(0, 1fr) minmax(0, 100px); }
  .form-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tab { flex: none; white-space: nowrap; }
  .fun-row { grid-template-columns: 74px minmax(0, 1fr) auto; }
  .fun-v { font-size: .8rem; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat b { font-size: 1.35rem; }
  .stat { padding: 12px; }
  .live-dot { margin-left: 0; margin-top: 6px; }
  .cmp-big { font-size: 1.9rem; }
  .donut { width: 150px; height: 150px; }
  .chart, .hours { height: 150px; }
  .hcol span { font-size: .55rem; }
}

/* ----- header on mid-size screens (tablets in landscape, small laptops): let icons wrap, never run off the edge ----- */
@media (min-width: 901px) and (max-width: 1180px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar .search { flex: 1 1 260px; max-width: none; margin-left: 0; order: 3; }
  .cats { order: 4; flex: 0 0 100%; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .actions { margin-left: auto; }
}
