/* =============================================
   Gume365 – main stylesheet
   ============================================= */

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

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --best: #16a34a;
  --best-bg: #f0fdf4;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .06);

  /* EU label colours (A=green … G=red) */
  --a: #006400;
  --b: #4caf50;
  --c: #8bc34a;
  --d: #ffc107;
  --e: #ff9800;
  --f: #f44336;
  --g: #b71c1c;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ---- Header ---- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

.header-bg {
  background: #f1f5f9;
  padding: 1rem 2rem;
}

.header-bg::before { display: none; }
.header-bg::after  { display: none; }

.header-inner {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2.2rem;
  flex-wrap: wrap;
}
/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-shrink: 0;
  text-decoration: none;
}

.header-logo-img {
  height: 130px;
  width: auto;
  display: block;
  border-radius: 6px;
}

.logo-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.logo-icon {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 8px rgba(147, 210, 255, .5));
  animation: spin-slow 2.6s linear infinite;
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}


.logo-text {
  font-family: 'Exo 2', system-ui, sans-serif;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: .01em;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 60%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(96, 165, 250, .4));
}

/* Divider between logo and copy */
.header-logo::after {
  content: '';
  display: block;
  width: 1px;
  height: 36px;
  background: rgba(0, 0, 0, .15);
  margin-left: .5rem;
}

/* Copy block */
.header-copy {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.header-tagline {
  font-size: 1.2rem;
  color: #334155;
  font-weight: 400;
  letter-spacing: .01em;
}

.header-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .3rem .15rem;
}

.hbadge {
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: #64748b;
  text-transform: uppercase;
}

.hbadge-sep {
  font-size: .85rem;
  color: #94a3b8;
  margin: 0 .2rem;
}

/* Bottom accent line */
header::after {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd, transparent);
}

/* Main layout */
main {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* ---- Filters ---- */
.filters-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.search-row {
  display: flex;
  gap: .6rem;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}

.search-row input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
}

.search-row input[type="text"]:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

.filter-row {
  display: flex;
  gap: .9rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* ---- Multi-select dropdown ---- */
.ms-wrap {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  position: relative;
}
.ms-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.multi-select {
  position: relative;
  min-width: 140px;
}
.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.ms-trigger:hover { border-color: var(--primary); }
.ms-trigger-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.ms-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .2s;
}
.multi-select.open .ms-chevron { transform: rotate(180deg); }
.ms-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 500;
  overflow: hidden;
}
.multi-select.open .ms-panel { display: block; }
.ms-search {
  width: 100%;
  padding: .5rem .75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  outline: none;
}
.ms-actions {
  display: flex;
  justify-content: space-between;
  padding: .3rem .75rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.ms-actions button {
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: .1rem 0;
}
.ms-actions button:hover { text-decoration: underline; }
.ms-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  padding: .25rem 0;
}
.ms-item {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: space-between !important;
  padding: 0 !important;
  font-size: .88rem !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  width: 100%;
  gap: 0 !important;
}
.ms-item > span:first-child {
  flex: 1;
  padding: .35rem .5rem .35rem .75rem;
  display: flex;
  align-items: center;
}
.ms-item:hover { background: #f0f4ff; }
.ms-item-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex: 1;
}
.ms-marking-badge {
  flex-shrink: 0;
  min-width: 3.8rem;
  text-align: center;
}
.ms-item-desc {
  color: var(--text-muted);
  font-weight: 400;
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-item-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  flex-shrink: 0;
  position: relative;
}
.ms-item-check::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border);
}
.ms-item-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}
.ms-footer {
  padding: .4rem .75rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  text-align: right;
}
.ms-apply {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: .3rem .8rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.ms-apply:hover { background: var(--primary-hover); }
.ms-item.hidden { display: none; }

.filter-row label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.filter-row select {
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  background: #fff;
  cursor: pointer;
  min-width: 100px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: .5rem 1rem;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background .15s, color .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
}

.btn-sm {
  padding: .3rem .7rem;
  font-size: .8rem;
  background: var(--primary);
  color: #fff;
  border-radius: 5px;
  transition: background .15s, transform .15s;
}

.btn-sm:hover {
  background: var(--primary-hover);
  transform: scale(1.3);
}

.btn-sm-grey {
  background: #e5e7eb;
  color: #9ca3af;
  transition: background .15s, color .15s, transform .15s;
}

.btn-sm-grey:hover {
  background: #d1d5db;
  color: #6b7280;
  cursor: pointer;
  transform: scale(1.3);
}

/* ---- Results bar ---- */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .9rem;
}

.results-count {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.results-page-info {
  margin-left: .4rem;
  color: var(--text-muted);
}

.per-page-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.per-page-wrap select {
  padding: .3rem .55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .88rem;
  background: #fff;
  cursor: pointer;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .3rem;
  margin: 1.5rem 0 .5rem;
}

.pag-btn {
  min-width: 2.4rem;
  justify-content: center;
  padding: .4rem .75rem;
  font-size: .88rem;
  align-self: center;
  line-height: 1;
  transition: none;
}
.pag-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: var(--primary);
}

.pag-current {
  cursor: default;
  pointer-events: none;
}

.pag-ellipsis {
  padding: .4rem .2rem;
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1;
  align-self: center;
}

.pagination-top {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* ---- Empty state ---- */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
}

/* ---- Tire card ---- */
.tire-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.1rem;
  overflow: hidden;
}

.tire-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.25rem .8rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.tire-title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem .6rem;
}

.tire-brand {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  background: #eff6ff;
  padding: .15rem .45rem;
  border-radius: 4px;
  min-width: 7rem;
  text-align: center;
  flex-shrink: 0;
}

.tire-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.tire-size {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tire-marking {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .1rem .4rem;
  border-radius: 4px;
  letter-spacing: .03em;
  position: relative;
}

.tire-marking[data-tooltip] {
  cursor: default;
}

.tire-marking[data-tooltip]::after {
  content: attr(data-tooltip);
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1d23;
  color: #fff;
  font-size: .75rem;
  font-weight: 400;
  padding: .4rem .65rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

.tire-marking[data-tooltip]::before {
  content: '';
  display: none;
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1d23;
  z-index: 200;
  pointer-events: none;
}

.tire-marking[data-tooltip]:hover::after,
.tire-marking[data-tooltip]:hover::before {
  display: block;
}
.ms-panel .tire-marking[data-tooltip]:hover::after,
.ms-panel .tire-marking[data-tooltip]:hover::before {
  display: none;
}

/* Season badge */
.season-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 20px;
  white-space: nowrap;
}
.season-badge.season-letna {
  background: #fff3cd;
  color: #92600a;
}
.season-badge.season-zimska {
  background: #dbeafe;
  color: #1d4ed8;
}
.season-badge.season-vse-sezone {
  background: #d1fae5;
  color: #065f46;
}

/* EU label ratings */
.tire-ratings {
  display: flex;
  gap: .8rem;
  align-items: center;
  flex-shrink: 0;
}

.rating-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}

.rating-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}

.rating-badge {
  display: inline-block;
  width: 1.8rem;
  height: 1.8rem;
  line-height: 1.8rem;
  text-align: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: .9rem;
  color: #fff;
}

.rating-a {
  background: var(--a);
}

.rating-b {
  background: var(--b);
}

.rating-c {
  background: var(--c);
  color: #333;
}

.rating-d {
  background: var(--d);
  color: #333;
}

.rating-e {
  background: var(--e);
}

.rating-f {
  background: var(--f);
}

.rating-g {
  background: var(--g);
}

.rating-n\/a,
.rating-u {
  background: #ccc;
  color: #555;
}

.rating-value {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
}

/* ---- Dealer table ---- */
.dealers-table-wrapper {
  overflow-x: auto;
}

.dealers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  table-layout: fixed;
}

.dealers-table th:nth-child(1) {
  width: 19%;
}

/* Prodajalec */
.dealers-table th:nth-child(2) {
  width: 14%;
}

/* Oznake */
.dealers-table th:nth-child(3) {
  width: 11%;
}

/* Cena */
.dealers-table th:nth-child(4) {
  width: 10%;
}

/* Zaloga */
.dealers-table th:nth-child(5) {
  width: 11%;
}

/* Rok dostave */
.dealers-table th:nth-child(6) {
  width: 18%;
}

/* Stroški dostave */
.dealers-table th:nth-child(7) {
  width: 14%;
}

/* Povezava */
.dealers-table th {
  text-align: center;
  padding: .5rem 1rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}

.dealers-table td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  text-align: center;
}

.dealers-table td:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border);
}

.dealers-table tbody tr:last-child td {
  border-bottom: none;
}

.dealers-table tbody tr:not(.best-price):hover {
  background: #fafbfc;
}

.best-price {
  background: var(--best-bg);
}

.dealer-name {
  font-weight: 600;
  padding: 0 !important;
}

.dn-inner {
  display: flex;
  align-items: stretch;
}

.dn-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  flex-shrink: 0;
  position: relative;
}

.dn-logo::after {
  content: '';
  position: absolute;
  right: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: var(--border);
}

.dn-text {
  flex: 1;
  padding: .6rem .9rem;
  text-align: left;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .15rem .3rem;
  white-space: nowrap;
}

.dealer-logo {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: contain;
  display: block;
}

.dealer-price {
  font-weight: 600;
  color: var(--text);
}

.price-best {
  color: var(--best);
  font-family: 'Chakra Petch', system-ui, sans-serif;
  font-size: 1.21rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: .03em;
}

.price-best::after {
  content: '';
}

/* ---- Nav tabs ---- */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0 2rem;
  background: #0f172a;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nav-tab {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  padding: 0.65rem 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.nav-tab:hover { color: rgba(255,255,255,0.85); }
.nav-tab--active { color: #fff; border-color: #3b82f6; }

/* ---- Footer ---- */
footer {
  margin-top: 2rem;
  background: #0f172a;
  border-top: 3px solid #1d4ed8;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.footer-logo-text {
  font-family: 'Exo 2', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 60%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.footer-tagline {
  font-size: .75rem;
  color: rgba(255,255,255,.4);
}
.footer-dealers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem .1rem;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
}
.footer-dot {
  color: rgba(255,255,255,.2);
  margin: 0 .2rem;
}
.footer-reload {
  font-size: .8rem;
  color: rgba(255,255,255,.5);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.15);
  padding: .35rem .8rem;
  border-radius: 6px;
  transition: color .15s, border-color .15s;
}
.footer-reload:hover {
  color: #fff;
  border-color: rgba(255,255,255,.4);
}

/* ---- Info tooltip ---- */
.oznake-cell {
  white-space: normal;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  vertical-align: middle;
}
.oznake-cell .tire-marking {
  display: inline-block;
  margin: .1rem .15rem .1rem 0;
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: .3rem;
  vertical-align: middle;
  cursor: default;
}

.info-tip svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  opacity: .5;
  transition: opacity .15s;
}

.info-tip:hover svg {
  opacity: 1;
  color: var(--primary);
}

.info-tip__bubble {
  display: none;
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  background: #1a1d23;
  color: #fff;
  font-size: .78rem;
  padding: .4rem .65rem;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 300px;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

.info-tip__bubble::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #1a1d23;
}

.info-tip:hover .info-tip__bubble {
  display: block;
}

/* ---- Extras toggle button ---- */
.extras-toggle {
  margin-left: .5rem;
  padding: .15rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  background: transparent;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  cursor: pointer;
  vertical-align: middle;
  letter-spacing: .02em;
  transition: background .15s, color .15s;
}

.extras-toggle:hover {
  background: var(--primary);
  color: #fff;
}

.extra-row td {
  background: #fafafa;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ============================================================
   RESPONSIVE – mobile & tablet
   ============================================================ */

@keyframes ms-slide-up {
  from { transform: translateY(24px); opacity: .5; }
  to   { transform: translateY(0);    opacity: 1;  }
}

/* ---- Tablet (≤768px) ---- */
@media (max-width: 768px) {
  /* Header */
  .header-bg { padding: 1.3rem 1.2rem 1.1rem; }
  .header-logo::after { display: none; }
  .header-badges { display: none; }

  /* Main */
  main { margin: .85rem auto; padding: 0 .85rem; }

  /* Filters – 2-column grid */
  .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    align-items: start;
  }
  .filter-row label,
  .filter-row .ms-wrap { width: 100%; }
  .filter-row select,
  .filter-row .multi-select { width: 100%; }
  .filter-row > *:nth-child(7) { grid-column: 1 / -1; } /* Oznaka – full width */
  .ms-trigger-text { max-width: none; flex: 1; min-width: 0; }
  .multi-select { min-width: 0; }

  /* Right-align panels to prevent overflow */
  .ms-panel { left: auto; right: 0; }

  /* Tire header */
  .tire-header { flex-direction: column; gap: .5rem; padding: .85rem 1rem .75rem; }
  .tire-ratings { gap: .5rem; }

  /* Footer */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: .7rem; }
}

/* ---- Phone (≤480px) ---- */
@media (max-width: 480px) {
  /* Header */
  .header-bg { padding: 1rem .85rem .9rem; }
  .logo-icon { width: 36px; height: 36px; }
  .logo-text { font-size: 1.6rem; }

  /* Main */
  main { margin: .6rem auto; padding: 0 .6rem; }

  /* Search */
  .search-row { gap: .5rem; }
  .search-row input[type="text"] { min-width: 0; font-size: 1rem; /* prevent iOS zoom */ }
  .btn { padding: .5rem .75rem; font-size: .88rem; }

  /* Prevent iOS auto-zoom on focus */
  .filter-row select,
  .ms-trigger { font-size: 1rem; }

  /* Multi-select panel – bottom sheet */
  .ms-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    min-width: unset !important;
    max-height: 72vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 32px rgba(0,0,0,.2);
    z-index: 999;
    animation: ms-slide-up .22s ease;
  }
  .ms-list { max-height: none; }
  .ms-search { padding: .65rem .9rem; font-size: 1rem; }
  .ms-item { font-size: .92rem !important; }
  .ms-item > span:first-child { padding: .5rem .65rem .5rem .9rem; }
  .ms-footer { padding: .6rem .9rem; }
  .ms-apply { padding: .5rem 1.4rem; font-size: .88rem; }

  /* Results bar */
  .results-count { font-size: .82rem; }

  /* Pagination */
  .pag-btn { min-width: 2.1rem; padding: .44rem .6rem; font-size: .84rem; }

  /* Tire card */
  .tire-card { border-radius: 8px; margin-bottom: .75rem; }
  .tire-header { padding: .7rem .85rem .65rem; gap: .4rem; }
  .tire-brand { font-size: .68rem; min-width: 0; padding: .1rem .35rem; }
  .tire-name { font-size: .95rem; }
  .tire-size { font-size: .82rem; }
  .tire-ratings { gap: .4rem; flex-wrap: wrap; }
  .rating-label { font-size: .58rem; }
  .rating-badge { width: 1.55rem; height: 1.55rem; line-height: 1.55rem; font-size: .78rem; }
  .rating-value { width: 1.55rem; height: 1.55rem; font-size: .78rem; }
  .season-badge { font-size: .7rem; padding: .15rem .45rem; }

  /* ---- Dealer table → mobile card rows ---- */
  .dealers-table-wrapper { overflow-x: visible; }
  .dealers-table,
  .dealers-table tbody { display: block; width: 100%; }
  .dealers-table thead { display: none; }

  .dealers-table tr {
    display: grid;
    grid-template-columns: 1fr auto 50px;
    grid-template-rows: auto auto;
    column-gap: .5rem;
    padding: .6rem .85rem;
    border-bottom: 1px solid var(--border);
  }
  .dealers-table tbody tr:last-child { border-bottom: none; }

  .dealers-table td {
    display: block;
    padding: 0 !important;
    border: none !important;
    text-align: left;
    position: static;
    line-height: 1.35;
  }
  .dealers-table td:not(:last-child)::after { display: none; }

  /* [1] Dealer name – row 1, col 1 */
  .dealers-table td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    display: flex; align-items: center;
  }
  /* [2] Oznake – row 2, col 1 */
  .dealers-table td:nth-child(2) {
    grid-column: 1; grid-row: 2;
    display: flex; flex-wrap: wrap; gap: .15rem;
    align-items: center; padding-top: .22rem !important;
  }
  /* [3] Cena – row 1, col 2 */
  .dealers-table td:nth-child(3) {
    grid-column: 2; grid-row: 1;
    display: flex; align-items: center; justify-content: flex-end;
    font-size: .9rem; font-weight: 600;
  }
  /* [4] Zaloga – row 2, col 2 */
  .dealers-table td:nth-child(4) {
    grid-column: 2; grid-row: 2;
    display: flex; align-items: center; justify-content: flex-end;
    font-size: .72rem; color: var(--text-muted);
    padding-top: .22rem !important;
    white-space: nowrap;
  }
  /* [5] Rok dostave – skrij */
  .dealers-table td:nth-child(5) { display: none !important; }
  /* [6] Stroški dostave – skrij */
  .dealers-table td:nth-child(6) { display: none !important; }
  /* [7] Link – col 3, obe vrstici */
  .dealers-table td:nth-child(7) {
    grid-column: 3; grid-row: 1 / 3;
    display: flex; align-items: center; justify-content: center;
  }

  /* Dealer name internals */
  .dn-inner { gap: .3rem; }
  .dn-logo { width: 22px; }
  .dn-logo::after { display: none; }
  .dn-text {
    padding: 0;
    font-size: .86rem;
    flex-wrap: nowrap;
    gap: .2rem;
    overflow: hidden;
  }
  .dealer-logo { width: 14px; height: 14px; }
  .info-tip { display: none; }

  /* Best price */
  .price-best { font-size: 1rem; }

  /* Link button – touch friendly */
  .btn-sm { padding: .4rem .55rem; font-size: .76rem; }

  /* Footer */
  .footer-inner { padding: 1rem .85rem; }
  .footer-dealers { font-size: .7rem; }
}