:root {
    --bg: #f4f5f7;
    --card: #fff;
    --ink: #1c2330;
    --muted: #6b7280;
    --line: #e5e7eb;
    --brand: #1769ff;
    --brand-d: #0f53d6;
    --price: #0a7d32;
    --star: #f5a623;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.45;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Fejléc */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { font-size: 22px; font-weight: 800; text-decoration: none; color: var(--ink); white-space: nowrap; }
.logo span { color: var(--brand); }

.search { display: flex; flex: 1; max-width: 640px; }
.search input {
    flex: 1; padding: 10px 14px; font-size: 16px;
    border: 1px solid var(--line); border-right: 0;
    border-radius: 8px 0 0 8px; outline: none;
}
.search input:focus { border-color: var(--brand); }
.search button {
    padding: 0 20px; font-size: 15px; font-weight: 600;
    color: #fff; background: var(--brand); border: 0;
    border-radius: 0 8px 8px 0; cursor: pointer;
}
.search button:hover { background: var(--brand-d); }
.dbinfo { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Értesítések */
.notice {
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    padding: 20px; margin: 24px 0; box-shadow: var(--shadow);
}
.notice.error { border-color: #fca5a5; background: #fef2f2; }
.notice pre {
    background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 8px;
    overflow: auto; font-size: 13px;
}

/* Szűrők */
.filters {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: end;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    padding: 14px 16px; margin: 20px 0; box-shadow: var(--shadow);
}
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.filters select, .filters input {
    padding: 8px 10px; font-size: 14px; border: 1px solid var(--line);
    border-radius: 7px; color: var(--ink); background: #fff; min-width: 120px;
}
.filters input[type=number] { width: 110px; min-width: 0; }
.filters button {
    padding: 9px 18px; font-weight: 600; color: #fff; background: var(--brand);
    border: 0; border-radius: 7px; cursor: pointer;
}
.filters button:hover { background: var(--brand-d); }

.resultcount { color: var(--muted); font-size: 14px; margin: 8px 2px 16px; }

/* Termékrács */
.grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 6px 18px rgba(16, 24, 40, .12); transform: translateY(-2px); }

.thumb {
    position: relative; display: block; aspect-ratio: 1/1; background: #fff;
    display: flex; align-items: center; justify-content: center; padding: 12px;
}
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb img.broken { display: none; }
.noimg { color: var(--muted); font-size: 13px; }
.imgcount {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(15, 23, 42, .72); color: #fff; font-size: 11px;
    padding: 2px 7px; border-radius: 20px;
}

.gallery { display: flex; gap: 4px; padding: 0 10px 8px; overflow-x: auto; }
.gallery img {
    width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto;
    border: 1px solid var(--line); border-radius: 6px; padding: 2px; cursor: pointer; background:#fff;
}
.gallery img.active { border-color: var(--brand); }

.body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.brand { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.name { font-size: 14px; font-weight: 600; margin: 0; line-height: 1.35; }
.name a { color: var(--ink); text-decoration: none; }
.name a:hover { color: var(--brand); }

.rating { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.stars {
    --pct: 0%;
    width: 78px; height: 14px; flex: 0 0 auto;
    background:
        linear-gradient(90deg, var(--star) var(--pct), #d6d9e0 var(--pct));
    -webkit-mask: repeating-linear-gradient(90deg,
        #000 0 13px, transparent 13px 15.6px);
    mask: repeating-linear-gradient(90deg, #000 0 13px, transparent 13px 15.6px);
}
.price { font-size: 17px; font-weight: 800; color: var(--price); margin-top: auto; }
.cat { font-size: 12px; color: var(--muted); }

/* Lapozó */
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 28px 0; }
.pager a {
    padding: 8px 16px; background: var(--card); border: 1px solid var(--line);
    border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600;
}
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .cur { color: var(--muted); font-size: 14px; }

.foot { color: var(--muted); font-size: 13px; padding: 30px 16px; text-align: center; }

/* ---- Részletes termékoldal ---- */
.crumbs { font-size: 13px; color: var(--muted); margin: 18px 2px; }
.crumbs a { color: var(--brand); text-decoration: none; font-weight: 600; }
.crumbs span { margin: 0 6px; }

.detail {
    display: grid; grid-template-columns: minmax(280px, 460px) 1fr; gap: 32px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 24px; box-shadow: var(--shadow);
}
.detail-gallery .main-image {
    aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff;
}
.detail-gallery .main-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.detail-gallery .main-image img.broken { display: none; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.thumbs img {
    width: 56px; height: 56px; object-fit: contain; padding: 4px; background: #fff;
    border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.thumbs img.active, .thumbs img:hover { border-color: var(--brand); }

.detail-info h1 { font-size: 24px; margin: 4px 0 12px; line-height: 1.25; }
.detail-info .brand { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.detail-price { font-size: 28px; font-weight: 800; color: var(--price); margin: 16px 0; }
.detail-price span { color: var(--muted); font-weight: 400; }

.specs { width: 100%; border-collapse: collapse; margin-top: 12px; }
.specs th, .specs td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.specs th { color: var(--muted); font-weight: 600; width: 38%; white-space: nowrap; }

.description {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 24px; margin: 20px 0; box-shadow: var(--shadow);
}
.description h2 { font-size: 18px; margin: 0 0 12px; }

/* A termékleírás megőrzött, fertőtlenített HTML-je */
.desc-html { color: #2b3444; line-height: 1.6; font-size: 14px; overflow-wrap: break-word; }
.desc-html img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.desc-html p { margin: 0 0 10px; }
.desc-html h1, .desc-html h2, .desc-html h3, .desc-html h4 { margin: 16px 0 8px; line-height: 1.3; font-size: 16px; }
.desc-html ul, .desc-html ol { margin: 8px 0 12px 22px; }
.desc-html li { margin: 3px 0; }
.desc-html table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.desc-html th, .desc-html td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.desc-html a { color: var(--brand); }
.desc-html b, .desc-html strong { font-weight: 700; }
.desc-html [data-ico] { font-weight: 700; }
.desc-html [data-ico="yes"] { color: var(--price); }
.desc-html [data-ico="no"] { color: #c0392b; }

@media (max-width: 760px) {
    .detail { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 640px) {
    .topbar .wrap { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
    .dbinfo { order: 3; width: 100%; }
}
