:root {
  --primary-green: #9df04d;
  --text-dark: #202124;
  --text-gray: #5f6368;
  --bg-color: #f8f9fa;
  --border-color: #dadce0;
}
* { box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }
body { margin: 0; padding: 0; background-color: var(--bg-color); color: var(--text-dark); display: flex; flex-direction: column; height: 100vh; }

#search-view, #detail-view { display: none; flex-direction: column; height: 100%; padding: 20px; }
#search-view.active, #detail-view.active { display: flex; }

.search-container { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 15px; width: 100%; }
.search-view-center { flex-grow: 1; }

.input-wrapper { width: 100%; max-width: 400px; display: flex; gap: 10px; }
input[type="text"] { flex-grow: 1; padding: 15px; font-size: 16px; border: 1px solid var(--border-color); border-radius: 8px; outline: none; }
input[type="text"]:focus { border-color: var(--primary-green); }

.btn-search { border: none; border-radius: 8px; padding: 0 20px; display: flex; align-items: center; justify-content: center; cursor: pointer; background-color: var(--primary-green); color: #1a1a1a; font-weight: 600; min-width: 60px; }

#error-msg { color: #d93025; background: #fce8e6; padding: 10px; border-radius: 8px; font-size: 14px; display: none; text-align: center; width: 100%; max-width: 400px; margin: 0 auto; }

.logo-container { text-align: center; padding: 20px 0; max-width: 400px; margin: 0 auto; }
.logo-container img { max-height: 55px; max-width: 100%; object-fit: contain; } 

.disclaimer-text { font-size: 11px; color: #9aa0a6; margin-top: 12px; line-height: 1.4; padding: 0 10px; text-align: center; max-width: 400px; margin-left: auto; margin-right: auto; }

.header-nav { display: flex; align-items: center; margin-bottom: 20px; }
.btn-back { background: none; border: none; font-size: 16px; color: var(--text-gray); cursor: pointer; display: flex; align-items: center; gap: 5px; padding: 0; }

.detail-card { background: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 15px; flex-grow: 0; max-width: 400px; margin: 0 auto; width: 100%; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #f1f3f4; padding-bottom: 10px; }
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-label { color: var(--text-gray); font-size: 14px; min-width: 90px; }
.detail-value { font-weight: 500; text-align: right; word-break: break-word; }
.value-price { color: #34a853; font-size: 18px; font-weight: 700; }
.product-image-container img { max-width: 120px; border-radius: 4px; border: 1px solid #eee; }

/* Overlay Schermo Intero per la Fotocamera */
#camera-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 1000; flex-direction: column; justify-content: center; align-items: center; padding: 20px; }
#reader { width: 100%; max-width: 400px; background: #000; border-radius: 12px; overflow: hidden; }
.btn-close-camera { margin-top: 20px; padding: 12px 24px; background: #fff; color: #333; border: none; border-radius: 8px; font-size: 16px; font-weight: bold; cursor: pointer; }

/* OVERLAY DI CARICAMENTO GLOBALE */
#loading-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; flex-direction: column; justify-content: center; align-items: center; }
.spinner { animation: rotate 2s linear infinite; width: 50px; height: 50px; }
.spinner .path { stroke: var(--primary-green); stroke-linecap: round; animation: dash 1.5s ease-in-out infinite; }
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}
.loading-text { color: #fff; margin-top: 15px; font-size: 16px; font-weight: 500; letter-spacing: 0.5px; }

/* SISTEMA ANTI-COPIA PER IMMAGINI */
.protect-img {
  -webkit-touch-callout: none; 
  -webkit-user-select: none;   
  -khtml-user-select: none;    
  -moz-user-select: none;      
  -ms-user-select: none;       
  user-select: none;           
  pointer-events: none;        
  opacity: 0.8;                
}
.product-image-container .protect-img { opacity: 1; }