@charset "UTF-8";

:root {
  --primary: #2563eb;
  --primary-light: color-mix(in srgb, var(--primary) 12%, #ffffff);
  --primary-shadow: color-mix(in srgb, var(--primary) 25%, transparent);
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-green: #16a34a;
  --accent-green-bg: #f0fdf4;
  --danger: #dc2626;
  --mic-color: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  padding: 16px;
  padding-bottom: 85px; /* Spazio per la Bottom Navigation Bar fissa */
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* Header & Dashboard */
.app-header {
  margin-bottom: 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.counter-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
}

/* Box Totale Stimato Spesa */
.estimated-total-box {
  background: var(--accent-green-bg);
  border: 1px solid #bbf7d0;
  color: var(--accent-green);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Store Cards Selector */
.store-selector {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.store-selector::-webkit-scrollbar {
  display: none;
}

.store-btn {
  padding: 10px 18px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.store-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-shadow);
}

/* Inserimento Prodotto Card */
.add-card {
  background: var(--card-bg);
  padding: 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  border: 1px solid #f1f5f9;
}

.input-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 4px 4px 4px 12px;
}

.input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  outline: none;
  color: var(--text-main);
}

/* Pulsante Microfono Ottimizzato Vettoriale */
.mic-btn {
  background: var(--mic-color);
  border: none;
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.2s ease;
}

.mic-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.mic-btn.listening {
  background: var(--danger);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.add-card-actions {
  display: flex;
  gap: 8px;
}

.aisle-select-main {
  flex: 1;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: #ffffff;
  color: var(--text-main);
}

.btn-primary {
  padding: 10px 18px;
  background: var(--accent-green);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

/* Chips Aggiunta Rapida */
.quick-section {
  margin-bottom: 20px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

.quick-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.quick-chips::-webkit-scrollbar { display: none; }

.chip-btn {
  background: var(--accent-green-bg);
  border: 1px solid #bbf7d0;
  color: var(--accent-green);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

/* Corsie e Card Prodotto */
.aisle-group {
  margin-bottom: 24px;
}

.aisle-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}

.item-card {
  background: var(--card-bg);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
  gap: 8px;
}

.item-card.completed {
  opacity: 0.4;
  background: #f8fafc;
}

.item-card.completed .item-text {
  text-decoration: line-through;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0; /* Evita che il testo rompa il flexbox */
}

.item-left input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-green);
  border-radius: 6px;
  flex-shrink: 0;
}

.item-text {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  word-break: break-word;
}

/* Controlli a destra (Prezzo, Corsia, Elimina) */
.item-right-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Badge del prezzo con etichetta sopra e campo più comodo */
.price-badge-container {
    cursor: pointer;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 3px 6px;
    display: flex;
    flex-direction: column; /* Dispone etichetta e input in verticale */
    align-items: center;
    justify-content: center;
    min-width: 75px;
    height: 42px; /* Leggermente più alto */
    transition: all 0.2s ease;
}

.price-badge-container:hover {
    border-color: var(--primary);
    background: #f1f5f9;
}

.price-display-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 2px;
}

.price-display-badge.has-value {
    color: var(--accent-green);
}

.item-price-inline-input {
    display: none; /* Nascosto di default, appare al click */
    width: 65px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    outline: none;
    line-height: 1.2;
}

.item-price-inline-input::-webkit-inner-spin-button,
.item-price-inline-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.aisle-change-select {
  font-size: 0.7rem;
  padding: 6px 4px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #0f172a;       /* Colore nero scuro per il testo */
  font-weight: 700;     /* Grassetto per renderlo ben visibile */
  max-width: 100px;
}

.delete-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px;
}

.delete-btn:hover {
  color: var(--danger);
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 40px 0;
}

/* Banner Installa App */
.install-banner {
  background: var(--primary-light);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, #bfdbfe);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.install-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.btn-install {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px var(--primary-shadow);
}

/* BOTTOM NAVIGATION BAR FISSA */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 500px;
  margin: 0 auto;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0 12px 0;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  flex: 1;
}

.nav-btn.primary { color: var(--primary); }
.nav-btn.danger { color: var(--danger); }

.nav-badge {
  position: absolute;
  top: -4px;
  right: 22%;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
}

/* PANNELLO MODALE MENU & IMPOSTAZIONI */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 500px;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.info-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.info-box.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}