/* ==========================================================================
   SKLEPOWA TRASA - ULTRANOVOCZESNY MATERIAL 3 / iOS 18 GLASSMORPHISM THEME
   Stylistyka klasy Premium: fluidne animacje, miękkie cienie, responsywny UX
   ========================================================================== */

/* Czcionka NIE jest importowana tutaj: @import blokuje renderowanie i w sklepie bez zasięgu
   aplikacja czekała na nieudane połączenie z fonts.googleapis.com.
   Krój ładowany jest nieblokująco w index.html, a poniższy stos systemowy jest pełnowartościowy. */

:root {
  /* Paleta barw - Jasny motyw (Clean Vibrant Luxe) */
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  
  --bg-app: #F6F8FA;
  --bg-surface: #FFFFFF;
  --bg-surface-translucent: rgba(255, 255, 255, 0.85);
  --bg-surface-glass: rgba(255, 255, 255, 0.96);
  --bg-card: #FFFFFF;
  --bg-subtle: #EEF2F6;
  --bg-input: #F1F5F9;

  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dimmed: #94A3B8;
  --text-white: #FFFFFF;

  /* Akcenty główne */
  --primary: #10B981;
  --primary-dark: #059669;
  --primary-light: #D1FAE5;
  --primary-glow: rgba(16, 185, 129, 0.35);

  --accent-gradient: linear-gradient(135deg, #10B981 0%, #059669 50%, #047857 100%);
  --fab-gradient: linear-gradient(135deg, #10B981 0%, #0EA5E9 100%);
  --sparkle-gradient: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);

  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --info: #0EA5E9;

  --border: #E2E8F0;
  --border-subtle: rgba(226, 232, 240, 0.8);
  --divider: #F1F5F9;

  /* Cienie głębi */
  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-hover: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  --shadow-fab: 0 10px 25px rgba(16, 185, 129, 0.4);

  /* Zaokrąglenia */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  /* Safe Area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock-h: 130px;   /* nadpisywane z JS realną wysokością dolnego paska */
}

[data-theme="dark"] {
  --bg-app: #0B0F17;
  --bg-surface: #131A26;
  --bg-surface-translucent: rgba(19, 26, 38, 0.85);
  --bg-surface-glass: rgba(19, 26, 38, 0.96);
  --bg-card: #18202F;
  --bg-subtle: #1F293D;
  --bg-input: #1C2436;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dimmed: #64748B;
  --text-white: #FFFFFF;

  --primary: #34D399;
  --primary-dark: #10B981;
  --primary-light: rgba(52, 211, 153, 0.15);
  --primary-glow: rgba(52, 211, 153, 0.25);

  --border: #243044;
  --border-subtle: rgba(36, 48, 68, 0.8);
  --divider: #1E293B;

  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  --shadow-fab: 0 10px 25px rgba(52, 211, 153, 0.3);
}

/* ==========================================================================
   Reset & Podstawa
   ========================================================================== */

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

input, textarea, select, [contenteditable] {
  user-select: text !important;
  -webkit-user-select: text !important;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  user-select: none;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--dock-h, 130px) + var(--safe-bottom));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Górny pasek (Header) z efektem Glassmorphism
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface-translucent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 18px 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-subtle);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}

.icon-btn-danger:hover, .icon-btn-danger:active {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

/* Pasek wyboru sklepu (Chips Carousel) */
.store-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.store-selector-bar::-webkit-scrollbar {
  display: none;
}

.store-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.store-chip:hover {
  transform: translateY(-1px);
  border-color: var(--text-dimmed);
}

.store-chip.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: scale(1.02);
}

.store-chip-btn {
  background: var(--bg-surface);
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.store-chip-btn:hover {
  background: var(--primary-light);
}

/* Wskaźnik postępu (Segmented Progress) */
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-track {
  height: 6px;
  width: 100%;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
}

.progress-pill-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ==========================================================================
   Pasek Okazji i Promocji Tygodnia (Deals Widget)
   ========================================================================== */

.promo-banner-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.promo-header-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  color: #DC2626;
  user-select: none;
  transition: all 0.2s ease;
}

[data-theme="dark"] .promo-header-toggle {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.promo-deals-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.promo-deals-carousel::-webkit-scrollbar {
  display: none;
}

.promo-deal-card {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s ease;
}

.promo-deal-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.promo-deal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.promo-badge-tag {
  font-size: 0.7rem;
  font-weight: 800;
  background: #FEE2E2;
  color: #DC2626;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.promo-deal-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.promo-deal-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.promo-deal-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: #16A34A;
}

.btn-add-promo {
  background: var(--primary);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-add-promo:active {
  transform: scale(0.92);
}

/* ==========================================================================
   Główny kontener
   ========================================================================== */

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

/* Nowoczesny stan pusty */
.empty-state {
  text-align: center;
  padding: 36px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-illustration-wrap {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 10px 25px var(--primary-glow);
  animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.empty-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
}

.quick-action-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  margin-top: 8px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.action-card:active {
  transform: scale(0.97);
}

/* Karta Hero (Główna - Skanowanie aparatem) */
.action-card-hero {
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-subtle) 100%);
  border: 2px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.12);
}

.action-card-hero:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.22);
  transform: translateY(-2px);
}

.action-card-hero-glow {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%);
  color: #0284C7;
  font-size: 1.7rem;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.action-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-card-title {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.2px;
}

.action-card-badge {
  font-size: 0.68rem;
  font-weight: 800;
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.action-card-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.3;
}

.action-card-arrow {
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.action-card-hero:hover .action-card-arrow {
  transform: translateX(4px);
}

/* Siatka 2 kart kompaktowych */
.action-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-card-compact {
  padding: 14px 16px;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.action-card-compact:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.compact-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-card-compact .action-card-title {
  font-size: 0.925rem;
}

/* ==========================================================================
   Grupy Alejek i Produkty
   ========================================================================== */

.aisle-group {
  margin-bottom: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all 0.2s ease;
}

.aisle-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--divider);
}

.aisle-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aisle-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: var(--shadow-subtle);
}

.aisle-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.aisle-badge {
  font-size: 0.775rem;
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  border: 1px solid var(--border);
}

.aisle-items-list {
  display: flex;
  flex-direction: column;
}

/* Pojedynczy wiersz produktu */
.product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--divider);
  background: var(--bg-card);
  transition: all 0.2s ease;
  cursor: pointer;
}

.product-item:last-child {
  border-bottom: none;
}

.product-item:active {
  background: var(--bg-subtle);
}

.product-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

/* Customowy nowoczesny checkbox */
.custom-checkbox {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  color: white;
  font-size: 0.95rem;
  font-weight: 800;
  background: var(--bg-surface);
}

.product-item.completed .custom-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
  transform: scale(0.95);
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.product-qty {
  font-size: 0.825rem;
  color: var(--primary-dark);
  font-weight: 700;
}

.product-item.completed {
  opacity: 0.5;
  background: rgba(0, 0, 0, 0.015);
}

.product-item.completed .product-name {
  text-decoration: line-through;
  color: var(--text-dimmed);
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-item-action {
  background: none;
  border: none;
  color: var(--text-dimmed);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-item-action:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-del-item:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ==========================================================================
   Pływający Dolny Dock (Bottom Navigation & Quick Add)
   ========================================================================== */

.bottom-app-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 8px 12px calc(8px + var(--safe-bottom)) 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.dock-image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.dock-preview-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.dock-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-remove-thumb {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-glass, var(--bg-surface));
  border: 1.8px solid var(--border);
  border-radius: 32px;
  padding: 6px 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.chat-input-bar:focus-within {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 8px 30px var(--primary-glow), 0 0 0 3px var(--primary-light);
}

.chat-tool-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.chat-tool-camera {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0.06) 100%);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--primary);
}

.chat-tool-camera:hover, .chat-tool-camera:active {
  background: var(--primary);
  color: white;
  transform: scale(1.06);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.chat-tool-paste {
  background: var(--bg-subtle);
  border-color: var(--border);
  color: var(--text-muted);
}

.chat-tool-paste:hover, .chat-tool-paste:active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.06);
}

.chat-input-textarea {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 6px;
  resize: none;
  max-height: 120px;
  line-height: 1.35;
  user-select: text !important;
}

.chat-send-btn {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

.chat-send-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   Modale & Bottom Sheets
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.1, 0.9, 0.2, 1);
  padding-bottom: calc(20px + var(--safe-bottom));
  overflow: hidden;
  box-shadow: var(--shadow-modal);
}

.modal-backdrop.active .bottom-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  background: var(--border);
  border-radius: var(--radius-pill);
  margin: 12px auto 4px auto;
  flex-shrink: 0;
}

.sheet-header {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider);
}

.sheet-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.sheet-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Przyciski i elementy formularzy */
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  color: var(--text-main);
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* ==========================================================================
   Edytor kolejności alejek (Drag & Drop)
   ========================================================================== */

.aisle-reorder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.reorder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
}

.reorder-item.dragging {
  opacity: 0.4;
  background: var(--primary-light);
  border-color: var(--primary);
}

.reorder-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reorder-handle {
  color: var(--text-dimmed);
  font-size: 1.2rem;
}

.reorder-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.reorder-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-move {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  transition: all 0.2s ease;
}

.btn-move:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ==========================================================================
   Loading & Toast
   ========================================================================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-container {
  position: fixed;
  bottom: calc(var(--dock-h, 130px) + 12px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 420px;
}

.toast {
  background: #1E293B;
  color: #F8FAFC;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 600;
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideUp 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-success {
  border-left: 4px solid var(--primary);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


/* ==========================================================================
   POPRAWKI MOBILNE (dotyk, dostępność, stany)
   ========================================================================== */

/* Cele dotykowe - przyciski przy produkcie były 32x32, poniżej progu trafialności */
.btn-item-action {
  min-width: 42px;
  min-height: 42px;
}
.product-actions { gap: 8px; }

.chat-tool-btn,
.chat-send-btn,
.icon-btn {
  min-width: 44px;
  min-height: 44px;
}

.btn-move { min-width: 40px; min-height: 40px; }
.btn-add-promo { min-height: 40px; padding-inline: 14px; }
.store-chip, .store-chip-btn { min-height: 40px; }
#btn-reset-store-order { min-height: 40px; padding: 0 10px; }
#toggle-haptic,
#toggle-move-bottom,
#checkbox-replace-list { width: 26px; height: 26px; }

/* Ukryte modale nie mogą przechwytywać dotyku ani być czytane przez TalkBack */
.modal-backdrop:not(.active) { visibility: hidden; }
.modal-backdrop.active { visibility: visible; }

/* Na telefonie :hover "przykleja się" po dotknięciu - wyłączamy przesunięcia */
@media (hover: none) {
  .action-card:hover,
  .icon-btn:hover,
  .store-chip:hover,
  .product-item:hover,
  .btn-primary:hover,
  .btn-secondary:hover { transform: none; }
}

/* Nagłówek nie może się rozpychać na wąskim ekranie */
.brand-text { min-width: 0; }
.brand-name, .brand-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { flex-shrink: 0; }

/* Pole wpisywania: dwie linie placeholdera muszą się mieścić */
.chat-input-textarea {
  min-height: 44px;
  line-height: 1.35;
}

/* Zwinięta alejka - wskazanie strzałką */
.aisle-header::after {
  content: '▾';
  margin-left: 8px;
  font-size: 0.8rem;
  opacity: 0.55;
  transition: transform 0.2s ease;
}
.aisle-collapsed .aisle-header::after { transform: rotate(-90deg); }

/* Toast z akcją "Cofnij" po usunięciu produktu */
.toast-with-action {
  display: flex;
  align-items: center;
  gap: 14px;
}
.toast-undo-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: inherit;
  font: inherit;
  font-weight: 800;
  padding: 6px 14px;
  min-height: 34px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Stan synchronizacji rodzinnej - kolor musi odpowiadać prawdzie */
.sync-ok    { color: var(--primary) !important; }
.sync-fail  { color: var(--danger) !important; }
.sync-local { color: var(--text-muted) !important; }


/* ==========================================================================
   POPRAWKA v16: naglowek nie miesci sie na 393px
   Po powiekszeniu przyciskow do 44px cztery ikony + nazwa rozpychaly .header-top
   do 426px przy szerokosci ekranu 393px - przycisk Ustawien byl czesciowo poza
   ekranem i nie dalo sie w niego trafic. Bez Ustawien nie ma jak wpisac klucza API.
   ========================================================================== */

.header-top {
  gap: 8px;
}

/* Kontener nazwy musi moc sie kurczyc - bez min-width:0 flex go nie zwezi */
.brand-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
}

.brand-name,
.brand-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.header-actions {
  flex: 0 0 auto;
  gap: 4px;
}

/* Logo nie moze sie kurczyc ani rozpychac */
.brand-logo-badge {
  flex-shrink: 0;
}

/* Na waskich telefonach podtytul ustepuje miejsca przyciskom */
@media (max-width: 400px) {
  .brand-sub { display: none; }
  .brand-name { font-size: 1.1rem; }
}

/* Pole wpisywania: jedna linia placeholdera ma sie miescic w calosci */
.chat-input-textarea {
  font-size: 0.9rem;
}
.chat-input-textarea::placeholder {
  font-size: 0.88rem;
}

/* Przyciski akcji w modalach mialy 32px wysokosci - ponizej progu trafialnosci */
#btn-share-native,
#btn-copy-keep-format,
#btn-copy-full-text,
#btn-clear-completed,
#btn-clear-all,
#btn-paste-clipboard,
#btn-reset-store-order {
  min-height: 44px;
}

/* Przelaczniki w Ustawieniach: sam kwadracik jest maly, ale caly wiersz (label)
   jest klikalny - powiekszamy jeszcze kwadracik dla pewnosci trafienia */
#toggle-haptic,
#toggle-move-bottom,
#checkbox-replace-list {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
