:root {
  --bg: #000;
  --card: #1C1C1C;
  --card-border: #3A3A3A;
  --text: #FFF;
  --accent: #4A90E2;
  --g-zielony: #2ECC71;
  --g-bialy: #ECF0F1;
  --g-czerwony: #E74C3C;
  --g-niebieski: #3498DB;
  --g-zolty: #F1C40F;
  --g-fioletowy: #9B59B6;
  --g-brazowy: #A52A2A;
  --g-pomaranczowy: #E67E22;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  position: fixed;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
}

.tabs-header {
  display: flex;
  background: #111;
  border-bottom: 2px solid #333;
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 18px 5px !important;
  display: flex;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 19px !important;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tab span {
  font-size: 26px !important;
  margin-bottom: 0 !important;
  display: inline-block;
}

.tab-count {
  font-size: 16px !important;
  font-weight: 900;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 8px;
}

.tab.active {
  color: #fff;
  background: var(--card);
  box-shadow: inset 0 -8px 0 0 var(--accent);
}

#list-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 5px 20px;
  background: var(--card);
  border-radius: 15px;
  border-left: 12px solid var(--row-color, var(--card-border));
  min-height: 60px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  transition: all 0.3s ease;
  animation: slideIn 0.4s ease-out;
}

.row:has(input[type="checkbox"]:checked) {
  --row-color: #333 !important;
  opacity: 0.6;
  border-left-color: #333 !important;
}

.item-text {
  flex: 1;
  font-size: 28px;
  font-weight: 800;
  color: #eee;
  transition: all 0.3s ease;
}

.item-text.done {
  opacity: 0.3;
  text-decoration: line-through;
}

.item-qty {
  background: #333;
  color: var(--accent);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 24px;
  font-weight: 900;
  margin-right: 10px;
  min-width: 40px;
  text-align: center;
  border: 1px solid #444;
}

.section-header {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent);
  padding: 12px 5px 5px 5px;
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid #222;
  transition: all 0.3s ease;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  border: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}

input[type="checkbox"]:checked {
  background: var(--accent);
}

input[type="checkbox"]:checked::before {
  content: "✔";
  color: white;
  font-size: 30px;
}

#suggestions {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 15px;
  background: #111;
  border-top: 1px solid #333;
}

.sug-btn {
  font-size: 24px !important;
  padding: 16px 28px !important;
  margin: 7px !important;
  border-radius: 16px !important;
  font-weight: 900 !important;
  border: none;
  white-space: nowrap;
  color: #000;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
}

.footer {
  padding: 15px;
  background: #111;
  border-top: 2px solid #333;
}

.input-group {
  display: flex;
  gap: 10px;
}

#item-input {
  flex: 1;
  min-width: 0;
  padding: 15px;
  border-radius: 15px;
  border: 4px solid var(--accent);
  background: #000;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  outline: none;
  box-sizing: border-box;
  -webkit-user-select: text;
  user-select: text;
}

#add-btn {
  flex: 0 0 auto;
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0 25px;
  border-radius: 15px;
  font-size: 40px;
  font-weight: 900;
}

#quick-amounts-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 15px 0;
  width: 100%;
}

/* TWOJE ORYGINALNE RZĘDY - NIENARUSZONE */
.quantity-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.quantity-btn {
  border: none;
  padding: 14px 22px;
  min-width: 70px;
  border-radius: 12px;
  color: white;
  font-weight: 900;
  font-size: 20px !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  text-transform: uppercase;
}

.quantity-btn:active {
  transform: scale(0.9);
  filter: brightness(1.2);
}

.other-btn {
  border: 2px dashed #888 !important;
  opacity: 0.9;
  font-size: 20px !important;
  padding: 14px 22px !important;
  min-width: 100px !important;
}

/* TYLKO DLA PRODUKTÓW SPOZA LISTY - SIATKA 3 KOLUMNY */
#quick-amounts-container.units-grid-layout {
  display: grid !important;
  /* Trzy równe kolumny, których nic nie rozciągnie */
  grid-template-columns: repeat(3, 1fr) !important; 
  grid-template-rows: repeat(2, 65px) !important; /* Sztywna wysokość rzędów */
  gap: 10px !important;
  padding: 10px !important;
  /* Blokuje rozszerzanie się kontenera w bok */
  width: 100% !important; 
  box-sizing: border-box !important;
}

#quick-amounts-container.units-grid-layout .quantity-row {
  display: contents !important; 
}

/* Ukrywamy przycisk, gdy pojawia się input (dodatkowe zabezpieczenie CSS) */
#quick-amounts-container.units-grid-layout .quantity-row:has(.temp-input) .other-btn {
  display: none !important;
}

/* Styl dla inputa - musi idealnie pasować do dziury po przycisku */
#quick-amounts-container.units-grid-layout .temp-input {
  grid-column: auto !important; 
  width: 100% !important;
  height: 65px !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 22px !important;
  text-align: center;
  background: #000 !important;
  color: #fff !important;
  border: 3px solid var(--accent) !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
}




.code-button {
  width: 100%;
  background: #222;
  border: 2px solid #444;
  color: white;
  padding: 25px 20px;
  font-size: 32px;
  font-weight: 900;
  text-align: left;
  border-radius: 25px;
  margin-bottom: 15px;
  text-transform: uppercase;
}

#card-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
}

#card-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.clear-btn {
  width: 100%;
  background: #96281B;
  color: white;
  padding: 15px;
  font-size: 24px;
  font-weight: 900;
  border-radius: 10px;
  border: none;
  margin-bottom: 10px;
}

#undo-toast {
  position: fixed;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  background: #444;
  color: #fff;
  padding: 20px 40px;
  border-radius: 50px;
  font-size: 30px;
  font-weight: bold;
  display: none;
  z-index: 2000;
  border: 2px solid var(--accent);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* pasek postępu zakupów */

#progress-container {
    width: 100%;
    height: 4px;           /* Zmniejszona grubość paska */
    background: #111;      /* Bardzo ciemne tło (prawie czarne) */
    position: sticky;
    top: 0;
    z-index: 2000;
    opacity: 0;            /* Niewidoczny, ale rezerwuje miejsce u góry */
    transition: opacity 0.3s ease;
    /* Usunąłem border-bottom, żeby pasek był "lżejszy" wizualnie */
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease, background 0.3s ease;
    /* Delikatna poświata dla lepszej widoczności cienkiego paska */
    box-shadow: 0 0 5px var(--accent); 
}

/* Blokada gestów systemowych */

body {
    /* Zapobiega odświeżaniu strony przez pociągnięcie w dół (Pull-to-refresh) */
    /* Pozwala to uniknąć przeładowania aplikacji w sklepie */
    overscroll-behavior-y: contain;
    
    /* Zapobiega gestom nawigacyjnym "wstecz/dalej" przy krawędziach */
    overscroll-behavior-x: none;
}

#card-overlay {
    /* Upewnij się, że overlay blokuje interakcje pod spodem */
    touch-action: none;
}

/* Kontener dla menu wysuwanego */

/* Tło (szklany panel) za wysuwanymi przyciskami */
/* 1. Kontener menu */
.fab-container {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    position: relative;
}

/* 2. Szklany panel z opcjami (Koperta, Odśwież, Bomba) */
.fab-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: absolute;
    bottom: 0;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    
    /* Efekt szkła (Blur) */
    padding: 20px 10px;
    background: rgba(0, 0, 0, 0.6); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 3. Wspólny wygląd wszystkich przycisków (Hamburger i Opcje) */
.fab-options button, #menu-toggle {
    width: 70px !important;
    height: 70px !important;
    min-width: 70px !important;
    border-radius: 15px !important;
    font-size: 40px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    cursor: pointer;
    color: white;
    box-sizing: border-box;
    padding: 0 !important;
    background: #333 !important; /* Przywrócony kolor kłódki */
}

/* 4. Wyjątek dla bomby (Hard Reset) - musi być czerwona */
.fab-options button[onclick*="hardReset"] {
    background: var(--g-czerwony) !important;
}

/* 5. Stan po otwarciu menu */
.fab-container.active .fab-options {
    bottom: 90px; /* Wysunięcie nad hamburgera */
    opacity: 1;
    pointer-events: auto;
}

/* Opcjonalnie: Zmiana koloru hamburgera na akcent po otwarciu */
.fab-container.active #menu-toggle {
    background: var(--accent) !important;
    transform: rotate(90deg);
}

/* kolor żarówki */

#wakelock-btn {
    background: #333 !important;
}

/* style dla funkcji zoom */

/* Tryb Mały (S) */
body.zoom-s .item-text { font-size: 20px !important; }
body.zoom-s .item-qty { font-size: 18px !important; padding: 3px 10px; }
body.zoom-s .row { min-height: 50px; padding: 3px 15px; }

/* Tryb Standardowy (M) - to Twój obecny styl, nie wymaga zmian, ale tu go definujemy */
body.zoom-m .item-text { font-size: 28px; }

/* Tryb Duży (L) */
body.zoom-l .item-text { font-size: 38px !important; font-weight: 900; }
body.zoom-l .item-qty { font-size: 30px !important; padding: 8px 20px; }
body.zoom-l .row { min-height: 80px; padding: 10px 25px; }

/* Tryb zoom na wyswietlających się powiadomien typu: skopiowano



/* Styl bazowy dla Twoich ikon (koła) */
.fab-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #333;
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    
    /* STAN POCZĄTKOWY - niewidoczne, rozmyte i małe */
    opacity: 0;
    filter: blur(10px);
    transform: scale(0.5);
    transition: all 0.4s ease-out;
    visibility: hidden;
}

/* Gdy menu jest OTWARTE */
#fab-menu.active .fab-item {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
    visibility: visible;
}

/* animacja znikania przycisków w hamburgerze */

/* 1. Resetujemy widoczność wszystkich przycisków wewnątrz panelu */
#fab-menu .fab-options button {
    opacity: 0 !important;
    visibility: hidden !important;
    filter: blur(10px) !important;
    transform: scale(0.5) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* 2. Pokazujemy je po otwarciu */
#fab-menu.active .fab-options button {
    opacity: 1 !important;
    visibility: visible !important;
    filter: blur(0) !important;
    transform: scale(1) !important;
}

/* 3. KASKADA (Odliczanie od dołu) */
/* Używamy selektora 'button', żeby mieć pewność, że złapie wszystkie 6 ikon */
#fab-menu.active .fab-options button:nth-last-child(1) { transition-delay: 0.05s !important; }
#fab-menu.active .fab-options button:nth-last-child(2) { transition-delay: 0.10s !important; }
#fab-menu.active .fab-options button:nth-last-child(3) { transition-delay: 0.15s !important; }
#fab-menu.active .fab-options button:nth-last-child(4) { transition-delay: 0.20s !important; }
#fab-menu.active .fab-options button:nth-last-child(5) { transition-delay: 0.25s !important; }
#fab-menu.active .fab-options button:nth-last-child(6) { transition-delay: 0.30s !important; }


