/* --- VARIABILI CSS --- */
:root {
    --bg-base: #FFF0F5;
    --bg-dots: #FFB6C1;
    --primary: #D02090;
    --secondary: #FF69B4;
    --light: #FFD1DC;
    --dark: #8B008B;
    --badge: #FF3366;
    --primary-rgb: 208, 32, 144;
    --secondary-rgb: 255, 105, 180;
    --light-rgb: 255, 209, 220;
}

body.theme-blue {
    --bg-base: #F0F8FF;
    --bg-dots: #ADD8E6;
    --primary: #007BFF;
    --secondary: #3399FF;
    --light: #B3D9FF;
    --dark: #004080;
    --badge: #FF5500;
    --primary-rgb: 0, 123, 255;
    --secondary-rgb: 51, 153, 255;
    --light-rgb: 179, 217, 255;
}

/* --- RESET E BASE --- */
* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent !important; 
    outline: none; 
}

/* FIX iOS: previene ritardi nei tocchi di 300ms */
button, a, input, select, .btn-paga, .btn-cat, .nav-item, .icona-azione, .scatola-prodotto, .chiudi-modal, .stella-voto {
    touch-action: manipulation;
}

html, body {
    /* FIX IOS: Blocca il rimbalzo elastico che causa il farfallio */
    overscroll-behavior-y: none;
}

body { 
    background-color: var(--bg-base); 
    background-image: radial-gradient(var(--bg-dots) 1.5px, transparent 1.5px); 
    background-size: 25px 25px; 
    font-family: 'Poppins', sans-serif; 
    margin: 0; 
    padding-bottom: 90px; 
    text-align: center; 
    color: #4A4A4A; 
    transition: background-color 0.5s ease; 
}

.colore-primario { 
    color: var(--primary); 
}

.colore-scuro { 
    color: var(--dark); 
}

/* --- GLASSMORPHISM (LIQUID GLASS APPLE STYLE) - OTTIMIZZATO --- */
.bg-card, 
.card-evento, 
.card-notifica, 
.taglia-card, 
.timer-wrapper { 
    background: rgba(255, 255, 255, 0.65); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); 
    border: 1px solid rgba(255, 255, 255, 0.7); 
    box-shadow: 0 8px 32px 0 rgba(var(--primary-rgb), 0.08); 
}

/* Prodotti e liste senza Blur per scroll fluido e rendering GPU veloce */
.scatola-prodotto, 
.admin-item {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.9); 
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.05); 
    border-radius: 20px; 
    transform: translateZ(0); /* Forza accelerazione hardware iOS */
}

.hr-theme { 
    border: 1px solid rgba(var(--light-rgb), 0.5); 
    margin: 15px 0; 
}

#candy-container { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh; 
    pointer-events: none; 
    z-index: 1; 
}

.fn-candy { 
    position: absolute; 
    font-size: 45px; 
    bottom: -60px; 
    pointer-events: none; 
    z-index: 2; 
    animation: flyUp linear forwards; 
}

@keyframes flyUp { 
    0% { transform: translateY(0) rotate(0deg); opacity: 1; } 
    100% { transform: translateY(-120vh) rotate(360deg); opacity: 0; } 
}

#app-content { 
    position: relative; 
    z-index: 10; 
}

/* --- MENU SWIPE CATEGORIE E TABS --- */
.filtri-categorie {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 5px;
    margin-bottom: 15px;
    scrollbar-width: none; 
    -ms-overflow-style: none;  
}

.filtri-categorie::-webkit-scrollbar { 
    display: none; 
}

.admin-tabs { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 20px; 
    overflow-x: auto; 
    padding-bottom: 5px; 
    scrollbar-width: none; 
}

.admin-tabs::-webkit-scrollbar { 
    display: none; 
}

.admin-tab-btn { 
    background: rgba(255,255,255,0.6); 
    border: 1px solid rgba(255,255,255,0.8); 
    border-radius: 15px; 
    padding: 10px 14px; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--primary); 
    cursor: pointer; 
    white-space: nowrap; 
    flex-shrink: 0; 
    backdrop-filter: blur(8px); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    transition: 0.2s;
}

.admin-tab-btn.attivo { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: white; 
    border-color: transparent; 
    box-shadow: 0 4px 10px rgba(var(--primary-rgb),0.3); 
}

.admin-scheda { 
    animation: fadeIn 0.3s ease; 
}

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

/* --- SKELETON LOADER FANTASMA --- */
.skeleton {
    background: #e0e0e0;
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 25%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0.3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
}

@keyframes shimmer { 
    0% { background-position: -200% 0; } 
    100% { background-position: 200% 0; } 
}

.skeleton-img { width: 100%; height: 90px; margin-bottom: 10px; }
.skeleton-text { width: 80%; height: 16px; margin: 10px auto; }
.skeleton-btn { width: 100%; height: 35px; border-radius: 15px; margin-top: 15px; }

/* --- SOCIAL PROOF TOAST --- */
.social-proof-toast {
    position: fixed;
    bottom: 85px;
    left: -100%; 
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1000;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    transition: left 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 80%;
    text-align: left;
    pointer-events: none;
}

.social-proof-toast.show { 
    left: 5%; 
}

/* --- LEADERBOARD CLASSIFICA --- */
.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(var(--light-rgb), 0.5);
    font-size: 14px;
}

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

.leaderboard-item b { 
    color: var(--primary); 
}

.leaderboard-item span { 
    font-weight: bold; 
    color: var(--dark); 
}

/* --- PRIVACY E CUORI --- */
.container-checks-registrazione { 
    text-align: left; 
    padding: 10px 15px; 
    background: rgba(255, 255, 255, 0.4); 
    border-radius: 15px; 
    margin: 10px 0; 
    border: 1px solid rgba(255,255,255,0.6);
}

.check-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 8px; 
    font-size: 13px; 
    color: var(--primary); 
}

.check-item input { 
    width: 18px; 
    height: 18px; 
}

.nota-privacy { 
    font-size: 11px; 
    line-height: 1.4; 
    color: #666; 
    margin-top: 10px; 
    border-top: 1px solid rgba(255,255,255,0.5); 
    padding-top: 8px; 
}

.btn-cuore { 
    position: absolute; 
    top: 8px; 
    right: 8px; 
    width: 38px; 
    height: 38px; 
    background: rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(4px); 
    -webkit-backdrop-filter: blur(4px); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 20px; 
    cursor: pointer; 
    z-index: 20; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
    transition: transform 0.2s; 
}

.btn-cuore:active { 
    transform: scale(0.85); 
}

.heart-anim { 
    animation: pulseHeart 0.3s ease; 
}

@keyframes pulseHeart { 
    0% { transform: scale(1); } 
    50% { transform: scale(1.4); } 
    100% { transform: scale(1); } 
}

/* --- BENVENUTO E MODALI --- */
.welcome-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 9999; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    pointer-events: auto; 
}

.welcome-content { 
    z-index: 10000; 
    padding: 30px; 
    background: rgba(255, 255, 255, 0.65); 
    backdrop-filter: blur(16px); 
    -webkit-backdrop-filter: blur(16px); 
    border-radius: 30px; 
    border: 1px solid rgba(255, 255, 255, 0.8); 
    box-shadow: 0 8px 32px 0 rgba(var(--primary-rgb), 0.15); 
}

.welcome-title { 
    font-size: 38px; 
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    margin-bottom: 10px; 
}

.welcome-buttons { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    margin-top: 20px; 
}

.btn-theme { 
    padding: 15px 30px; 
    border-radius: 20px; 
    font-size: 18px; 
    font-weight: bold; 
    border: none; 
    cursor: pointer; 
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2); 
    transition: 0.3s; 
}

.btn-theme.pink { 
    background: linear-gradient(135deg, #D02090, #FF69B4); 
    color: white; 
}

.btn-theme.blue { 
    background: linear-gradient(135deg, #007BFF, #3399FF); 
    color: white; 
}

.btn-theme:active { 
    transform: scale(0.9); 
}

/* --- ANIMAZIONI PAGINE E SWIPE --- */
.page { 
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
    animation-fill-mode: both;
    width: 100%;
    /* FIX IOS: Previene i flash bianchi durante lo swipe e transizioni */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.slide-up { animation-name: slideUp; }
.slide-in-right { animation-name: slideInRight; }
.slide-in-left { animation-name: slideInLeft; }

/* FIX IOS: A fine animazione (100%) azzeriamo il transform per far rifunzionare position: sticky */
@keyframes slideUp { 
    0% { opacity: 0; transform: translateY(20px); } 
    100% { opacity: 1; transform: none; } 
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(40px); }
    100% { opacity: 1; transform: none; }
}

@keyframes slideInLeft {
    0% { opacity: 0; transform: translateX(-40px); }
    100% { opacity: 1; transform: none; }
}

.loader-overlay, 
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(var(--light-rgb), 0.7); 
    z-index: 2000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
}

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

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* FINESTRA MODALE PRODOTTO E GUIDA GLASS */
.modal-content { 
    background: rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px); 
    width: 90%; 
    max-width: 400px; 
    padding: 20px; 
    border-radius: 25px; 
    position: relative; 
    max-height: 85vh; 
    overflow-y: auto; 
    border: 1px solid rgba(255, 255, 255, 0.8); 
    box-shadow: 0 10px 40px rgba(var(--primary-rgb), 0.15); 
}

.chiudi-modal { 
    position: sticky; 
    top: 0px; 
    float: right; 
    margin-right: -10px; 
    margin-top: -10px; 
    margin-bottom: -32px; 
    width: 42px; 
    height: 42px; 
    background: rgba(255,255,255,0.9); 
    backdrop-filter: blur(5px); 
    color: #E53935; 
    font-size: 32px; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
    cursor: pointer; 
    z-index: 1000; 
}

#modal-img { 
    width: 100%; 
    height: 150px; 
    object-fit: contain; 
    border-radius: 15px; 
    margin-top: 10px; 
    filter: drop-shadow(0px 4px 8px rgba(0,0,0,0.05));
}

.stella-voto { 
    font-size: 26px; 
    cursor: pointer; 
    color: rgba(0,0,0,0.1); 
    transition: color 0.2s, transform 0.2s; 
    display: inline-block; 
}

.stella-voto.piena { 
    color: #FFD700; 
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6); 
}

/* --- HEADER EFFETTO VETRO --- */
.header-elegante { 
    padding: 15px 15px 12px 15px; 
    background: rgba(255, 255, 255, 0.65); 
    backdrop-filter: blur(16px); 
    -webkit-backdrop-filter: blur(16px); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.5); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 4px 30px rgba(0,0,0,0.05); 
    /* FIX IOS: Avvisa il browser che questo livello ha filtri pesanti */
    will-change: transform, backdrop-filter;
}

.header-top { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    position: relative; 
    width: 100%; 
    margin-bottom: 15px; 
}

/* GESTIONE ICONE LATERALI E LOGO GRANDE */
.header-azioni-sinistra { 
    position: absolute; 
    left: 0; 
    top: 0; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    width: 50px;
}

.header-azioni-destra { 
    position: absolute; 
    right: 0; 
    top: 0; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    width: 50px;
}

.icona-azione { 
    font-size: 26px; 
    cursor: pointer; 
    transition: 0.2s; 
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)); 
}

.icona-azione:active { 
    transform: scale(0.9); 
}

.logo-negozio { 
    height: 95px; 
    width: auto; 
    max-width: 70%; 
    object-fit: contain; 
    cursor: pointer; 
    filter: drop-shadow(0px 3px 6px rgba(0,0,0,0.15)); 
    margin: 0 auto; 
}

.icona-notifiche { 
    position: relative; 
}

#badge-notifiche { 
    position: absolute; 
    top: -2px; 
    right: -2px; 
    background: var(--badge); 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    border: 2px solid white; 
    display: none; 
}

.via-negozio { 
    font-size: 16px; 
    margin: 0 0 15px 0; 
    color: #555; 
    font-weight: 500; 
    text-align: center; 
    text-shadow: 0 1px 2px rgba(255,255,255,0.8); 
}

/* BARRA BOTTOM E TIMER RISOLTO */
.header-bottom { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 5px; 
}

.timer-wrapper { 
    position: relative; 
    background: rgba(255, 255, 255, 0.55); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); 
    padding: 8px 15px 8px 38px; 
    border-radius: 25px; 
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.08); 
    display: flex; 
    align-items: center; 
    margin-left: 22px; 
    border: 1px solid rgba(255, 255, 255, 0.7); 
    min-height: 48px; 
    flex-shrink: 0; 
}

.clock-icon { 
    position: absolute; 
    left: -22px; 
    top: 50%; 
    transform: translateY(-50%); 
    width: 46px; 
    height: 46px; 
    border-radius: 50%; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.12); 
    background: white; 
    z-index: 5;
}

.countdown-testo { 
    font-size: 11px; 
    color: var(--dark); 
    line-height: 1.3; 
    text-align: left; 
    white-space: nowrap; 
}

/* SOCIAL */
.social-links { 
    display: flex; 
    gap: 12px; 
}

.social-btn { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 34px; 
    height: 34px; 
    border-radius: 50%; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.12); 
}

.ig { 
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); 
}

.fb { 
    background: linear-gradient(135deg, #1877F2, #0e5a1f); 
} 

/* NAVBAR BASSA GLASS */
.barra-bassa { 
    position: fixed; 
    bottom: 0; 
    width: 100%; 
    background: rgba(255, 255, 255, 0.75); 
    backdrop-filter: blur(16px); 
    -webkit-backdrop-filter: blur(16px); 
    border-top: 1px solid rgba(255, 255, 255, 0.5); 
    display: flex; 
    justify-content: space-between; 
    padding: 10px 5px 20px 5px; 
    z-index: 100; 
    border-radius: 24px 24px 0 0; 
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03); 
    /* FIX IOS: Avvisa il browser che questo livello ha filtri pesanti */
    will-change: transform, backdrop-filter;
}

.nav-item { 
    flex: 1; 
    font-size: 10px; 
    color: #999; 
    font-weight: 600; 
    cursor: pointer; 
    transition: 0.3s; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 2px;
}

.nav-item.activo { 
    color: var(--primary); 
    transform: translateY(-4px); 
    filter: drop-shadow(0 2px 4px rgba(var(--primary-rgb),0.3)); 
}

#pallino { 
    background: linear-gradient(135deg, var(--badge), var(--primary)); 
    color: white; 
    border-radius: 50%; 
    padding: 2px 6px; 
    font-size: 9px; 
    position: absolute; 
    top: -6px; 
    right: 10px; 
    display: none; 
}

/* --- SHOP E CARDS --- */
.griglia-prodotti { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 10px; 
    padding: 12px; 
    position: relative; 
}

.scatola-prodotto { 
    border-radius: 20px; 
    padding: 10px; 
    transition: transform 0.2s ease; 
}

.scatola-prodotto:hover { 
    transform: translateY(-3px); 
}

.immagine-caramella { 
    width: 100%; 
    height: 90px; 
    object-fit: contain; 
    border-radius: 12px; 
    margin-bottom: 8px; 
    cursor: pointer; 
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05)); 
}

.titolo-caramella { 
    font-size: 13px; 
    margin: 4px 0; 
    color: #333; 
    cursor: pointer; 
    line-height: 1.2; 
    text-shadow: 0 1px 2px rgba(255,255,255,0.5); 
}

.media-stelline-card { 
    font-size: 11px; 
    color: #FFD700; 
    margin-bottom: 4px; 
}

/* ETICHETTE BADGE */
.etichetta-badge { 
    position: absolute; 
    top: 8px; 
    left: 8px; 
    padding: 4px 8px; 
    border-radius: 12px; 
    font-size: 10px; 
    font-weight: bold; 
    color: white; 
    z-index: 15; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.2); 
}

.badge-novita { 
    background: linear-gradient(135deg, #00C9FF, #92FE9D); 
}

.badge-bestseller { 
    background: linear-gradient(135deg, #FF416C, #FF4B2B); 
}

.badge-esaurito { 
    background: linear-gradient(135deg, #8E0E00, #1F1C18); 
}

/* BOTTONI E INPUT GLASS */
.btn-cat { 
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px); 
    border: 1px solid rgba(255,255,255,0.8); 
    color: var(--primary); 
    padding: 8px 14px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 600; 
    flex-shrink: 0; 
    margin: 0; 
    cursor: pointer; 
    transition: 0.2s; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.btn-cat.attivo { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: white; 
    border-color: transparent; 
    box-shadow: 0 4px 10px rgba(var(--primary-rgb),0.3); 
}

.btn-paga { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: white; 
    border: none; 
    padding: 14px; 
    width: 92%; 
    border-radius: 20px; 
    font-size: 18px; 
    font-weight: bold;
    cursor: pointer; 
    margin-top: 15px; 
    box-shadow: 0 4px 15px rgba(var(--primary-rgb),0.3); 
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-paga:active:not(:disabled) { 
    transform: translateY(3px) scale(0.98); 
    box-shadow: 0 2px 5px rgba(var(--primary-rgb),0.3); 
}

.btn-paga:disabled { 
    background: #E0E0E0; 
    color: #9E9E9E; 
    cursor: not-allowed; 
    box-shadow:none;
}

.btn-svuota { 
    background: rgba(255,255,255,0.5); 
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px); 
    border: 1px solid rgba(255,255,255,0.8); 
    color: var(--primary); 
    padding: 10px; 
    width: 92%; 
    border-radius: 20px; 
    margin-top: 10px; 
    font-size: 16px; 
    font-weight: bold; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.barra-ricerca, 
.input-app { 
    width: 92%; 
    padding: 14px; 
    border: 1px solid rgba(255,255,255,0.6); 
    border-radius: 18px; 
    margin: 8px 0; 
    font-size: 14px; 
    background: rgba(255, 255, 255, 0.65); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02); 
    font-family: 'Poppins', sans-serif; 
    color: #333; 
}

.barra-ricerca:focus, 
.input-app:focus { 
    border: 1px solid var(--secondary); 
    background: rgba(255,255,255,0.9); 
}

.barra-ricerca::placeholder, 
.input-app::placeholder { 
    color: #888; 
}

/* CARD ED EVENTI E FOOTER NEGOZIO */
.card-evento, 
.card-notifica, 
.footer-negozio { 
    border-radius: 22px; 
    padding: 18px; 
    margin-bottom: 18px; 
    text-align: left; 
}

.card-notifica { 
    border-left: 6px solid var(--secondary); 
}

.img-evento { 
    width: 100%; 
    border-radius: 16px; 
    margin-bottom: 12px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
}

.taglia-card { 
    padding: 18px; 
    border-radius: 22px; 
    margin-bottom: 12px; 
    cursor: pointer; 
}

/* FOOTER NEGOZIO STILI */
.footer-negozio { 
    margin-top: 30px; 
    text-align: center; 
}

.footer-negozio h3 { 
    margin: 0 0 10px 0; 
    font-size: 18px; 
}

.footer-negozio p { 
    font-size: 13px; 
    margin: 6px 0; 
    font-weight: 500; 
}

/* ELEMENTI BOX E ADMIN */
.item-box-badge { 
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.5)); 
    backdrop-filter: blur(4px); 
    -webkit-backdrop-filter: blur(4px); 
    border: 1px solid rgba(255,255,255,0.8); 
    color: var(--primary); 
    padding: 6px 12px; 
    border-radius: 12px; 
    font-size: 11px; 
    margin: 3px; 
    display: inline-block; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.2s; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
}

.item-box-badge:active { 
    transform: scale(0.9); 
    background: rgba(var(--light-rgb),0.8); 
}

.admin-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px; 
    border-radius: 16px; 
    margin-bottom: 8px; 
    font-size: 13px; 
    font-weight: 500; 
    text-align: left; 
}

/* COPYRIGHT */
.copyright-testo { 
    text-align: center; 
    font-size: 11px; 
    color: #999; 
    margin-top: 20px; 
    padding-top: 15px; 
    border-top: 1px dashed rgba(var(--light-rgb), 0.5); 
    line-height: 1.5; 
}

/* ==========================================
   --- MODALITÀ NOTTE (DARK MODE) PREMIUM --- 
   ========================================== */
body.theme-dark {
    --bg-base: #1E1E1E; 
    --bg-dots: #2C2C2C;
    --light: #3A3A3A; 
    --dark: #F5F5F5;  
    color: #E0E0E0;
}

/* Glassmorphism Scuro Solo per Card non interattive */
body.theme-dark .bg-card, 
body.theme-dark .card-evento, 
body.theme-dark .card-notifica, 
body.theme-dark .taglia-card, 
body.theme-dark #gioco-info,
body.theme-dark .timer-wrapper,
body.theme-dark .footer-negozio {
    background: rgba(45, 45, 48, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.3);
    color: #E0E0E0;
}

/* Prodotti Senza Blur per Performance in Dark Mode */
body.theme-dark .scatola-prodotto, 
body.theme-dark .admin-item {
    background: rgba(45, 45, 48, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    color: #E0E0E0;
    transform: translateZ(0); /* Forza accelerazione hardware iOS */
}

/* Bottoni Menu Admin in Dark Mode */
body.theme-dark .admin-tab-btn { 
    background: rgba(45, 45, 48, 0.7); 
    color: var(--secondary); 
    border-color: rgba(255,255,255,0.1); 
}

body.theme-dark .admin-tab-btn.attivo { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: white; 
    border-color: transparent; 
}

/* Finestra Modale in Dark Mode */
body.theme-dark .modal-content, 
body.theme-dark .social-proof-toast {
    background: rgba(35, 35, 35, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
}

/* Header e Barra Bassa Scure */
body.theme-dark .header-elegante, 
body.theme-dark .barra-bassa {
    background: rgba(30, 30, 30, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0,0,0,0.2);
}

/* Input Form Scuri */
body.theme-dark .input-app,
body.theme-dark .barra-ricerca {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #FFFFFF;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

body.theme-dark .input-app:focus,
body.theme-dark .barra-ricerca:focus {
    border: 1px solid var(--secondary);
    background: rgba(30, 30, 30, 0.9);
}

body.theme-dark .input-app::placeholder,
body.theme-dark .barra-ricerca::placeholder {
    color: #888;
}

/* Testi chiari per contrasto */
body.theme-dark .titolo-caramella, 
body.theme-dark h3,
body.theme-dark .colore-scuro,
body.theme-dark .countdown-testo,
body.theme-dark #sp-text,
body.theme-dark .leaderboard-item span {
    color: #FFFFFF;
    text-shadow: none;
}

body.theme-dark .via-negozio {
    color: #AAAAAA;
    text-shadow: none;
}

body.theme-dark .saluto-magico {
    color: var(--secondary);
}

/* Bottoni in Dark Mode */
body.theme-dark .btn-cat { 
    background: rgba(45, 45, 48, 0.7); 
    color: var(--secondary); 
    border-color: rgba(255,255,255,0.1); 
}

body.theme-dark .btn-cat.attivo { 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: white; 
    border-color: transparent; 
}

body.theme-dark .btn-svuota { 
    background: rgba(45, 45, 48, 0.7);
    color: var(--secondary); 
    border-color: rgba(255,255,255,0.1); 
}

/* Elementi piccoli scuri */
body.theme-dark .clock-icon circle { fill: #2D2D30; }
body.theme-dark .chiudi-modal { background: rgba(45, 45, 48, 0.9); color: #FF5252; border: 1px solid rgba(255,255,255,0.1);}
body.theme-dark .btn-cuore { background: rgba(45, 45, 48, 0.8); border: 1px solid rgba(255,255,255,0.1);}
body.theme-dark .item-box-badge { background: rgba(45, 45, 48, 0.8); border: 1px solid rgba(255,255,255,0.1); color: #FFF; }

/* --- FIX GRAFICI FINALI --- */
.scatola-prodotto {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.scatola-prodotto .btn-paga {
    width: 100%;
    margin-top: auto;
    min-height: 42px;
    font-size: 14px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fix immagine logo in caso di mancato caricamento */
.logo-negozio {
    max-height: 85px;
    width: auto;
    object-fit: contain;
    cursor: pointer;
    margin: 0 auto;
}

/* --- EFFETTI SELEZIONE BOX BUILDER --- */
.scatola-prodotto.selezionato-box {
    border: 2px solid #4CAF50 !important;
    background: rgba(76, 175, 80, 0.1) !important;
    transform: scale(0.95);
}

.check-box-selezionato {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* --- FIX LEGGIBILITÀ CHECKBOX IN DARK MODE --- */
body.theme-dark .container-checks-registrazione {
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-dark .check-item,
body.theme-dark .check-item label {
    color: #FFFFFF;
}

/* --- GIOCO FULLSCREEN --- */
.fullscreen-game {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 9998 !important; 
    border: none !important;
}

#gioco-countdown-overlay {
    z-index: 100000 !important;
}

/* --- BANNER SPONSOR PUBBLICITÀ --- */
.banner-sponsor {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.15);
    cursor: pointer;
    margin-bottom: 10px;
    border: 2px solid rgba(var(--primary-rgb), 0.3);
    background: white;
    animation: fadeIn 0.5s ease;
}
.banner-sponsor img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}
.banner-sponsor-etichetta {
    position: absolute;
    top: 6px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    font-weight: bold;
    z-index: 10;
    letter-spacing: 0.5px;
}
