/* ===== MARYSTÈ - STYLES COMPATTI E FUNZIONALI ===== */

/* === RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #333;
  overflow-x: hidden;
}

/* === BOTTONI HEADER === */
.header-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* === CATEGORIE COMPATTE E LEGGIBILI === */
.category-button {
  padding: 16px 20px;
  background: linear-gradient(135deg, #d890df 0%, #b344b3 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  box-shadow: 0 2px 6px rgba(216, 144, 223, 0.3);
  position: relative;
  z-index: 1;
  pointer-events: all;
  user-select: none;
  display: inline-block;
  white-space: nowrap;
}

.category-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(216, 144, 223, 0.4);
  background: linear-gradient(135deg, #b344b3 0%, #8e24aa 100%);
}

.category-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(216, 144, 223, 0.3);
}

/* CATEGORIE NORMALI QUANDO ATTIVE - VIOLA PIU' SCURO */
.category-button.active {
  background: linear-gradient(135deg, #8e24aa 0%, #6a1b9a 100%) !important;
  box-shadow: 0 4px 12px rgba(142, 36, 170, 0.4) !important;
  transform: translateY(-1px);
}

/* === CATEGORIE SPECIALI (RIP, ALTRO, SHOPPER, BUONO REGALO, BORSE) === */
.category-button[data-category="Rip"],
.category-button[data-category="Altro"], 
.category-button[data-category="Shopper"],
.category-button[data-category="BuonoRegalo"],
.category-button[data-category="Borse"] {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
  box-shadow: 0 2px 6px rgba(240, 147, 251, 0.3) !important;
}

.category-button[data-category="Rip"]:hover,
.category-button[data-category="Altro"]:hover, 
.category-button[data-category="Shopper"]:hover,
.category-button[data-category="BuonoRegalo"]:hover,
.category-button[data-category="Borse"]:hover {
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%) !important;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4) !important;
}

.category-button[data-category="Rip"].active,
.category-button[data-category="Altro"].active, 
.category-button[data-category="Shopper"].active,
.category-button[data-category="BuonoRegalo"].active,
.category-button[data-category="Borse"].active {
  background: linear-gradient(135deg, #ad1457 0%, #880e4f 100%) !important;
  box-shadow: 0 4px 12px rgba(173, 20, 87, 0.4) !important;
}

/* === FILTRI MODERNIZZATI === */
.filters.hidden {
  display: none;
}

.filters.show {
  display: block;
}

/* === BOTTONI FILTRO GRANDI COME CATEGORIE === */
.filter1-button, .filter2-button, .letter-filter-button, .pietra-button, .misura-button {
  padding: 16px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  white-space: nowrap;
  min-width: 100px;
}

.filter1-button {
  background: linear-gradient(135deg, #ba68c8 0%, #9c27b0 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(186, 104, 200, 0.3);
}

.filter1-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(186, 104, 200, 0.4);
}

.filter1-button.active {
  background: linear-gradient(135deg, #7b1fa2 0%, #4a148c 100%) !important;
  box-shadow: 0 4px 12px rgba(123, 31, 162, 0.4) !important;
}

/* Mostra le sezioni quando i container interni sono attivi */
#filter2Section:has(#filter2ButtonsContainer[style*="display: flex"]) {
  display: block !important;
}

#filter3Section:has(#filter3ButtonsContainer[style*="display: flex"]) {
  display: block !important;
}

#letterSection:has(#letterButtonsContainer[style*="display: flex"]) {
  display: block !important;
}
.filter2-button {
  background: linear-gradient(135deg, #ce93d8 0%, #ab47bc 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(206, 147, 216, 0.3);
}

.filter2-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(206, 147, 216, 0.4);
}

.filter2-button.active {
  background: linear-gradient(135deg, #8e24aa 0%, #6a1b9a 100%) !important;
  box-shadow: 0 4px 12px rgba(142, 36, 170, 0.4) !important;
}

.letter-filter-button {
  background: linear-gradient(135deg, #f8bbd9 0%, #f48fb1 100%);
  color: #880e4f;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(248, 187, 217, 0.3);
}

.letter-filter-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(248, 187, 217, 0.4);
}

.pietra-button {
  background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
  color: #4a148c;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(225, 190, 231, 0.3);
}

.pietra-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(225, 190, 231, 0.4);
}

.misura-button {
  background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
  color: #6a1b9a;
  border: 1px solid #ba68c8;
  box-shadow: 0 2px 6px rgba(186, 104, 200, 0.3);
}

.misura-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(186, 104, 200, 0.4);
}

.misura-button.active {
  background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4) !important;
}

/* === PRODOTTI COMPATTI === */
#products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

#productsSection {
  display: none !important; /* Nascosto di default e forzato */
}

.product-card {
  background: white;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  font-weight: 600;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: #d890df;
}

/* === CARRELLO/RECEIPT === */
#receipt-list li {
  padding: 8px 0;
  border-bottom: 1px dashed #e1e8ed;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
}

#receipt-list li:last-child {
  border-bottom: none;
}

#receipt input[type="number"] {
  width: 90px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
}
/* === PREZZO ARTICOLO NELLO SCONTRINO === */
#receipt-list .item-price,
.receipt-price,
.price-display {
  font-size: 16px !important;
  font-weight: bold !important;
}

/* === SUGGESTIONS === */
#suggestions {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  display: none;
  margin-top: 2px;
}

#suggestions div {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

#suggestions div:hover {
  background: #f8f9fc;
}

#suggestions div:last-child {
  border-bottom: none;
}

/* === METEO ANIMATIONS === */
#meteoSelezionato.selezionato {
  border: 2px solid #4fc3f7;
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.6);
}

#meteoSelezionato.attiva-promemoria {
  border-color: #ff69b4;
  background: linear-gradient(135deg, #ffe5f1 0%, #ffc1e0 100%);
  animation: lampeggiaMeteo 1s infinite;
}

@keyframes lampeggiaMeteo {
  0% { box-shadow: 0 0 0px rgba(255, 105, 180, 0.3); }
  50% { box-shadow: 0 0 15px rgba(255, 105, 180, 0.8); }
  100% { box-shadow: 0 0 0px rgba(255, 105, 180, 0.3); }
}

/* === STAMPANTE === */
#connectPrinterBtn {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
  transition: all 0.3s ease;
}

#connectPrinterBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(240, 147, 251, 0.6);
}

/* === DEBUG: Forza la funzionalità dei bottoni === */
#categories {
  pointer-events: all;
  position: relative;
  z-index: 10;
}

#categories * {
  pointer-events: all;
}

/* === HIDDEN CLASS === */
.hidden {
  display: none !important;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  body > div:first-child {
    grid-template-columns: 1fr 350px !important;
  }
}

@media (max-width: 900px) {
  body > div:first-child {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto;
  }
  
  .header-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  #categories {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  }
}

@media (max-width: 600px) {
  body > div:first-child {
    padding: 10px !important;
    gap: 10px !important;
  }
  
  .header-btn {
    font-size: 14px;
    padding: 6px 10px;
  }
  
  h1 {
    font-size: 1.5rem !important;
  }
  
  #categories {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
    gap: 6px !important;
  }
  
  .category-button {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* === FIX X CANCELLAZIONE === */
#receipt-list li .item-description {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
}

#receipt-list li .item-price {
  flex-shrink: 0;
  margin-right: 10px;
  font-weight: bold;
}

#receipt-list li .delete-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === ANIMAZIONE RECUPERO STAMPANTE === */
@keyframes pulse {
  0% { 
    transform: scale(1); 
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
  }
  50% { 
    transform: scale(1.05); 
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6);
  }
  100% { 
    transform: scale(1); 
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
  }
}

/* === STILE BOTTONE ERRORE STAMPANTE === */
.btn-stampante-errore {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%) !important;
  color: white !important;
  animation: pulse 1s infinite;
  font-weight: bold !important;
}

.btn-stampante-ok {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
  color: white !important;
  font-weight: bold !important;
}

/* === FIX DEFINITIVO TASTO PRECONTO === */
#borsePreconto {
  pointer-events: auto !important;
  z-index: 999 !important; /* ← ABBASSATO da 99999 a 999 */
  position: relative !important;
}

/* Rimuovi blocchi da overlay invisibili */
body::before,
body::after {
  pointer-events: none !important;
}

/* Forza tutti i bottoni della cassa a funzionare */
#invioFiscaleBtn,
#borsePreconto,
button[onclick*="clearReceipt"] {
  pointer-events: auto !important;
  z-index: 999 !important; /* ← ABBASSATO da 9999 a 999 */
  position: relative !important;
}

/* 🎯 POPUP NUOVO CLIENTE SEMPRE IN PRIMO PIANO */
#nuovoClientePopup {
  z-index: 10000 !important; /* ← PIÙ ALTO di tutti i bottoni */
}

/* Spazio per barra promemoria fidelity */
body {
  padding-bottom: 80px !important;
}