﻿/* ================================
   BACKBAR.CSS (FINAL CLEAN)
   Compatibile con il tuo JS:
   - .wrap
   - .fridgeShell / .fridgeInner
   - .shelfCard / .shelfHeader / .shelfGrid
   - .tile / .tileImg / .tileName / .tileQty
   - .modalOverlay / .modalSheet ...
   - .fixedBottomBar / .fixedBtn
   ================================ */

:root {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color-scheme: dark;
    --pink: rgb(100, 0, 48);
    --pink-border: rgba(255,79,163,0.35);
    --pink-border-strong: rgba(255,79,163,0.65);
    --text: #ffffff;
    --muted: rgba(255,255,255,0.65);
    --bg: #0b0d12;
    --glass: rgba(255,255,255,0.06);
    --glass2: rgba(255,79,163,0.08);
    --panel: rgba(0,0,0,0.18);
    --panel2: rgba(0,0,0,0.30);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: radial-gradient(1000px 700px at 15% -10%, rgba(255,79,163,0.35), transparent 60%), radial-gradient(1000px 700px at 100% 0%, rgba(255,20,147,0.25), transparent 55%), linear-gradient(180deg, var(--bg), var(--bg));
    color: var(--text);
}

/* layout */
.wrap {
    max-width: 980px;
    margin: 0 auto;
    padding: 14px;
    padding-bottom: 120px; /* ✅ spazio per bottom bar */
}

/* evita zoom fastidioso su mobile quando tappano rapido */
.step,
.fixedBtn,
.tile,
.iconBtn {
    touch-action: manipulation;
}

/* ============ TOP ============ */
.top {
    margin-bottom: 10px;
}

.topRow {
    display: grid;
    gap: 10px;
}

.topTitle {
    text-align: center;
    line-height: 1.05;
}

.topTitleA {
    font-weight: 1000;
    letter-spacing: 0.8px;
}

.topTitleB {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    font-weight: 800;
}

.topActionsRow {
    display: flex;
    justify-content: center;
}

/* buttons */
.btn {
    height: 42px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid var(--pink-border);
    background: linear-gradient(180deg, rgba(255,79,163,0.35), rgba(255,79,163,0.15));
    color: var(--text);
    cursor: pointer;
    font-weight: 900;
    letter-spacing: 1px;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

    .btn:hover {
        background: linear-gradient(180deg, rgba(255,79,163,0.55), rgba(255,79,163,0.25));
    }

    .btn.ghost {
        background: rgba(0,0,0,0.18);
    }

    .btn.primary {
        background: linear-gradient(180deg, rgba(255,79,163,0.92), rgba(255,45,149,0.75));
        border-color: var(--pink-border-strong);
        box-shadow: 0 16px 40px rgba(255,79,163,0.45);
    }

        .btn.primary:hover {
            transform: translateY(-1px) scale(1.02);
            box-shadow: 0 22px 50px rgba(255,79,163,0.60);
        }

/* ============ FRIDGE SHELL ============ */
.fridgeShell {
    margin-top: 14px;
    border-radius: 34px;
    border: 1px solid rgba(255,79,163,0.35);
    background: linear-gradient(180deg, var(--glass), var(--glass2));
    box-shadow: 0 26px 80px rgba(0,0,0,0.45), 0 18px 50px rgba(255,79,163,0.18);
    position: relative;
    overflow: hidden;
}

    .fridgeShell::after {
        content: "";
        position: absolute;
        right: 14px;
        top: 22px;
        width: 10px;
        height: 120px;
        border-radius: 10px;
        background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(0,0,0,0.18));
        border: 1px solid rgba(255,255,255,0.08);
        opacity: 0.8;
    }

.fridgeInner {
    padding: 12px 12px 14px;
    display: grid;
    gap: 12px;
}

/* ============ SHELF (AREA) ============ */
.shelfCard {
    border-radius: 22px;
    border: 1px solid rgba(255,79,163,0.26);
    background: rgba(0,0,0,0.14);
    padding: 10px;
}

.shelfHeader {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.shelfTitle {
    font-weight: 1000;
    font-size: 13px;
    color: rgba(255,255,255,0.88);
}

.shelfHint {
    font-size: 12px;
    color: rgba(255,255,255,0.50);
    font-weight: 800;
}

/* ============ GRID ============ */
.shelfGrid {
    --cols: 6;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: 6px;
}

@media (min-width: 520px) {
    .shelfGrid {
        --cols: 8;
    }
}

@media (min-width: 920px) {
    .shelfGrid {
        --cols: 12;
    }
}

/* ============ TILE ============ */
.tile {
    position: relative;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 112px;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 150ms ease, box-shadow 150ms ease, min-height 180ms ease;
}

    .tile.on {
        box-shadow: 0 10px 22px rgba(255,79,163,0.18);
    }

    .tile:hover {
        transform: translateY(-1px);
        box-shadow: 0 18px 40px rgba(255,79,163,0.22);
    }

/* ✅ IMPORTANT: z-index per NON far finire la qty dietro */
.tileImg {
    position: relative; /* ✅ */
    z-index: 1; /* ✅ immagine sotto al badge */
    width: 100%;
    height: 100%;
    max-height: 88px;
    display: block;
    object-fit: contain;
    transform: scale(1.06);
    filter: drop-shadow(0 14px 18px rgba(0,0,0,0.35));
    user-select: none;
    -webkit-user-drag: none;
}

.tileName {
    margin-top: 2px;
    padding: 0 2px 6px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.1;
    color: rgba(255,255,255,0.85);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

@media (min-width: 420px) {
    .tileName {
        font-size: 11px;
    }
}

/* ✅ badge sopra bottiglia + più leggibile */
.tileQty {
    position: absolute;
    right: 6px;
    bottom: 22px;
    z-index: 10; /* ✅ sopra bottiglia */

    min-width: 26px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid rgba(255,79,163,0.55);
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 1000;
    font-size: 12px;
    color: #fff;
    box-shadow: 0 10px 22px rgba(0,0,0,0.35);
}

/* ============ MODAL ============ */
.modalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    z-index: 9998;
    padding: 14px;
}

.modalSheet {
    width: min(560px, 100%);
    border-radius: 26px;
    border: 1px solid rgba(255,79,163,0.35);
    background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,79,163,0.10));
    box-shadow: 0 26px 90px rgba(0,0,0,0.55);
    padding: 14px;
    animation: sheetPop 180ms ease-out;
}

@keyframes sheetPop {
    from {
        transform: translateY(14px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modalTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.iconBtn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    border: 1px solid rgba(255,79,163,0.35);
    background: rgba(0,0,0,0.18);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    font-weight: 1000;
    font-size: 18px;
}

    .iconBtn:hover {
        background: rgba(0,0,0,0.28);
    }

.modalThumb {
    margin: 12px auto 6px;
    height: 140px;
    width: 100%;
    max-width: 260px;
    border-radius: 20px;
    border: 1px solid rgba(255,79,163,0.22);
    background: rgba(0,0,0,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modalThumbImg {
    max-height: 120px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform: none;
    filter: drop-shadow(0 14px 18px rgba(0,0,0,0.35));
    user-select: none;
    -webkit-user-drag: none;
}

.modalControls {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 12px;
    align-items: center;
}

.step {
    height: 62px;
    border-radius: 22px;
    border: 1px solid var(--pink-border);
    background: linear-gradient(180deg, rgba(255,79,163,0.45), rgba(255,20,147,0.25));
    color: #fff;
    font-size: 28px;
    font-weight: 1000;
    cursor: pointer;
    transition: transform 140ms ease, background 140ms ease;
}

    .step:hover {
        background: linear-gradient(180deg, rgba(255,79,163,0.65), rgba(255,20,147,0.35));
        transform: translateY(-1px);
    }

.qtyInput {
    height: 62px;
    border-radius: 22px;
    border: 1px solid rgba(255,79,163,0.45);
    background: rgba(0,0,0,0.25);
    color: var(--text);
    font-size: 22px;
    font-weight: 1000;
    text-align: center;
    outline: none;
}

    .qtyInput:focus {
        border-color: rgba(255,79,163,0.75);
        box-shadow: 0 0 0 4px rgba(255,79,163,0.18);
    }

/* ============ FIXED BOTTOM BAR (✅ colore premium) ============ */
.fixedBottomBar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9997;

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));

  background:
    linear-gradient(
      180deg,
      rgba(8,10,14,0.00) 0%,
      rgba(8,10,14,0.55) 35%,
      rgba(8,10,14,0.88) 100%
    );

  border-top: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
}



.fixedBtn {
    height: 64px;
    border-radius: 22px;
    font-size: 18px;
    font-weight: 1000;
    letter-spacing: 0.6px;
    border: 1px solid rgba(255,79,163,0.35);
    background: rgba(0,0,0,0.22);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

    .fixedBtn:hover {
        background: rgba(255,79,163,0.10);
    }

    .fixedBtn.primary {
        background: linear-gradient(180deg, rgba(255,79,163,0.92), rgba(255,45,149,0.75));
        border-color: var(--pink-border-strong);
        box-shadow: 0 16px 40px rgba(255,79,163,0.45);
    }
