/* Metaskeisti.lt – naudotos dalys UI (inspired by shadcn/ui) */
/* Spalvos */
:root {
  --primary-600: #7266f3;
  --primary-500: #7f73fa;
  --primary-700: #5f55e5;
  --primary-tint: #bcb6fc;
  --header-start: #7266f3;
  --header-end: #7f73fa;
  --text-on-header: #ffffff;
  --body-bg: #f7f7fb;
  --heading: #343434;
  --text: #2a2a2a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --footer-bg: #18171b;
  --footer-text: #e5e7eb;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--body-bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: linear-gradient(90deg, var(--header-start), var(--header-end));
  color: var(--text-on-header);
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.header-content { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-logo { max-height: 64px; display: block; }
.main-nav { display: flex; gap: 12px; }
.nav-link { color: var(--text-on-header); text-decoration: none; opacity: .9; padding: 8px 10px; border-radius: 8px; }
.nav-link:hover { background: rgba(255,255,255,.12); opacity: 1; }
.nav-link.is-active { background: rgba(255,255,255,.2); }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-text); margin-top: 56px; }
.site-footer .container { padding: 24px 16px; }
.footer-links { display: flex; gap: 12px; margin-bottom: 8px; }
.footer-links a { color: var(--footer-text); text-decoration: none; opacity: .9; }
.footer-links a:hover { text-decoration: underline; opacity: 1; }

/* Sections */
.site-main { padding: 16px 0 32px; }
.page-title { color: var(--heading); margin: 16px 0; font-size: 24px; }
.section-title { color: var(--heading); margin: 24px 0 12px; font-size: 20px; }
.feedback-cta { margin: 24px 0; text-align: center; }

/* Breadcrumb */
.breadcrumb { margin: 8px 0 12px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumb li { color: var(--muted); }
.breadcrumb a { color: var(--primary-600); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb li+li:before { content: '/'; margin: 0 6px; color: var(--muted); }

/* Inputs */
.filters { padding: 10px 0 16px; }
.filter-row { display: grid; gap: 12px; grid-template-columns: repeat(12, 1fr); align-items: end; }
.filter-group { grid-column: span 2; display: flex; flex-direction: column; gap: 6px; }
.filter-group.grow { grid-column: span 4; }
.filter-actions { grid-column: span 2; display: flex; gap: 8px; align-items: center; }
@media (max-width: 1100px) {
  .filter-group { grid-column: span 3; }
  .filter-group.grow { grid-column: span 6; }
  .filter-actions { grid-column: span 3; }
}
@media (max-width: 900px) {
  .filters { padding: 10px 0 12px; }
  .filter-row { gap: 10px; }
  .filter-group, .filter-group.grow, .filter-actions { grid-column: span 12; }
}
@media (max-width: 900px) {
  /* Didesnės paraštės paieškai header'yje mobiliuose */
  .site-header .container { padding-left: 16px; padding-right: 16px; }
  /* Mygtukai lygiuojami gražiai į dvi kolonas arba stulpelį esant siauram ekranui */
  .filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}
label { font-weight: 600; color: var(--heading); font-size: 12px; opacity: .95; }

/* Facet bar (desktop inline) */
.facet-bar { display: grid; gap: 12px; grid-template-columns: repeat(12, 1fr); align-items: end; margin: 8px 0 16px; }
.facet-bar .filter-group { grid-column: span 2; }
.facet-bar .filter-group.year { grid-column: span 2; }
.facet-bar .filter-actions { grid-column: span 4; display: flex; gap: 8px; align-items: center; }
@media (max-width: 899px) { .facet-bar { display: none; } }

.only-mobile { display: inline-flex; align-items: center; gap: 8px; }
.only-desktop { display: none; }
@media (min-width: 900px) {
  .only-desktop { display: inline-flex; }
  .only-mobile { display: none !important; }
}
.input-select, .input-text {
  width: 100%;
  min-height: 44px; /* Mobile-friendly hit area */
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.02) inset;
}
.input-select:focus, .input-text:focus { border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(114,102,243,.15); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; font-weight: 700; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn-primary { background: var(--primary-600); color: #fff; }
.btn-primary:hover { background: var(--primary-700); }
.btn-secondary { background: #fff; color: var(--heading); border-color: var(--border); }
.btn-secondary:hover { background: #f9fafb; }
.btn-icon { background: transparent; color: var(--heading); font-size: 20px; padding: 6px 8px; border-radius: 8px; }
.btn-icon:hover { background: #f2f2f6; }

/* Header-specific button overrides for better contrast */
.site-header .btn-primary { background: #ffffff; color: var(--primary-600); box-shadow: var(--shadow); }
.site-header .btn-primary:hover { background: #f5f5ff; }
.site-header .btn-secondary { background: transparent; color: #ffffff; border-color: rgba(255,255,255,.65); }
.site-header .btn-secondary:hover { background: rgba(255,255,255,.12); }

/* Cards */
.product-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
@media (min-width: 1000px) {
  .product-grid > .card { grid-column: span 3; }
}
@media (min-width: 700px) and (max-width: 999px) {
  .product-grid > .card { grid-column: span 4; }
}
@media (max-width: 699px) {
  .product-grid > .card { grid-column: span 12; }
}
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:focus { outline: none; box-shadow: 0 0 0 3px rgba(114,102,243,.25) inset; }
.card-media { position: relative; aspect-ratio: 4/3; background: #f3f4f6; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.card-title { margin: 0; color: var(--heading); font-size: 16px; line-height: 1.35; }
@media (max-width: 900px){ .card-title { font-size: 15px; } }
.page-title { font-size: 26px; }
@media (max-width: 900px){ .page-title { font-size: 22px; } }
.section-title { font-size: 20px; }
@media (max-width: 900px){ .section-title { font-size: 18px; } }
.card-meta { font-size: 12px; color: var(--muted); }
.price-row { display: flex; align-items: center; gap: 8px; }
.price { font-weight: 700; color: var(--heading); }
.price-old { color: var(--muted); text-decoration: line-through; }
.price-sale { color: var(--primary-600); font-weight: 800; }
.oem-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.oem-chip { display: inline-flex; align-items: center; gap: 6px; background: #f3f4f6; color: var(--heading); border: 1px solid var(--border); padding: 4px 8px; border-radius: 999px; font-size: 12px; text-decoration: none; }
.oem-chip:hover { background: #e5e7eb; }
.oem-chip.primary { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.card-actions { margin-top: 8px; display: flex; gap: 8px; }

.empty-state { text-align: center; color: var(--muted); padding: 24px 0; }
.pagination { display: flex; justify-content: center; margin-top: 16px; }
.pager { display: inline-flex; gap: 8px; }
.page-link { display: inline-block; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); color: var(--heading); text-decoration: none; }
.page-link.is-active { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); }
.modal { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(100%, 980px); max-height: calc(100dvh - 24px); background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.modal-title { margin: 0; font-size: 18px; color: var(--heading); }
.modal-body { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; padding: 14px; }
@media (max-width: 900px) {
  .modal-body { grid-template-columns: 1fr; padding: 12px; }
}
.modal-media { display: flex; flex-direction: column; gap: 8px; }
.modal-media img { width: 100%; height: 420px; object-fit: contain; background: #f3f4f6; border: 1px solid var(--border); border-radius: 12px; }
@media (max-width: 900px){ .modal-media img { height: 320px; } }
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.thumbs img { width: 100%; height: 64px; object-fit: cover; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
@media (max-width: 900px){ .thumbs { grid-template-columns: repeat(5, 1fr); } .thumbs img { height: 52px; } }

/* Header paieškos aukštis mobiliuose */
@media (max-width: 900px){
  .site-header .filter-row { gap: 8px; }
  .site-header .input-text[type="search"] { min-height: 44px; }
}
.attrs { width: 100%; border-collapse: collapse; margin-top: 12px; }
.attrs td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.attrs td:nth-child(1) { color: var(--muted); width: 40%; }

/* OEM page */
.oem-head { display: flex; align-items: end; gap: 16px; justify-content: space-between; }
.oem-actions { display: flex; gap: 8px; }
.input-oem { min-width: 220px; }
.offer-list { display: grid; gap: 10px; }
.offer-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.offer-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #f3f4f6; }
.offer-title { margin: 0; font-size: 14px; color: var(--heading); }
.offer-price { font-weight: 700; color: var(--heading); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); }
.fitment-table { width: 100%; border-collapse: collapse; }
.fitment-table th, .fitment-table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; }
.fitment-table thead th { background: #fafafa; color: var(--muted); font-weight: 600; }
.prose { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.faq-list details { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.faq-list details + details { margin-top: 8px; }
.related-oem { display: flex; flex-wrap: wrap; gap: 8px; }
.related-oem a { text-decoration: none; color: #fff; background: var(--primary-600); border: 1px solid var(--primary-600); padding: 6px 10px; border-radius: 999px; font-size: 12px; }
.related-oem a:hover { background: var(--primary-700); }
.related-oem .oem-chip--disabled { color: var(--muted); background: #f3f4f6; border: 1px solid var(--border); padding: 6px 10px; border-radius: 999px; font-size: 12px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* OEM mobile fixes */
@media (max-width: 900px) {
  /* H1 viršuje, paieška žemiau */
  .oem-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .oem-actions { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
  .input-oem { min-width: 0; width: 100%; }

  /* Offer kortelių išdėstymas: 2 kolonos, veiksmai į naują eilę */
  .offer-item { grid-template-columns: 80px 1fr; align-items: start; }
  .offer-thumb { width: 80px; height: 60px; }
  .offer-item > :nth-child(3) { grid-column: 1 / -1; justify-content: space-between; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  /* Paieškos mygtuką dėti į atskirą eilę siauriausiuose ekranuose */
  .oem-actions { grid-template-columns: 1fr; }
  .oem-actions .btn { width: 100%; }
}

/* Leisti turiniui elgtis suspaustai ir nelaužyti konteinerio pločio */
.offer-item > div { min-width: 0; }
.offer-title { overflow-wrap: anywhere; word-break: break-word; }

