:root {
    --m-dark: #1d2b4f;
    --m-accent: #a259ff;
    --m-blue: #1cb5e0;
    --m-green: #59b43f;
    --m-amber: #ffb020;
    --m-border: #f1f4f8;
    --m-muted: #7c8494;
    --m-bg: #0b0f1a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overscroll-behavior-y: none;
}

body {
    font-family: 'Montserrat', Arial, sans-serif;
    background: var(--m-bg);
    color: #fff;
}

#app {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

a { color: inherit; }

/* ---------------- FEED (glowny, jeden produkt na ekran) ---------------- */

.feed {
    height: 100dvh;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.feed::-webkit-scrollbar { display: none; }

.slide {
    height: 100dvh;
    height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0f1a;
}

.slide-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.slide-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 20px 96px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 45%, transparent 100%);
    pointer-events: none;
}

.slide-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.slide-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.slide-badge.has-offer { background: linear-gradient(90deg, var(--m-blue) 0%, var(--m-accent) 100%); color: #fff; }
.slide-badge.no-offer { background: rgba(255,255,255,0.15); color: #fff; }
.slide-badge.rating { background: rgba(255,255,255,0.15); color: #fff; }

.slide-title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.feed-loading, .feed-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
}

.slide-sentinel {
    height: 1px;
}

/* ---------------- WSKAZOWKI SWIPE (delikatne strzalki na krawedziach) ---------------- */

.swipe-hint {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.35);
    font-size: 26px;
    z-index: 50;
    pointer-events: none;
}

.swipe-hint-left { left: 6px; }
.swipe-hint-right { right: 6px; }

/* ---------------- DOLNY PASEK 5 PRZYCISKOW ---------------- */

.bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    background: rgba(11, 15, 26, 0.88);
    backdrop-filter: blur(10px);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

.bb-btn {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
}

.bb-btn.is-active { color: #fff; }
.bb-icon { font-size: 19px; }

/* ---------------- BOTTOM SHEET ---------------- */

.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sheet-overlay.is-open { opacity: 1; pointer-events: auto; }

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 151;
    background: #fff;
    color: var(--m-dark);
    border-radius: 20px 20px 0 0;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(.2,.9,.3,1);
    padding-bottom: env(safe-area-inset-bottom);
}

.sheet.is-open { transform: translateY(0); }

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--m-border);
    border-radius: 3px;
    margin: 10px auto 4px;
}

.sheet-title {
    font-size: 15px;
    font-weight: 800;
    padding: 4px 20px 12px;
    border-bottom: 1px solid var(--m-border);
}

.sheet-content {
    padding: 14px 20px 26px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
}

/* ---------------- SIDE PANELE (porownywarka / kategorie) ---------------- */

.side-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 84%;
    max-width: 360px;
    background: #fff;
    color: var(--m-dark);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.panel-compare {
    left: 0;
    transform: translateX(-100%);
    border-radius: 0 20px 20px 0;
}

.panel-compare.is-open { transform: translateX(0); }

.panel-categories {
    right: 0;
    transform: translateX(100%);
    border-radius: 20px 0 0 20px;
}

.panel-categories.is-open { transform: translateX(0); }

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.panel-overlay.is-open { opacity: 1; pointer-events: auto; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--m-border);
    flex-shrink: 0;
    padding-top: calc(18px + env(safe-area-inset-top));
}

.panel-head h2 { font-size: 16px; font-weight: 800; margin: 0; }

.panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--m-border);
    color: var(--m-dark);
    font-size: 18px;
    line-height: 1;
}

.panel-body {
    padding: 16px 18px 30px;
    overflow-y: auto;
    flex: 1;
}

.dim { color: var(--m-muted); font-size: 13px; }

/* -- panel porownywarki -- */

.btn-add-compare {
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(90deg, var(--m-blue) 0%, var(--m-accent) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 16px;
}

.btn-add-compare.is-selected {
    background: var(--m-border);
    color: var(--m-dark);
}

.compare-panel-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.compare-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--m-border);
    border-radius: 10px;
    padding: 8px 10px;
}

.compare-panel-item img { width: 42px; height: 42px; border-radius: 8px; object-fit: contain; background: #fff; flex-shrink: 0; }
.compare-panel-item-title { font-size: 12px; font-weight: 700; flex: 1; line-height: 1.3; }
.compare-panel-item-remove { background: none; border: none; color: #c64b4b; font-size: 16px; font-weight: 800; padding: 4px 6px; }

.btn-do-compare {
    display: block;
    text-align: center;
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    background: var(--m-dark);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    text-decoration: none;
}

.btn-do-compare.is-disabled { opacity: 0.4; pointer-events: none; }

/* -- panel kategorii -- */

.panel-search-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--m-border);
    background: var(--m-border);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 12px;
}

.panel-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
}

.panel-search-item img { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: var(--m-border); flex-shrink: 0; }
.panel-search-item-title { font-size: 12px; font-weight: 700; }

.cat-group { margin-bottom: 16px; }

.cat-group-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--m-dark);
    margin: 0 0 6px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--m-border);
}

.cat-child-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--m-dark);
}

.cat-child-link img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; background: var(--m-border); flex-shrink: 0; }

.btn-switch-desktop {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 12px;
    border-radius: 10px;
    background: var(--m-border);
    color: var(--m-dark);
    font-weight: 700;
    font-size: 12px;
    text-decoration: none;
}

/* ---------------- TRESC W SHEET (oferty/specs/opis/oceny/opinie) ---------------- */

.sh-offer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--m-border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.sh-offer-shop { font-weight: 700; font-size: 13px; }
.sh-offer-price { font-weight: 800; font-size: 14px; }
.sh-offer-link { background: var(--m-dark); color: #fff; font-size: 11px; font-weight: 800; padding: 8px 14px; border-radius: 8px; text-decoration: none; }

.sh-spec-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--m-border);
}

.sh-spec-row span:first-child { color: var(--m-muted); font-weight: 600; }
.sh-spec-row span:last-child { font-weight: 700; text-align: right; }

.sh-rate-row { margin-bottom: 14px; }
.sh-rate-row-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.sh-rate-bar-bg { height: 7px; background: var(--m-border); border-radius: 4px; overflow: hidden; }
.sh-rate-bar-fill { height: 100%; background: linear-gradient(90deg, var(--m-blue) 0%, var(--m-accent) 100%); }

.sh-opinion {
    background: var(--m-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.sh-opinion-tag {
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--m-accent);
    background: #f4eeff;
    padding: 2px 8px;
    border-radius: 12px;
}

.sh-empty { color: var(--m-muted); text-align: center; padding: 20px 0; }
