/* =========================================
   1. CONFIGURAZIONE BASE & VARIABILI
   ========================================= */
:root {
    --text-primary: #ffffff;
    --glass-bg: rgba(0, 0, 0, 0.45);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-blur: 20px;
    --accent-color: #00d2ff;
    --error-color: #ff4d4d;
    --font-main: 'Montserrat', sans-serif;
}

body.light-mode {
    --text-primary: #1a1a1a;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.6);
    --accent-color: #0066cc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* FIX LINEE VIOLA (Link) */
a { text-decoration: none; color: inherit; outline: none; }
a:visited { color: inherit; }

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
}

/* SFONDO VIDEO (FIX MOBILE BLOCCATO) */
.video-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
    min-height: 100vh; 
    min-height: -webkit-fill-available;
}
#bg-video {
    width: 100vw; height: 100vh; object-fit: cover;
    position: absolute; top: 0; left: 0; transition: opacity 1s ease;
}
.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3); z-index: 1;
}

/* UTILS: VETRO & CONTENITORI */
.app-container {
    position: relative; z-index: 2;
    width: 100%; max-width: 1200px; margin: 0 auto;
    display: flex; flex-direction: column; align-items: center;
    padding: 20px; padding-top: 40px;
}

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

/* =========================================
   2. HOME PAGE (HEADER, SEARCH, METEO)
   ========================================= */
.app-header { margin-bottom: 30px; text-align: center; }
.logo {
    font-size: 2.5rem; font-weight: 900; letter-spacing: 3px;
    background: linear-gradient(to right, #fff, var(--accent-color));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0,210,255,0.4));
}

/* RICERCA & GPS */
.search-container { position: relative; width: 100%; max-width: 500px; margin-bottom: 20px; z-index: 100; }
.search-box {
    display: flex; align-items: center; padding: 15px 25px;
    width: 100%; border-radius: 50px; margin-bottom: 0;
    transition: transform 0.2s; position: relative; z-index: 20;
}
.search-box:focus-within { transform: scale(1.02); border-color: var(--accent-color); }
.search-box input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text-primary); font-size: 1.1rem; margin: 0 15px; font-weight: 600; text-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.search-box button, #gps-btn { 
    background: transparent; border: none; color: var(--text-primary); 
    font-size: 1.2rem; cursor: pointer; transition: color 0.3s;
}
#gps-btn:hover { color: var(--accent-color); }

/* SUGGERIMENTI RICERCA (FIX VISIBILITÀ) */
.suggestions-list {
    position: absolute; top: 105%; left: 0; right: 0;
    background: rgba(15, 23, 42, 0.98); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px; padding: 10px; max-height: 0; overflow: hidden; opacity: 0;
    transform: translateY(-10px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.9); pointer-events: none; z-index: 2000;
    margin-top: 5px;
}
.suggestions-list.show { max-height: 350px; opacity: 1; transform: translateY(0); overflow-y: auto; pointer-events: auto; }
.suggestion-item {
    display: grid; grid-template-columns: 30px 1fr auto; align-items: center;
    padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer; transition: all 0.2s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: rgba(0, 210, 255, 0.2); padding-left: 20px; }
.sugg-icon { color: var(--accent-color); font-size: 1rem; display: flex; justify-content: center; }
.sugg-info { display: flex; flex-direction: column; margin-left: 10px; }
.sugg-name { font-weight: 700; color: white; font-size: 0.95rem; }
.sugg-coord { font-size: 0.7rem; color: rgba(255, 255, 255, 0.5); font-family: monospace; }
.badge-region { background: rgba(255,255,255,0.1); color: var(--accent-color); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; }

/* BARRA PREFERITI */
.favorites-container {
    display: flex; gap: 15px; width: 100%; max-width: 800px;
    overflow-x: auto; padding: 10px 5px; margin-bottom: 20px;
    scrollbar-width: none; justify-content: center; flex-wrap: wrap;
}
.favorites-container::-webkit-scrollbar { display: none; }
.mini-card {
    min-width: 110px; height: 120px; padding: 15px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    cursor: pointer; background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.mini-card:hover { transform: translateY(-5px) scale(1.05); border-color: var(--accent-color); box-shadow: 0 10px 25px rgba(0, 210, 255, 0.2); }
.mini-card i.weather-icon-mini { font-size: 2.2rem; color: var(--accent-color); filter: drop-shadow(0 0 8px rgba(0,210,255,0.4)); margin: 5px 0; }
.mini-card span.mini-temp { font-size: 1.2rem; font-weight: 800; color: white; }

/* CARD PRINCIPALE METEO */
.weather-card {
    padding: 40px; text-align: center; width: 100%; max-width: 450px;
    margin-bottom: 30px; animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.weather-header h2 { font-size: 2.8rem; font-weight: 700; margin-bottom: 5px; }
.weather-icon i { font-size: 6rem; color: var(--accent-color); margin: 20px 0; }
.temp-container span { font-size: 7rem; font-weight: 200; line-height: 1; }
.weather-desc p { font-size: 1.4rem; font-weight: 500; text-transform: capitalize; }

/* GRIGLIA STATISTICHE */
.stats-grid {
    display: grid;
    /* 2 Colonne su Mobile, 4 su Desktop */
    grid-template-columns: repeat(2, 1fr);
    gap: 15px; 
    width: 100%; max-width: 800px; margin: 0 auto 20px auto;
}
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
    padding: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; transition: transform 0.3s; border: 1px solid rgba(255,255,255,0.1);
    min-height: 120px;
}
.stat-card:hover { transform: translateY(-5px); background: rgba(255,255,255,0.15); border-color: var(--accent-color); }
.stat-icon { font-size: 1.8rem; margin-bottom: 10px; color: var(--accent-color); filter: drop-shadow(0 0 5px rgba(0,210,255,0.4)); }
.stat-info span { font-size: 1.2rem; font-weight: 700; color: white; }
.stat-info p { font-size: 0.8rem; opacity: 0.8; margin-bottom: 5px; }

/* FOOTER */
.app-footer {
    width: 100%; max-width: 900px; margin-top: 40px; padding: 40px;
    display: flex; justify-content: space-between; align-items: flex-start;
    flex-wrap: wrap; gap: 30px; font-size: 0.9rem; text-align: left;
}
@media (max-width: 768px) {
    .app-footer { flex-direction: column; align-items: center; text-align: center; padding-bottom: 120px; }
    .footer-brand, .footer-links, .footer-social { align-items: center; width: 100%; max-width: none; }
}
.footer-brand img { height: 40px; margin-bottom: 10px; }
.footer-links a, .email-link { 
    text-decoration: none; color: var(--text-primary); opacity: 0.8; 
    transition: 0.2s; display: block; margin-bottom: 5px; border: none;
}
.footer-links a:hover, .email-link:hover { color: var(--accent-color); opacity: 1; }

/* =========================================
   3. DOCK BAR (Menu a Scomparsa) - FIX TOUCH & SIZE
   ========================================= */
.spacer-bottom { height: 120px; }

.dock-wrapper {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 1000; display: flex; flex-direction: column; align-items: center;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.dock-wrapper.hidden { transform: translate(-50%, 80px); }

/* MANIGLIA PIÙ GRANDE E CLICCABILE */
.dock-handle {
    width: 60px; height: 35px; /* Più alto per il dito */
    margin-bottom: 5px; border-radius: 20px 20px 0 0;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; font-size: 1.2rem; color: var(--accent-color);
    background: rgba(255,255,255,0.05); backdrop-filter: blur(5px);
}
.dock-wrapper.hidden .dock-handle i { transform: rotate(180deg); }

.floating-controls {
    display: flex; justify-content: space-between; gap: 15px;
    padding: 15px 30px; border-radius: 40px; min-width: 300px;
    position: static !important; transform: none !important;
}
.floating-controls button {
    background: transparent; border: none; color: var(--text-primary);
    font-size: 1.6rem; cursor: pointer; transition: transform 0.2s; padding: 5px; width: 50px;
    outline: none; /* Via linee viola */
}
.floating-controls button:hover { transform: translateY(-5px); color: var(--accent-color); }

/* =========================================
   4. AUTH, CHAT, SETTINGS, PROFILE, GAME
   (Il resto rimane invariato come nella versione God Mode)
   ========================================= */
.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; position: relative; z-index: 10; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 40px; display: flex; flex-direction: column; align-items: center; }
.auth-header { text-align: center; margin-bottom: 30px; width: 100%; position: relative; }
.auth-logo { height: 80px; margin-bottom: 15px; filter: drop-shadow(0 0 10px rgba(0,210,255,0.3)); }
.back-home { position: absolute; top: -10px; right: -10px; color: var(--text-primary); font-size: 1.2rem; }
.auth-form { display: none; width: 100%; }
.auth-form.active { display: flex; flex-direction: column; gap: 15px; }
.input-group { position: relative; width: 100%; background: rgba(255,255,255,0.05); border-radius: 10px; display: flex; align-items: center; padding: 0 15px; border: 1px solid rgba(255,255,255,0.1); }
.input-group:focus-within { border-color: var(--accent-color); }
.input-group input { width: 100%; padding: 15px 10px; background: transparent; border: none; color: white; outline: none; font-size: 1rem; }
.input-group i { color: var(--accent-color); opacity: 0.8; }
.toggle-pass { cursor: pointer; padding: 10px; }
.password-strength { margin-top: -5px; font-size: 0.8rem; }
.strength-bar { height: 4px; width: 0%; background: red; transition: 0.3s; border-radius: 2px; margin-bottom: 5px; }
.requirements-box { display: none; background: rgba(0,0,0,0.4); padding: 15px; border-radius: 10px; font-size: 0.85rem; margin-bottom: 10px; }
.requirements-box ul { list-style: none; padding: 0; }
.requirements-box li { margin-bottom: 5px; opacity: 0.7; display: flex; align-items: center; gap: 8px;}
.auth-btn { padding: 15px; border-radius: 50px; border: none; background: var(--accent-color); color: white; font-weight: bold; font-size: 1rem; cursor: pointer; transition: 0.2s; margin-top: 10px; }
.auth-btn:hover { transform: scale(1.02); filter: brightness(1.1); }
.switch-auth { text-align: center; margin-top: 15px; font-size: 0.9rem; }
.switch-auth span, .forgot-link { color: var(--accent-color); cursor: pointer; font-weight: bold; }

.chat-layout { display: flex; width: 100%; height: 90vh; max-width: 1200px; margin: 20px auto; gap: 20px; position: relative; z-index: 5; padding: 20px; }
.chat-sidebar { width: 280px; display: flex; flex-direction: column; padding: 20px; transition: 0.3s; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.new-chat-btn { background: var(--accent-color); border:none; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; color:white;}
.history-item { padding: 10px; border-radius: 10px; cursor: pointer; font-size: 0.9rem; opacity: 0.7; margin-bottom: 5px; }
.history-item.active { background: rgba(255,255,255,0.1); opacity: 1; }
.chat-main { flex: 1; display: flex; flex-direction: column; padding: 20px; position: relative; }
.chat-header { display: flex; align-items: center; gap: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }
.ai-avatar { width: 45px; height: 45px; background: var(--accent-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: white; }
.messages-container { flex: 1; overflow-y: auto; padding: 20px 0; display: flex; flex-direction: column; gap: 20px; }
.message { display: flex; max-width: 80%; }
.message.user { align-self: flex-end; justify-content: flex-end; }
.message.ai { align-self: flex-start; }
.bubble { padding: 15px; border-radius: 20px; line-height: 1.5; font-size: 0.95rem; }
.ai .bubble { background: rgba(255,255,255,0.1); border-top-left-radius: 5px; }
.user .bubble { background: var(--accent-color); color: #fff; border-top-right-radius: 5px; }
.input-area { padding-top: 15px; }
.input-wrapper { display: flex; background: rgba(0,0,0,0.3); border-radius: 50px; padding: 5px 10px; border: 1px solid rgba(255,255,255,0.1); }
.input-wrapper input { flex: 1; background: transparent; border: none; padding: 15px; color: white; outline: none; }
#send-btn { background: transparent; border: none; color: var(--accent-color); font-size: 1.2rem; padding: 0 15px; cursor: pointer; }
.mobile-sidebar-toggle { display: none; background: transparent; border: none; color: white; font-size: 1.5rem; }
@media (max-width: 800px) {
    .mobile-sidebar-toggle { display: block; margin-right: 15px; }
    .chat-sidebar { position: absolute; top:0; left:0; height:100%; z-index:100; background:#000; transform:translateX(-100%); width:80%; }
    .chat-sidebar.open { transform: translateX(0); }
}

.settings-page-header { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.2); }
.back-btn { text-decoration: none; color: var(--text-primary); font-size: 1.1rem; display: flex; align-items: center; gap: 10px; transition: 0.3s; }
.back-btn:hover { color: var(--accent-color); }
.settings-section { width: 100%; padding: 30px; margin-bottom: 30px; }
.settings-section h3 { margin-bottom: 25px; font-size: 1.4rem; color: var(--accent-color); }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 15px; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.2); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(22px); }
.setting-block { margin-bottom: 25px; }
.setting-header { display: flex; align-items: center; margin-bottom: 10px; color: var(--accent-color); font-weight: 600; }
.setting-header i { margin-right: 10px; }
.unit-options-container { display: flex; gap: 15px; width: 100%; }
.unit-option { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 15px; border-radius: 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.3s; }
.unit-option.selected { border-color: var(--accent-color); background: rgba(0, 210, 255, 0.15); }
.check-icon { font-size: 1.2rem; color: rgba(255,255,255,0.3); }
.unit-option.selected .check-icon { color: var(--accent-color); }

.profile-wrapper { max-width: 900px; margin: 40px auto; padding: 20px; }
.profile-header-card { padding: 40px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.user-info h2 { font-size: 2rem; margin-bottom: 10px; color: white; display: flex; align-items: center; gap: 10px; }
.edit-icon { font-size: 1rem; color: var(--accent-color); cursor: pointer; opacity: 0.7; }
.badge-pro { background: var(--accent-color); color: #000; padding: 2px 8px; border-radius: 4px; font-weight: bold; font-size: 0.7rem; margin-left: 10px; }
.avatar-selector { display: flex; gap: 15px; margin: 15px 0; }
.avatar-option { font-size: 2rem; padding: 10px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); cursor: pointer; transition: 0.3s; }
.avatar-option:hover { transform: scale(1.1); }
.avatar-option.male.selected { border-color: #00d2ff; box-shadow: 0 0 15px rgba(0,210,255,0.4); }
.avatar-option.female.selected { border-color: #ff00de; box-shadow: 0 0 15px rgba(255,0,222,0.4); }
.history-title { margin-bottom: 20px; font-size: 1.2rem; border-left: 4px solid var(--accent-color); padding-left: 15px; margin-top: 30px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }
.history-card { padding: 20px; border-radius: 15px; cursor: pointer; transition: 0.3s; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; height: 100px; border: 1px solid rgba(255,255,255,0.1); }
.history-card:hover { transform: translateY(-5px); background: rgba(255,255,255,0.15); border-color: var(--accent-color); }
.h-city { font-size: 1.1rem; font-weight: 700; }
.h-temp { font-size: 1.8rem; font-weight: 300; color: var(--accent-color); text-align: right; }
.no-data { grid-column: 1 / -1; text-align: center; padding: 40px; opacity: 0.6; }
.avatar-m { color: #00d2ff !important; filter: drop-shadow(0 0 5px #00d2ff); }
.avatar-f { color: #ff00de !important; filter: drop-shadow(0 0 5px #ff00de); }
.hidden-id { display: none !important; }
.logout-btn { background: rgba(255, 77, 77, 0.2); border: 1px solid rgba(255, 77, 77, 0.5); color: #ff4d4d; padding: 10px 20px; border-radius: 12px; cursor: pointer; font-weight: 600; transition: 0.3s; }
.logout-btn:hover { background: #ff4d4d; color: white; }

#game-container { position: relative; width: 100vw; height: 100vh; background: linear-gradient(to bottom, #020024 0%, #090979 50%, #00d4ff 100%); overflow: hidden; }
#player { position: absolute; bottom: 100px; left: 50px; font-size: 3rem; z-index: 10; transition: transform 0.1s; }
.obstacle { position: absolute; bottom: 100px; right: -50px; font-size: 2.5rem; color: #ff4d4d; z-index: 9; filter: drop-shadow(0 0 5px red); }
#ground { position: absolute; bottom: 0; width: 100%; height: 100px; background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); border-top: 2px solid rgba(255,255,255,0.2); z-index: 20; }
#score-board { position: absolute; top: 20px; right: 20px; font-size: 2.5rem; color: white; font-weight: 800; z-index: 20; text-shadow: 0 0 10px rgba(0,0,0,0.5); }
#start-msg, #game-over { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: white; z-index: 30; }
#game-over { display: none; background: rgba(0,0,0,0.85); padding: 40px; border-radius: 20px; border: 2px solid var(--accent-color); box-shadow: 0 0 30px rgba(0,210,255,0.3); }
button.game-btn { padding: 15px 40px; font-size: 1.2rem; background: #00d2ff; border: none; color: white; border-radius: 50px; cursor: pointer; font-weight: bold; margin-top: 20px; box-shadow: 0 0 15px #00d2ff; }
.back-btn-game { position: absolute; top: 20px; left: 20px; color: white; font-size: 1.5rem; text-decoration: none; z-index: 50; filter: drop-shadow(0 0 2px black); }
.star { position: absolute; background: white; border-radius: 50%; animation: twinkle linear infinite; opacity: 0.8; }
@keyframes twinkle { 0% { opacity: 0.3; } 50% { opacity: 1; } 100% { opacity: 0.3; } }
.planet { position: absolute; top: 10%; right: 20%; width: 80px; height: 80px; background: radial-gradient(circle, #ff6b6b 0%, #870000 100%); border-radius: 50%; opacity: 0.8; box-shadow: 0 0 20px rgba(255, 107, 107, 0.5); z-index: 1; }
.score-popup { position: absolute; color: #00ff88; font-weight: bold; font-size: 1.5rem; animation: floatUp 0.8s ease-out forwards; pointer-events: none; z-index: 100; }
@keyframes floatUp { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-50px) scale(1.5); opacity: 0; } }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 2000; display: none; justify-content: center; align-items: center; backdrop-filter: blur(8px); }
.modal-content { width: 90%; max-width: 350px; padding: 30px; border-radius: 20px; text-align: center; position: relative; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 0 30px rgba(0, 210, 255, 0.2); }
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; }
.snow-inputs { display: flex; gap: 10px; margin-top: 20px; }
.input-group-snow { flex: 1; text-align: left; }
.input-group-snow input { width: 100%; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); border-radius: 10px; padding: 10px; color: white; outline: none; margin-top: 5px; }
.snow-meter { height: 10px; background: rgba(255,255,255,0.1); border-radius: 5px; overflow: hidden; margin-top: 15px; }
.snow-fill { height: 100%; width: 0%; transition: width 1s ease, background 0.5s; }
.error-toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px); background: #ff4d4d; color: white; padding: 12px 25px; border-radius: 50px; font-weight: bold; z-index: 3000; transition: 0.5s; opacity: 0; box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: flex; gap: 10px; align-items: center; }
.error-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* --- STILI MENU GIOCO (Astro Jump Deluxe) --- */
.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white; padding: 10px 20px; border-radius: 30px;
    font-size: 1rem; cursor: pointer; transition: 0.3s;
    display: inline-flex; align-items: center; gap: 8px;
    backdrop-filter: blur(5px);
}
.glass-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.05); }

.opt-section { margin-bottom: 20px; text-align: left; }
.opt-section h4 { margin-bottom: 10px; font-size: 0.9rem; opacity: 0.8; }

.opt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.opt-item {
    height: 50px; border-radius: 10px; cursor: pointer;
    border: 2px solid transparent; transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; background: rgba(255,255,255,0.1);
}
.opt-item:hover { transform: scale(1.1); }
.opt-item.selected { border-color: white; box-shadow: 0 0 10px white; }

/* Ombra per contrasto personaggio */
#player i {
    filter: drop-shadow(0 0 2px black) drop-shadow(0 0 10px currentColor);
}

/* STILI FEEDBACK & UPDATES */
.glass-btn-small {
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2);
    color: white; padding: 8px 15px; border-radius: 20px; cursor: pointer;
    font-size: 0.85rem; display: flex; align-items: center; gap: 8px; transition: 0.3s;
    margin-top: 10px;
}
.glass-btn-small:hover { background: var(--accent-color); border-color: var(--accent-color); }

.star-rating { font-size: 1.8rem; color: #ffd700; cursor: pointer; margin: 10px 0; }
.star-rating i { transition: transform 0.2s; }
.star-rating i:hover { transform: scale(1.2); }
/* Le stelle piene saranno gestite via JS cambiando la classe da fa-regular a fa-solid */

/* =========================================
   5. RESPONSIVE DESIGN AVANZATO
   ========================================= */

/* --- TABLET (Fino a 1024px) --- */
@media (max-width: 1024px) {
    .app-container { padding: 15px; padding-top: 20px; }
    /* Griglia a 3 colonne per Tablet */
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; }
    .weather-card { padding: 30px; max-width: 600px; }
    .weather-header h2 { font-size: 2.5rem; }
    .temp-container span { font-size: 6rem; }
}

/* --- SMARTPHONE (Fino a 768px) --- */
@media (max-width: 768px) {
    
    /* 1. Layout Generale */
    .app-header { margin-bottom: 20px; }
    .logo { font-size: 2rem; }
    
    /* 2. Griglia Statistiche: 2 COLONNE (Fondamentale) */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
    .stat-card { padding: 15px 10px; min-height: 110px; }
    .stat-icon { font-size: 1.4rem; margin-bottom: 8px; }
    .stat-info span { font-size: 1.1rem; }
    .stat-info p { font-size: 0.8rem; }
    
    /* 3. Card Meteo */
    .weather-card { padding: 20px; margin-bottom: 25px; width: 100%; }
    .weather-header h2 { font-size: 2.2rem; }
    .temp-container span { font-size: 5rem; }
    .weather-icon i { font-size: 4rem; margin: 15px 0; }

    /* 4. Footer */
    .app-footer { flex-direction: column; text-align: center; padding: 30px 20px 140px 20px; gap: 25px; }
    .footer-links, .footer-social { width: 100%; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 20px; }
    .footer-links:last-child { border-bottom: none; }

    /* 5. DOCK BAR OTTIMIZZATA PER 6 TASTI */
    .dock-wrapper { bottom: 20px; width: 95%; max-width: 400px; }
    .dock-handle { width: 80px; height: 35px; }
    
    .floating-controls { 
        padding: 10px 15px; /* Padding ridotto */
        justify-content: space-between; 
        width: 100%;
        gap: 5px; /* Gap minimo */
    }
    
    .floating-controls button { 
        font-size: 1.3rem; /* Icone leggermente più piccole */
        width: 42px; height: 42px; /* Bottoni più piccoli per farne stare 6 */
        padding: 0;
    }

    /* 6. Lifestyle (1 colonna su schermi molto piccoli) */
    @media (max-width: 600px) {
        .lifestyle-grid { grid-template-columns: 1fr; } 
    }
    
    .modal-content { width: 95%; max-width: none; padding: 25px; }
    /* --- FIX CENTRATURA PULSANTE FEEDBACK MOBILE --- */
    .footer-social .glass-btn-small {
        margin-left: auto !important;
        margin-right: auto !important;
        margin-top: 20px !important; /* Mantiene lo spazio sopra */
        display: inline-flex; /* Assicura che si comporti bene nel flusso */
        justify-content: center; /* Centra icona e testo dentro il pulsante */
    }
}

/* =========================================
   7. SEZIONE LIFESTYLE & ATTIVITÀ (FIXED GRIGLIA)
   ========================================= */
.lifestyle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 colonne su Mobile */
    gap: 12px;
    margin-top: 15px;
    width: 100%;
    max-width: 800px;
}
@media (min-width: 600px) {
    .lifestyle-grid { grid-template-columns: repeat(3, 1fr); } /* 3 colonne su Desktop/Tablet */
}

/* Gestione sia per la vecchia classe che per la nuova */
.life-card, .lifestyle-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column; /* Icona sopra, testo sotto */
    align-items: center;
    text-align: center;
    gap: 10px;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
}
body.light-mode .life-card { background: rgba(255, 255, 255, 0.5); border-color: rgba(0,0,0,0.1); }
.life-card:hover, .life-card:active { background: rgba(255, 255, 255, 0.1); transform: translateY(-3px); border-color: var(--accent-color); }

.life-card i { font-size: 1.8rem; color: var(--accent-color); }
.life-card h3 { font-size: 1rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.life-card p { font-size: 0.8rem; opacity: 0.9; margin: 0; line-height: 1.3; }

body.light-mode .life-card h3 { color: #111 !important; }
body.light-mode .life-card p { color: #333 !important; font-weight: 600; }

/* Classi Colore JavaScript */
.status-good { color: #00ff88 !important; font-weight: 700; }
.status-warn { color: #ff9f43 !important; font-weight: 700; }
.status-bad { color: #ff4d4d !important; font-weight: 700; }

/* Adattamento Mobile per Lifestyle */
@media (max-width: 600px) {
    .lifestyle-grid { grid-template-columns: 1fr; } /* 1 colonna su schermi piccoli */
}

/* --- SMARTPHONE (fino a 768px) --- */
@media (max-width: 768px) {
    
    /* 1. Layout Generale */
    .app-header { margin-bottom: 20px; }
    .logo { font-size: 2rem; }
    
    /* 2. Griglia Statistiche: 2 COLONNE (Fondamentale per leggibilità) */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    /* Card Statistiche più compatte ma toccabili */
    .stat-card {
        padding: 15px 10px;
        min-height: 110px;
    }
    .stat-icon { font-size: 1.4rem; margin-bottom: 8px; }
    .stat-info span { font-size: 1.1rem; }
    .stat-info p { font-size: 0.8rem; }
    
    /* 3. Card Meteo Principale */
    .weather-card { 
        padding: 20px; 
        margin-bottom: 25px; 
        width: 100%;
    }
    .weather-header h2 { font-size: 2.2rem; }
    .temp-container span { font-size: 5rem; }
    .weather-icon i { font-size: 4rem; margin: 15px 0; }
    .weather-desc p { font-size: 1.2rem; }

    /* 4. Footer Impilato */
    .app-footer {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px 140px 20px; /* Spazio extra per la Dock */
        gap: 25px;
    }
    .footer-links, .footer-social { 
        width: 100%; 
        align-items: center; 
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 20px;
    }
    .footer-links:last-child { border-bottom: none; }

    /* 5. Dock Bar (Ottimizzata per le dita) */
    .dock-wrapper { bottom: 20px; width: 95%; max-width: 400px; }
    .dock-handle { width: 80px; height: 40px; } /* Maniglia più grande */
    .floating-controls { 
        padding: 15px; 
        justify-content: space-around; /* Spazia bene le icone */
        width: 100%;
    }
    .floating-controls button { 
        font-size: 1.5rem; 
        width: 50px; height: 50px; /* Area di tocco più grande */
    }

    /* 6. Modali adattati */
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 25px;
    }
}

/* --- 1. STILE CAROSELLI (Horizontal Scroll) --- */
.section-title {
    width: 100%; max-width: 800px;
    text-align: left; font-size: 1.1rem; 
    margin-bottom: 10px; margin-top: 10px;
    padding-left: 5px; opacity: 0.8; font-weight: 600;
}

.scroll-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    width: 100%; max-width: 800px;
    padding-bottom: 10px; /* Spazio per scrollbar */
    scrollbar-width: none;
}
.scroll-container::-webkit-scrollbar { display: none; }

.scroll-container.glass-effect { padding: 15px; align-items: center; }
.scroll-container.no-bg { padding: 5px 0; }

/* Forecast Cards */
.forecast-card {
    min-width: 70px;
    display: flex; flex-direction: column; align-items: center;
    scroll-snap-align: start; padding: 5px;
}
.fc-time { font-size: 0.8rem; opacity: 0.7; margin-bottom: 5px; }
.fc-icon { font-size: 1.5rem; color: var(--accent-color); margin: 5px 0; }
.fc-temp { font-weight: bold; font-size: 1rem; }

/* Stat Cards (Scrolling) */
.stat-card-scroll {
    min-width: 105px; height: 110px;
    padding: 15px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    scroll-snap-align: center;
    backdrop-filter: blur(15px);
}
.stat-icon { font-size: 1.5rem; color: var(--accent-color); margin-bottom: 8px; }
.stat-info p { font-size: 0.75rem; opacity: 0.7; margin: 0; }
.stat-info span { font-size: 1rem; font-weight: bold; }

/* --- 2. LIFESTYLE SECTION --- */
.lifestyle-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px;
}
.lifestyle-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px; padding: 15px;
    display: flex; align-items: center; gap: 15px;
    border: 1px solid transparent; transition: 0.3s;
}
.lifestyle-item:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--accent-color); }
.ls-icon {
    width: 40px; height: 40px; background: rgba(0, 210, 255, 0.1);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--accent-color);
}
.ls-info { display: flex; flex-direction: column; text-align: left; }
.ls-info span { font-size: 0.8rem; opacity: 0.7; }
.ls-info p { font-size: 1rem; font-weight: bold; margin-top: 2px; }

/* --- 3. RESPONSIVE (MOBILE FIX) --- */
@media (max-width: 768px) {
    /* Lifestyle in colonna singola se troppo stretto */
    .lifestyle-grid { grid-template-columns: 1fr; }
    
    /* Footer */
    .app-footer { flex-direction: column; text-align: center; padding-bottom: 140px; gap: 20px; }
    .footer-links, .footer-social { width: 100%; align-items: center; }

    /* DOCK BAR FIX 6 BUTTONS */
    .dock-wrapper { bottom: 15px; width: 98%; max-width: 420px; }
    .dock-handle { width: 80px; height: 35px; margin-bottom: 8px; }
    
    .floating-controls { 
        padding: 10px 10px; /* Meno padding */
        justify-content: space-around; 
        width: 100%;
        gap: 2px; /* Meno gap */
    }
    
    .floating-controls button { 
        font-size: 1.2rem; /* Icone un filo più piccole */
        width: 40px; height: 40px; /* Area touch ottimizzata */
        padding: 0;
    }
    
    /* Modali Full Width */
    .modal-content { width: 95%; max-width: none; padding: 25px; bottom: 0; }
}

/* --- NUOVI STILI (PILLOLE, SCROLL, GRAFICO) --- */

/* 1. Pillole Preferiti (Stile Moderno) */
.fav-pill {
    min-width: auto; padding: 8px 16px;
    display: flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px; cursor: pointer; transition: all 0.3s;
    white-space: nowrap; font-size: 0.9rem;
}
.fav-pill:hover { 
    background: var(--accent-color); border-color: var(--accent-color); 
    transform: translateY(-2px); color: #000; font-weight: bold; 
}

/* 2. Scroll Container (La "Linea Fantastica") */
.scroll-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    width: 100%; max-width: 800px;
    padding-bottom: 5px; /* Spazio per scrollbar invisibile */
    scrollbar-width: none; /* Firefox */
}
.scroll-container::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.scroll-container.glass-effect { padding: 15px; align-items: center; }
.scroll-container.no-bg { padding: 5px 0; }

/* 3. Card Dettagli Scorrevoli (Centrate e Animate) */
.stat-card-scroll {
    min-width: 110px; height: 120px;
    padding: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    scroll-snap-align: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.stat-card-scroll:hover { 
    transform: scale(1.1); 
    background: rgba(255,255,255,0.15); 
    border-color: var(--accent-color); 
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}
.stat-icon { font-size: 1.8rem; color: var(--accent-color); margin-bottom: 8px; }
.stat-info { text-align: center; width: 100%; }
.stat-info p { font-size: 0.75rem; opacity: 0.7; margin: 0; }
.stat-info span { font-size: 1.1rem; font-weight: bold; display: block; margin-top: 3px; }

/* 4. Forecast Orario (Striscia sotto il grafico) */
.forecast-card {
    min-width: 65px;
    display: flex; flex-direction: column; align-items: center;
    scroll-snap-align: start; padding: 5px;
    opacity: 0.8; transition: 0.2s;
}
.forecast-card:hover { opacity: 1; transform: scale(1.1); }
.fc-time { font-size: 0.8rem; margin-bottom: 5px; opacity: 0.7; }
.fc-icon { font-size: 1.4rem; color: var(--accent-color); margin: 5px 0; }
.fc-temp { font-weight: bold; font-size: 1rem; }

/* 5. Titoli Sezioni */
.section-title {
    width: 100%; max-width: 800px;
    text-align: left; font-size: 1rem; 
    padding-left: 5px; opacity: 0.8; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
}

/* ... (MANTIENI TUTTO IL CSS PRECEDENTE, MODIFICA SOLO QUESTE PARTI) ... */

/* --- RICERCA AVANZATA (ELEGANT & AUTHENTIC) --- */
.search-container { 
    position: relative; width: 100%; max-width: 500px; 
    margin-bottom: 15px; z-index: 1000; /* Z-index alto per stare sopra */
}

/* Menu a tendina Fluttuante */
.suggestions-list {
    position: absolute; 
    top: 110%; left: 0; right: 0;
    background: rgba(10, 15, 30, 0.95); /* Molto scuro, quasi solido ma vetro */
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px; 
    padding: 10px 0; 
    max-height: 0; overflow: hidden; opacity: 0;
    transform: translateY(-10px) scale(0.98); 
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    pointer-events: none;
}

.suggestions-list.show { 
    max-height: 400px; opacity: 1; 
    transform: translateY(0) scale(1); 
    overflow-y: auto; pointer-events: auto;
}

.suggestion-item {
    display: flex; align-items: center; gap: 15px;
    padding: 15px 20px; 
    cursor: pointer; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: 0.2s;
}
.suggestion-item:last-child { border-bottom: none; }

.suggestion-item:hover { 
    background: rgba(0, 210, 255, 0.15); 
    padding-left: 25px; /* Effetto slide a destra */
}

/* Bandiera e info */
.sugg-flag { font-size: 1.5rem; line-height: 1; filter: drop-shadow(0 0 5px rgba(0,0,0,0.5)); }
.sugg-info { display: flex; flex-direction: column; text-align: left; }
.sugg-name { font-size: 1rem; font-weight: 700; color: white; }
.sugg-region { font-size: 0.8rem; color: var(--accent-color); opacity: 0.8; font-weight: 500; }
.sugg-country { font-size: 0.75rem; color: #aaa; }

/* ... (Il resto del CSS va bene, assicurati che .modal-content abbia overflow hidden per il radar) ... */

/* --- NUOVO STILE CARD PREVISIONI (I "RIQUADRI" MIGLIORATI) --- */
.forecast-card {
    min-width: 80px; /* Più larghe */
    height: 155px;   /* Più alte per ospitare tutto */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-evenly; /* Spazia bene gli elementi */
    padding: 10px;
    margin: 5px;
    
    /* Stile Vetro Scuro & Bordo Neon */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px; /* Molto arrotondate */
    
    scroll-snap-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* Effetto Hover "POP" */
.forecast-card:hover {
    transform: translateY(-8px) scale(1.05);
    background: rgba(0, 210, 255, 0.15); /* Sfondo azzurrino */
    border-color: var(--accent-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.fc-time { 
    font-size: 0.85rem; 
    opacity: 0.8; 
    font-weight: 600;
}

.fc-icon { 
    font-size: 2rem; /* Icona bella grande */
    color: var(--accent-color); 
    filter: drop-shadow(0 0 8px rgba(0,210,255,0.4));
    margin: 5px 0;
}

.fc-temp { 
    font-weight: 800; 
    font-size: 1.2rem;
    color: white;
}

/* Indicatore Pioggia/Vento nella card */
.fc-extra {
    display: flex;
    gap: 5px;
    font-size: 0.7rem;
    opacity: 0.9;
    background: rgba(0,0,0,0.3);
    padding: 3px 8px;
    border-radius: 10px;
}

/* --- FIX ALLINEAMENTO STATISTICHE --- */
.stat-card-scroll {
    min-width: 110px; height: 120px;
    padding: 15px;
    /* Flexbox per centratura assoluta */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    text-align: center; /* Forza testo al centro */
    
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    scroll-snap-align: center;
    transition: transform 0.3s;
}
.stat-card-scroll:hover { 
    transform: scale(1.05); 
    background: rgba(255,255,255,0.15); 
    border-color: var(--accent-color); 
}

.stat-icon { 
    font-size: 1.8rem; 
    color: var(--accent-color); 
    margin-bottom: 8px; 
    display: block; /* Assicura che stia su una riga da sola */
}

.stat-info { width: 100%; } /* Occupa tutto lo spazio per centrare */
.stat-info p { font-size: 0.75rem; opacity: 0.7; margin: 0 0 3px 0; }
.stat-info span { font-size: 1.1rem; font-weight: bold; display: block; }

/* ... (Il resto del CSS Search, Dock, Modal rimane invariato) ... */

/* --- CURSORE PER SCROLL DA PC (DRAG) --- */
.scroll-container, .favorites-container {
    cursor: grab; /* Manina aperta */
    user-select: none; /* Evita selezione testo mentre trascini */
}
.scroll-container:active, .favorites-container:active {
    cursor: grabbing; /* Manina chiusa */
}

/* --- CARD PREVISIONI "ACTIVE" (Per l'ora selezionata) --- */
.forecast-card.active {
    background: rgba(0, 210, 255, 0.2);
    border-color: var(--accent-color);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
}

/* --- FIX LIFESTYLE VISIBILITÀ --- */
/* Forza il colore bianco e aggiunge ombra per contrasto su ogni sfondo */
.ls-info span { color: rgba(255,255,255,0.8); text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.ls-info p { 
    color: white !important; 
    font-weight: 800; 
    text-shadow: 0 1px 4px rgba(0,0,0,1); /* Ombra forte */
}

/* --- FIX MODALE CRONOLOGIA --- */
.history-item-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.history-item-row:last-child { border-bottom: none; }
.history-item-row span { font-weight: bold; }
.history-item-row small { opacity: 0.7; font-size: 0.8rem; margin-right: 10px; }
.del-hist-btn { color: #ff4d4d; cursor: pointer; }

/* ... (Config base, Video, Auth ecc. rimangono uguali) ... */
/* INCOLLA QUESTO PER SOVRASCRIVERE/AGGIUNGERE LE PARTI NUOVE */

/* --- BARRA PREVISIONI 24H (MIGLIORATA) --- */
.scroll-container {
    display: flex; overflow-x: auto; gap: 10px; width: 100%; max-width: 800px;
    padding: 10px 5px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent;
    cursor: grab; user-select: none;
}
.scroll-container:active { cursor: grabbing; }

.forecast-card {
    min-width: 80px; height: 140px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
    padding: 10px; margin: 0;
    background: rgba(255, 255, 255, 0.05); /* Vetro leggero */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px; /* Pillola allungata */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}
.forecast-card:hover, .forecast-card.active {
    background: rgba(0, 210, 255, 0.25);
    border-color: var(--accent-color);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.3);
}
/* Triangolino sotto la card attiva per indicare selezione */
.forecast-card.active::after {
    content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
    border-left: 8px solid transparent; border-right: 8px solid transparent;
    border-top: 8px solid var(--accent-color);
}

.fc-time { font-size: 0.85rem; opacity: 0.8; font-weight: 600; }
.fc-icon { font-size: 1.8rem; color: white; filter: drop-shadow(0 0 5px rgba(255,255,255,0.5)); margin: 5px 0; }
.fc-temp { font-weight: 800; font-size: 1.1rem; }

/* --- NUOVA BARRA DETTAGLI (Ordinata e Pulita) --- */
.stats-grid-scroll {
    display: flex; overflow-x: auto; gap: 15px; width: 100%; max-width: 800px;
    padding: 20px; border-radius: 30px;
    scrollbar-width: none; justify-content: flex-start; /* O center se pochi elementi */
}
/* Su Desktop centra se c'è spazio */
@media (min-width: 800px) { .stats-grid-scroll { justify-content: center; } }

.stat-item {
    min-width: 100px; padding: 10px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 8px; border-right: 1px solid rgba(255,255,255,0.1);
}
.stat-item:last-child { border-right: none; }
.stat-item i { font-size: 1.5rem; color: var(--accent-color); margin-bottom: 5px; }
.stat-item p { font-size: 0.7rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 1px; margin: 0; }
.stat-item span { font-size: 1.1rem; font-weight: 700; color: white; display: block; }

/* --- IMPOSTAZIONI (TOGGLE SWITCHES) --- */
.setting-block { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
.setting-block.border-top { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; display: block; }
.toggle-group {
    display: flex; background: rgba(0,0,0,0.3); border-radius: 20px; padding: 3px;
}
.toggle-btn {
    padding: 8px 15px; border: none; background: transparent; color: rgba(255,255,255,0.6);
    border-radius: 18px; cursor: pointer; font-weight: 600; transition: 0.3s;
}
.toggle-btn.active {
    background: var(--accent-color); color: #000; box-shadow: 0 0 10px rgba(0,210,255,0.4);
}

/* --- FOOTER MIGLIORATO --- */
.app-footer {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    padding: 30px; gap: 20px; margin-top: 30px; text-align: left;
}
@media (max-width: 600px) { .app-footer { flex-direction: column; text-align: center; } }
.logo-small { font-weight: 900; font-size: 1.2rem; background: linear-gradient(to right, #fff, var(--accent-color)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.footer-col a { display: block; margin-bottom: 8px; opacity: 0.7; transition: 0.2s; font-size: 0.9rem; }
.footer-col a:hover { opacity: 1; color: var(--accent-color); }

/* --- MODALE CRONOLOGIA --- */
.history-item-row {
    display: flex; justify-content: space-between; padding: 10px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.9rem;
}
.history-item-row span:first-child { font-weight: 600; color: white; }
.history-item-row span:last-child { color: var(--accent-color); }

/* Animation Pulse per Time Travel */
@keyframes pulse { 0% { opacity: 0.7; } 50% { opacity: 1; text-shadow: 0 0 10px var(--accent-color); } 100% { opacity: 0.7; } }

/* --- TOGGLE SWITCH STILE --- */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.2);
  -webkit-transition: .4s;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}
input:checked + .slider { background-color: var(--accent-color); }
input:focus + .slider { box-shadow: 0 0 1px var(--accent-color); }
input:checked + .slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- FIX CHIRURGICI (INCOLLA ALLA FINE DEL TUO FILE) --- */

/* 1. FIX ZOOM CARD (Aumentiamo lo spazio attorno così non vengono tagliate) */
.scroll-container {
    /* Aumenta il padding verticale a 30px per dare spazio all'ingrandimento */
    padding: 30px 10px !important; 
    /* Margine negativo per bilanciare visivamente */
    margin: -10px 0 !important;
}

.forecast-card {
    /* Margine laterale per non farle toccare quando si ingrandiscono */
    margin: 0 6px !important; 
    transform-origin: center center;
}

.forecast-card:hover, .forecast-card.active {
    /* Riduco leggermente lo zoom per sicurezza */
    transform: scale(1.08) !important; 
    z-index: 100; /* Assicura che stia sopra a tutto */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5) !important;
}

/* 2. FIX MOBILE (Per non rompere il layout su smartphone) */
@media (max-width: 768px) {
    .app-container {
        padding-bottom: 140px !important; /* Spazio per evitare che il dock copra il contenuto */
    }

    /* Le card meteo si adattano */
    .weather-card {
        padding: 20px !important;
        width: 100% !important;
    }
    
    /* Il footer diventa una colonna invece che riga */
    .app-footer {
        flex-direction: column !important;
        text-align: center !important;
        gap: 20px !important;
    }
    
    /* Le icone Lifestyle vanno una sotto l'altra */
    .lifestyle-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Adattamento tasti del Dock */
    .floating-controls {
        padding: 10px 15px !important;
    }
    .floating-controls button {
        font-size: 1.2rem !important;
    }
}

/* 3. NASCONDI ID UTENTE (Ovunque appaia) */
.user-id-display { display: none !important; }


/* =========================================
   1. CONFIGURAZIONE BASE & VARIABILI
   ========================================= */
:root {
    --text-primary: #ffffff;
    --glass-bg: rgba(10, 15, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-blur: 30px;
    --accent-color: #00d2ff;
    --error-color: #ff4d4d;
    --font-main: 'Montserrat', sans-serif;
    --shadow-color: rgba(0,0,0,0.9);
}

body.light-mode {
    --text-primary: #1a1a1a; /* Testo scuro */
    --glass-bg: rgba(255, 255, 255, 0.65); /* Vetro chiaro */
    --glass-border: rgba(0, 0, 0, 0.1); /* Bordo scuro sottile */
    --accent-color: #0066cc;
    --shadow-color: rgba(255,255,255,0.5); /* Ombre chiare */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

a { text-decoration: none; color: inherit; outline: none; }

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    text-shadow: 0 1px 3px var(--shadow-color);
}

/* Togli l'ombra al testo in light mode per leggibilità */
body.light-mode { text-shadow: none; }

/* SFONDO VIDEO */
.video-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; }
#bg-video { width: 100vw; height: 100vh; object-fit: cover; position: absolute; top: 0; left: 0; }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 1; }
/* Overlay più leggero in light mode */
body.light-mode .overlay {
    /* Mantieni un leggerissimo velo scuro per non bruciare i colori del video,
       ma usa il bianco per i pannelli di vetro */
    background: rgba(0, 0, 0, 0.2); 
}

/* UTILS */
.app-container {
    position: relative; z-index: 2; width: 100%; max-width: 1200px; margin: 0 auto;
    display: flex; flex-direction: column; align-items: center;
    padding: 20px; padding-top: 40px; padding-bottom: 120px;
}

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color: var(--text-primary); /* IMPORTANTE PER LIGHT MODE */
}

/* HEADER & SEARCH */
.app-header { margin-bottom: 20px; text-align: center; width: 100%; }
.logo { font-size: 2.2rem; font-weight: 900; letter-spacing: 2px; text-shadow: 0 0 15px rgba(0,210,255,0.6); }

.search-container { position: relative; width: 100%; max-width: 500px; margin-bottom: 15px; z-index: 100; }
.search-box { display: flex; align-items: center; padding: 12px 20px; border-radius: 50px; }
.search-box input { flex: 1; background: transparent; border: none; outline: none; color: var(--text-primary); font-size: 1.1rem; margin: 0 10px; font-weight: 600; min-width: 0; /* Fix overflow flex */ }
.search-box button, #gps-btn { background: transparent; border: none; color: var(--text-primary); font-size: 1.2rem; cursor: pointer; transition: 0.3s; flex-shrink: 0; }
.search-box button:hover, #gps-btn:hover { color: var(--accent-color); }

/* SUGGERIMENTI */
.suggestions-list {
    position: absolute; top: 110%; left: 0; right: 0;
    background: var(--glass-bg); /* Adatta al tema */
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border); border-radius: 20px; padding: 10px 0;
    max-height: 0; overflow: hidden; opacity: 0;
    transform: translateY(-10px); transition: all 0.3s; pointer-events: none;
}
.suggestions-list.show { max-height: 400px; opacity: 1; transform: translateY(0); pointer-events: auto; overflow-y: auto; }
.suggestion-item { display: flex; align-items: center; gap: 15px; padding: 15px 20px; cursor: pointer; border-bottom: 1px solid rgba(128,128,128,0.2); color: var(--text-primary); }
.suggestion-item:hover { background: rgba(0, 210, 255, 0.15); padding-left: 25px; }
.sugg-name { color: var(--text-primary); font-weight: 700; }

/* PREFERITI */
.favorites-container {
    display: flex; gap: 10px; width: 100%; max-width: 800px; overflow-x: auto;
    padding: 10px 5px; margin-bottom: 15px; scrollbar-width: none; cursor: grab;
}
.fav-pill {
    min-width: auto; padding: 8px 16px; display: flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px; cursor: pointer; transition: 0.3s; white-space: nowrap; font-weight: 600;
    color: var(--text-primary);
}
/* In light mode i preferiti devono essere visibili */
body.light-mode .fav-pill { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); }
.fav-pill:hover { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }

/* CARD METEO PRINCIPALE */
.weather-card { width: 100%; max-width: 500px; padding: 30px; text-align: center; margin-bottom: 25px; }
.weather-header h2 { font-size: 2.5rem; margin-bottom: 5px; color: var(--text-primary); }
.weather-icon i { font-size: 5rem; margin: 20px 0; color: var(--accent-color); filter: drop-shadow(0 0 15px rgba(0,210,255,0.3)); }
.temp-container span { font-size: 6rem; font-weight: 200; line-height: 1; color: var(--text-primary); }
.weather-desc p { font-size: 1.2rem; text-transform: capitalize; font-weight: 500; color: var(--text-primary); }

/* TIMELINE PREVISIONI */
.scroll-container {
    display: flex; overflow-x: auto; gap: 10px; width: 100%; max-width: 800px;
    padding: 30px 10px; /* Spazio per zoom */
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent;
    cursor: grab; user-select: none;
    margin: -10px 0;
}
.scroll-container:active { cursor: grabbing; }

.forecast-card {
    min-width: 85px; height: 145px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
    padding: 10px; margin: 0 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 35px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative; transform-origin: center;
}
body.light-mode .forecast-card { background: rgba(255, 255, 255, 0.4); border-color: rgba(0,0,0,0.1); }

.forecast-card:hover, .forecast-card.active {
    transform: scale(1.08); /* Zoom controllato */
    background: rgba(0, 210, 255, 0.25);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(0, 210, 255, 0.4);
    z-index: 10;
}
.forecast-card.active::after {
    content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
    border-left: 8px solid transparent; border-right: 8px solid transparent;
    border-top: 8px solid var(--accent-color);
}
.fc-time { font-size: 0.85rem; font-weight: 600; opacity: 0.9; color: var(--text-primary); }
.fc-icon { font-size: 2rem; color: var(--text-primary); margin: 5px 0; filter: drop-shadow(0 0 5px rgba(128,128,128,0.5)); }
.fc-temp { font-weight: 800; font-size: 1.1rem; color: var(--text-primary); }
.fc-extra { font-size: 0.7rem; color: #66ccff; display: flex; align-items: center; gap: 3px; background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 10px; }

/* DETTAGLI (STRISCIA ORIZZONTALE) */
.stats-grid-scroll {
    display: flex; overflow-x: auto; gap: 15px; width: 100%; max-width: 800px;
    padding: 20px; border-radius: 30px;
    scrollbar-width: none; justify-content: flex-start; cursor: grab;
}
@media (min-width: 800px) { .stats-grid-scroll { justify-content: center; } }

.stat-item {
    min-width: 110px; padding: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 8px; border-right: 1px solid rgba(255,255,255,0.1);
}
body.light-mode .stat-item { border-right-color: rgba(0,0,0,0.1); }
.stat-item:last-child { border-right: none; }
.stat-item i { font-size: 1.5rem; color: var(--accent-color); margin-bottom: 5px; }
.stat-item p { font-size: 0.7rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 1px; margin: 0; color: var(--text-primary); }
.stat-item span { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); display: block; }

/* LIFESTYLE */
.lifestyle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; width: 100%; }
.lifestyle-item {
    background: rgba(255, 255, 255, 0.05); border-radius: 20px; padding: 20px;
    display: flex; align-items: center; gap: 15px; transition: 0.3s;
}
body.light-mode .lifestyle-item { background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(0,0,0,0.05); }
.ls-icon { 
    font-size: 1.5rem; color: var(--accent-color); width: 50px; height: 50px; 
    background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.ls-info p { font-weight: 800; font-size: 1.1rem; color: var(--text-primary) !important; margin-top: 5px; }

/* DOCK BAR
.dock-wrapper { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; width: 95%; max-width: 420px; transition: transform 0.4s; }
.dock-wrapper.hidden { transform: translate(-50%, 150%); }
.dock-handle { width: 60px; height: 6px; background: rgba(128,128,128,0.5); border-radius: 10px; margin: 0 auto 10px auto; cursor: pointer; }
.floating-controls {
    display: flex; justify-content: space-between; padding: 15px 25px;
    background: var(--glass-bg); backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border); border-radius: 50px;
}
.floating-controls button { font-size: 1.4rem; color: var(--text-primary); opacity: 0.7; background: none; border: none; cursor: pointer; transition: 0.2s; }
.floating-controls button:hover { color: var(--accent-color); opacity: 1; transform: translateY(-5px); } */

/* FOOTER */
.app-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 30px;
    width: 100%; max-width: 900px; margin-top: 40px; padding: 20px; text-align: left;
}
.logo-small { font-weight: 900; font-size: 1.2rem; color: var(--text-primary); }
.footer-col a { display: block; margin-bottom: 8px; opacity: 0.7; transition: 0.2s; font-size: 0.9rem; color: var(--text-primary); }
.footer-col a:hover { opacity: 1; color: var(--accent-color); }

/* --- RESPONSIVE MOBILE FIX --- */
@media (max-width: 768px) {
    .app-container { padding: 15px; padding-bottom: 140px; }
    
    /* FIX RICERCA: Padding ridotto per evitare che l'icona esca */
    .search-box { padding: 10px 15px; } 
    .search-box input { margin: 0 5px; font-size: 1rem; }
    
    .weather-card { padding: 20px; width: 100%; }
    .weather-header h2 { font-size: 2rem; }
    .temp-container span { font-size: 5rem; }
    
    .lifestyle-grid { grid-template-columns: 1fr; }
    .lifestyle-item { padding: 15px; }
    
    .app-footer { flex-direction: column; text-align: center; }
    
    .floating-controls { padding: 10px 15px; }
    .floating-controls button { font-size: 1.2rem; }
}

/* MODALI & SETTINGS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 2000; display: none; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.modal-content { 
    width: 90%; max-width: 400px; padding: 25px; border-radius: 25px; max-height: 85vh; overflow-y: auto; 
    background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: 0 0 30px rgba(0,0,0,0.5); color: var(--text-primary);
}
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; color: var(--text-primary); }

.toggle-group { display: flex; background: rgba(128,128,128,0.2); border-radius: 20px; padding: 4px; }
.toggle-btn { flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-primary); opacity: 0.6; border-radius: 16px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.toggle-btn.active { background: var(--accent-color); color: #fff; opacity: 1; }

.switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(128,128,128,0.3); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(26px); }

/* PROFILO */
.user-id-display { display: none !important; }
.profile-header-card h2, .profile-email { color: var(--text-primary); }

/* --- STILI PROFILO "DARK DASHBOARD" (Come da foto) --- */

.profile-wrapper {
    max-width: 600px; /* Più stretto per sembrare una app mobile */
    margin: 80px auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Base delle Card */
.dashboard-card {
    background: rgba(15, 23, 42, 0.95); /* Blu notte molto scuro/opaco */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: left;
    color: white;
}

/* CARD 1: UTENTE */
.card-top-row {
    display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px;
}
.user-header h2 {
    font-size: 1.8rem; margin: 0; font-weight: 800;
    display: flex; align-items: center; gap: 10px;
}
.edit-icon { font-size: 1rem; color: #00d2ff; cursor: pointer; opacity: 0.8; transition: 0.2s; }
.edit-icon:hover { transform: scale(1.2); opacity: 1; }

.logout-btn-small {
    background: rgba(255, 77, 77, 0.15);
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: 0.3s;
}
.logout-btn-small:hover { background: #ff4d4d; color: white; }

/* Pulsanti Avatar Quadrati (Come foto) */
.avatar-selector-row { display: flex; gap: 15px; margin-bottom: 20px; }
.avatar-btn {
    width: 60px; height: 60px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; cursor: pointer; transition: 0.3s;
}
.avatar-btn.male { color: #00d2ff; } /* Ciano */
.avatar-btn.female { color: #ff00de; } /* Magenta */

/* Stato Selezionato (Glow) */
.avatar-btn.male.selected {
    border-color: #00d2ff;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
    background: rgba(0, 210, 255, 0.1);
}
.avatar-btn.female.selected {
    border-color: #ff00de;
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.3);
    background: rgba(255, 0, 222, 0.1);
}

.user-meta { font-size: 0.9rem; opacity: 0.9; display: flex; align-items: center; gap: 10px; }
.badge-pro { 
    background: #00d2ff; color: #000; 
    font-size: 0.65rem; padding: 2px 6px; 
    border-radius: 4px; font-weight: 900; letter-spacing: 1px;
}

/* CARD 2: CARRIERA (GAME) */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.rocket-anim { color: #00d2ff; }

.rank-pill {
    background: rgba(255, 215, 0, 0.1); color: #ffd700; border: 1px solid #ffd700;
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}

.score-display { display: flex; align-items: baseline; gap: 10px; margin-bottom: 15px; }
.score-display span { font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.score-display small { opacity: 0.6; font-size: 0.9rem; }

.progress-container {
    height: 8px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; margin-bottom: 5px;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #00d2ff, #00ff88); /* Gradiente Ciano-Verde */
    border-radius: 10px; transition: width 1s ease-out;
}
.next-rank-text { text-align: right; font-size: 0.75rem; opacity: 0.5; }

.divider { border: 0; border-top: 1px solid rgba(255,255,255,0.1); margin: 20px 0; }

/* GRID TROFEI (Per riempire verticale) */
.badges-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.badge-item {
    background: rgba(255,255,255,0.03); border-radius: 10px; padding: 15px 5px;
    border: 1px solid transparent; opacity: 0.4; transition: 0.3s;
}
.badge-item i { font-size: 1.5rem; display: block; margin-bottom: 5px; }
.badge-item span { font-size: 0.7rem; display: block; }

/* Trofeo Sbloccato */
.badge-item.unlocked { opacity: 1; border-color: #ffd700; background: rgba(255, 215, 0, 0.1); color: #ffd700; box-shadow: 0 0 10px rgba(255,215,0,0.2); }

/* LISTA STORICO VERTICALE */
.history-list-vertical { display: flex; flex-direction: column; gap: 10px; max-height: 200px; overflow-y: auto; }
.history-row-item {
    display: flex; justify-content: space-between; padding: 12px;
    background: rgba(255,255,255,0.05); border-radius: 10px; font-size: 0.9rem;
}

/* --- AGGIUNTA LOGO FOOTER --- */
.footer-logo-img {
    height: 60px; /* Dimensione logo footer */
    width: auto;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.5)); /* Bagliore Ciano */
    transition: transform 0.3s;
}
.footer-logo-img:hover {
    transform: scale(1.1); /* Leggero zoom al passaggio */
    filter: drop-shadow(0 0 15px rgba(0, 210, 255, 0.8));
}

/* --- FIX COLORI TEMA CHIARO (Light Mode Visibility) --- */

/* 1. Indice Qualità Aria (AQI) */
/* Quando è verde neon in dark mode, diventa verde scuro in light mode */
body.light-mode #air-quality[style*="rgb(0, 255, 136)"], 
body.light-mode #air-quality[style*="#00ff88"] {
    color: #008f4c !important; /* Verde scuro leggibile */
    font-weight: 800;
}
/* Se fosse giallo/arancione, lo scuriamo un po' */
body.light-mode #air-quality[style*="orange"] {
    color: #d65a00 !important;
}

/* 2. Lifestyle (Running, Bici, ecc) */
/* Forza il colore del testo a scuro, ignorando il "white" del CSS base */
body.light-mode .ls-info p {
    color: #1a1a1a !important; /* Grigio scuro quasi nero */
    text-shadow: none !important; /* Rimuove l'ombra scura */
}
body.light-mode .ls-info span {
    color: #555 !important; /* Etichetta grigio medio */
    text-shadow: none !important;
}

/* 3. Colore Testo nelle Textarea (Feedback) in Light Mode */
body.light-mode textarea {
    background: rgba(0,0,0,0.05) !important;
    border-color: rgba(0,0,0,0.1) !important;
    color: #000 !important;
}

/* --- STILE SOCIAL ICONS FOOTER --- */
.social-icons-row {
    display: flex; gap: 15px; justify-content: center; /* O flex-start se preferisci allineato a sx */
    margin-bottom: 10px;
}
@media (min-width: 768px) { .social-icons-row { justify-content: flex-start; } }

.social-icons-row a {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: white;
    transition: 0.3s;
}
body.light-mode .social-icons-row a {
    background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: #333;
}

.social-icons-row a:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.4);
    border-color: var(--accent-color);
}

/* --- STILE NUOVI PULSANTI PROFILO --- */

/* 1. Tasto Logout (Rosso con testo) */
.btn-logout-text {
    display: flex;
    align-items: center;
    gap: 8px; /* Spazio tra icona e testo */
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.4);
    color: #ff4d4d;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout-text:hover {
    background: #ff4d4d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 77, 77, 0.3);
}

/* 2. Tasto Reset Password (Largo e Moderno) */
.btn-reset-pwd {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset-pwd:hover {
    background: rgba(0, 210, 255, 0.15); /* Leggero tocco Ciano */
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* Adattamento Mobile: riduciamo il testo se lo schermo è minuscolo */
@media (max-width: 400px) {
    .btn-logout-text span { display: none; } /* Mostra solo icona su schermi piccolissimi */
    .btn-logout-text { padding: 8px 12px; }
}

/* --- COLORI STATO LIFESTYLE --- */
.status-good { color: #00ff88 !important; font-weight: 700; }   /* Verde Fluo */
.status-warn { color: #ff9f43 !important; font-weight: 700; }   /* Arancione */
.status-bad { color: #ff4d4d !important; font-weight: 700; }    /* Rosso */

/* Migliora leggibilità testo */
.ls-info p {
    font-size: 0.9rem;
    line-height: 1.3;
    opacity: 0.9;
    margin-top: 3px;
}

/* --- LISTA PREVISIONI SETTIMANALI --- */
.daily-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.daily-item:last-child {
    border-bottom: none; /* Rimuove la riga sotto l'ultimo giorno */
}

.daily-day {
    width: 35%;
    font-weight: 600;
    font-size: 1rem;
    text-transform: capitalize;
}

.daily-icon {
    width: 20%;
    text-align: center;
    font-size: 1.3rem;
    color: #fff; /* O il colore che preferisci */
}

.daily-temps {
    width: 45%;
    text-align: right;
    font-size: 1rem;
}

.temp-min {
    opacity: 0.6;
    margin-right: 15px;
}

.temp-max {
    font-weight: 800;
}

/* Adattamento per il Tema Chiaro */
body.light-mode .daily-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
body.light-mode .daily-icon {
    color: #444; /* Icone scure sul tema chiaro */
}

/* MIGLIORAMENTO VISIBILITÀ TEMA CHIARO */

/* Barra di ricerca e icone interne */
body.light-mode .search-box {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .search-box input {
    color: #333 !important;
}

body.light-mode .search-box i {
    color: #555 !important;
}

/* Pulsante "Invia Feedback" e altri pulsanti glass piccoli */
body.light-mode .glass-btn-small, 
body.light-mode .glass-btn {
    background: rgba(0, 0, 0, 0.08) !important; /* Grigio leggero invece di bianco */
    color: #222 !important; /* Testo quasi nero per massimo contrasto */
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    font-weight: 700 !important;
}

body.light-mode .glass-btn-small i, 
body.light-mode .glass-btn i {
    color: #222 !important;
}

/* Fix specifico per l'icona del feedback che appariva scurissima */
body.light-mode .glass-btn-small i.fa-comment-dots {
    opacity: 0.8;
}

/* Testi Lifestyle (Running, Trekking ecc) */
body.light-mode .ls-info p {
    color: #111 !important; /* Nero profondo */
    font-weight: 800 !important;
}

/* Indice Qualità Aria (AQI) quando è verde */
body.light-mode #air-quality[style*="rgb(0, 255, 136)"],
body.light-mode #air-quality[style*="#00ff88"] {
    color: #007a41 !important; /* Verde foresta leggibile */
    text-shadow: none !important;
}

body.light-mode .glass-effect {
    backdrop-filter: blur(15px) brightness(0.95) !important;
}

/* --- STILE PAGINA LEGAL --- */
.legal-container {
    max-width: 900px;
    margin: 100px auto 50px auto;
    padding: 40px;
    border-radius: 30px;
    line-height: 1.6;
    text-align: left;
}

.legal-container h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.legal-container h2 {
    font-size: 1.3rem;
    margin-top: 30px;
    margin-bottom: 15px;
    border-left: 4px solid var(--accent-color);
    padding-left: 15px;
}

.legal-container ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.legal-container li {
    margin-bottom: 10px;
}

.last-update {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 30px;
    font-style: italic;
}

/* Adattamento Mobile */
@media (max-width: 768px) {
    .legal-container {
        margin: 80px 15px 30px 15px;
        padding: 25px;
    }
    .legal-container h1 { font-size: 1.6rem; }
}

/* Fix Colori Light Mode per Legal */
body.light-mode .legal-container {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
}
body.light-mode .legal-container h2 {
    color: #0077b6;
}

/* --- LAYOUT A STACK (GIORNI VERTICALI, ORE ORIZZONTALI) --- */
.day-block {
    padding: 15px 5px; /* Poco padding laterale per far scorrere bene le card */
    display: flex; flex-direction: column;
    overflow: hidden; /* Evita che la sfocatura esca dai bordi */
}

.day-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 15px 15px 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
body.light-mode .day-header { border-bottom-color: rgba(0,0,0,0.1); }

.dh-left { display: flex; align-items: center; gap: 12px; }
.dh-left i { font-size: 1.6rem; color: var(--accent-color); filter: drop-shadow(0 0 5px rgba(0,210,255,0.4)); }
.dh-title { font-size: 1.2rem; font-weight: 800; text-transform: capitalize; color: var(--text-primary); }

.dh-right { display: flex; align-items: center; gap: 10px; }
.dh-min { font-size: 0.95rem; opacity: 0.7; font-weight: 600; }
.dh-max { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }

/* Piccola barra della temperatura in stile Apple */
.dh-bar-bg { width: 50px; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 5px; overflow: hidden; }
.dh-bar-fill { width: 100%; height: 100%; background: linear-gradient(90deg, #00d2ff, #ff6b6b); border-radius: 5px; }
body.light-mode .dh-bar-bg { background: rgba(0,0,0,0.1); }

/* Rimuovi l'altezza fissa dal forecast-card se era rimasta troppo alta */
.forecast-card .fc-date { display: none; /* Nascondiamo la data piccola perché ora abbiamo il titolo grande */ }

/* --- ARCO ASTRONOMICO FIX DEFINITIVO --- */
.astro-arc-container {
    width: 200px;
    height: 100px; /* Altezza perfetta per contenere l'arco e la luce */
    position: relative;
    margin: 0 auto;
}

.astro-arc-line-box {
    position: absolute;
    bottom: 10px; /* La linea di base dell'arco è a 10px dal fondo */
    left: 20px;   /* Centrato (200 - 160) / 2 */
    width: 160px;
    height: 80px; /* Metà esatta del cerchio */
    overflow: hidden; /* Taglia via la metà inferiore del tratteggio */
}

.astro-arc-path {
    width: 160px;
    height: 160px; /* Cerchio completo */
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    position: absolute;
    top: 0; 
    left: 0;
}
body.light-mode .astro-arc-path { border-color: rgba(0,0,0,0.15); }

.astro-rotator {
    width: 160px;
    height: 160px;
    position: absolute;
    /* LA CHIAVE MATEMATICA: 
       Altezza 160. Centro = 80.
       Vogliamo che il centro sia a bottom 10px come la linea. 
       Quindi: -70px (fondo) + 80px (metà) = 10px! Perfetto. */
    bottom: -70px; 
    left: 20px;
    transform-origin: center center;
    transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.astro-body {
    position: absolute;
    top: -12px;
    left: 50%;
    /* Il transform, il color e il text-shadow ora li gestisce 100% il JavaScript! */
    font-size: 1.5rem;
    filter: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* --- FIX SEZIONE DETTAGLI --- */
.stat-item {
    min-width: 130px !important; /* Più largo per non tagliare il testo */
    padding: 15px 10px !important;
}
.stat-item p {
    white-space: nowrap; /* Impedisce al testo di andare a capo spezzandosi */
    font-size: 0.8rem !important; /* Leggermente più leggibile */
    letter-spacing: 0.5px;
}

/* --- ANIMAZIONE A TENDINA (PREVISIONI 7 GIORNI) --- */
.future-days-wrapper {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Quando l'utente clicca il pulsante, si espande dolcemente */
.future-days-wrapper.expanded {
    max-height: 5000px; /* Altezza sufficiente a contenere tutto */
    opacity: 1;
    margin-top: 20px;
}

/* Pulsante "Mostra 7 Giorni" */
.expand-forecast-btn {
    margin: 10px auto 20px auto;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 10px 25px; /* Ridotto */
    font-size: 0.9rem; /* Testo più piccolo e raffinato */
    font-weight: 700;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 30px; /* Forma a pillola */
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.15);
    width: 100%; max-width: 280px; /* Meno largo */
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; transition: 0.3s;
}

.expand-forecast-btn:hover {
    background: var(--accent-color);
    color: #000;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.4);
}

/* --- FIX PULSANTE 7 GIORNI (Più compatto ed elegante) --- */

.expand-forecast-btn:hover {
    background: var(--accent-color); color: #000;
    transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 210, 255, 0.3);
}

/* --- NUOVA DASHBOARD DETTAGLI (WIDGET STYLE) --- */
.details-dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 colonne su mobile */
    gap: 15px;
    width: 100%; max-width: 800px;
    margin-bottom: 30px;
}

/* Widget Base */
.widget-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 15px;
    display: flex; flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s, background 0.3s;
}
.widget-card:hover { 
    transform: translateY(-3px); 
    background: rgba(255, 255, 255, 0.1); 
    border-color: var(--accent-color);
}
body.light-mode .widget-card { background: rgba(255, 255, 255, 0.5); border-color: rgba(0,0,0,0.1); }

/* Widget Grande (Ciclo Solare) */
.widget-large {
    grid-column: span 2; /* Occupa tutta la larghezza su mobile */
    align-items: center;
}

/* Widget Piccoli (Vento, Umidità, ecc) */
.widget-small {
    align-items: flex-start; /* Testo allineato a sinistra per eleganza */
}

/* Tipografia interna ai Widget */
.widget-title {
    font-size: 0.75rem; opacity: 0.7;
    text-transform: uppercase; letter-spacing: 1px;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 15px;
}
.widget-title i { color: var(--accent-color); font-size: 1rem; }
.widget-value { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }

/* Adattamento PC: 4 Colonne */
@media (min-width: 768px) {
    .details-dashboard { grid-template-columns: repeat(4, 1fr); }
    .widget-large { grid-column: span 2; grid-row: span 2; } /* Un bel quadrato grande a sinistra */
}

/* =========================================
   FIX GRAFICI CHATBOT PREMIUM
   ========================================= */

/* Animazione di entrata dei messaggi */
.msg-anim {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes popIn {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bolle di Chat Stile Moderno */
.bubble {
    padding: 15px 20px;
    border-radius: 20px;
    line-height: 1.5;
    font-size: 0.95rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.bubble-ai {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top-left-radius: 5px;
    color: var(--text-primary);
}
body.light-mode .bubble-ai {
    background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1);
}

.bubble-user {
    background: linear-gradient(135deg, #00d2ff 0%, #0066cc 100%);
    color: white;
    border-top-right-radius: 5px;
    border: none;
    font-weight: 500;
}

/* Avatars dentro la Chat */
.ai-avatar-chat {
    width: 38px; height: 38px; min-width: 38px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-right: 12px; color: var(--accent-color); font-size: 1.1rem;
}

.user-avatar-chat {
    width: 38px; height: 38px; min-width: 38px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-left: 12px; font-size: 1.4rem;
}

/* Barra laterale Cronologia (Migliorata) */
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 15px; border-radius: 12px; cursor: pointer;
    font-size: 0.9rem; opacity: 0.8; margin-bottom: 8px;
    background: rgba(255,255,255,0.03); transition: 0.2s;
    border: 1px solid transparent;
}
.history-item:hover {
    background: rgba(255,255,255,0.1);
    opacity: 1; transform: translateX(5px);
}
.history-item.active {
    background: rgba(0, 210, 255, 0.15);
    border-color: var(--accent-color);
    color: white; opacity: 1; font-weight: bold;
}
.history-item span {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.history-item span i { margin-right: 8px; opacity: 0.7; }

/* Tasto Elimina Chat */
.del-chat-btn {
    color: #ff4d4d; opacity: 0; padding: 5px; transition: 0.3s;
}
.history-item:hover .del-chat-btn { opacity: 1; }
.del-chat-btn:hover { transform: scale(1.2); filter: drop-shadow(0 0 5px red); }

/* =========================================
   FIX MENU LATERALE MOBILE CHAT
   ========================================= */
@media (max-width: 800px) {
    .chat-sidebar {
        position: absolute !important;
        top: 0; left: 0;
        height: 100%;
        z-index: 2000;
        background: rgba(10, 15, 30, 0.98) !important;
        backdrop-filter: blur(25px);
        transform: translateX(-100%);
        width: 85%;
        max-width: 320px;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .chat-sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-sidebar-toggle {
        display: block !important;
        margin-right: 15px;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }
}

/* Badge Note Aggiornamento */
.badge {
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 20px;
    margin-right: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    margin-top: 2px;
}
.badge.new { background: rgba(0, 210, 255, 0.15); color: #00d2ff; border: 1px solid rgba(0, 210, 255, 0.3); }
.badge.fix { background: rgba(255, 170, 0, 0.15); color: #ffaa00; border: 1px solid rgba(255, 170, 0, 0.3); }

/* =========================================
   SISTEMA DI ALLERTE METEO (Smart Alerts)
   ========================================= */
#weather-alert-badge {
    /* Stile base */
    display: none; /* Nascosto di default */
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    /* Centratura orizzontale */
    margin: 10px auto 5px auto; 
    width: fit-content;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

/* Livello 1: Giallo (Avviso) */
.alert-yellow {
    background: rgba(255, 211, 42, 0.15);
    border: 1px solid #ffd32a;
    color: #ffd32a;
    box-shadow: 0 0 10px rgba(255, 211, 42, 0.2);
}

/* Livello 2: Arancione (Attenzione) */
.alert-orange {
    background: rgba(255, 159, 67, 0.15);
    border: 1px solid #ff9f43;
    color: #ff9f43;
    box-shadow: 0 0 12px rgba(255, 159, 67, 0.25);
}

/* Livello 3: Rosso (Pericolo) */
.alert-red {
    background: rgba(255, 77, 77, 0.15);
    border: 1px solid #ff4d4d;
    color: #ff4d4d;
    box-shadow: 0 0 15px rgba(255, 77, 77, 0.3);
}

/* FIX GIOCO MOBILE */
#game-container {
    touch-action: none; /* Disattiva lo scroll e lo zoom nativo */
    user-select: none;  /* Evita che selezioni il testo tappando */
    -webkit-user-select: none;
}

body.light-mode {
    background-color: #0a0f18 !important; /* Mantiene il fondale nero per non sbiadire il video */
}

body.light-mode .overlay {
    background: rgba(0, 0, 0, 0.15); /* Riduciamo la nebbia bianca sopra il video */
}

/* =========================================
   FIX COLORI E ANIMAZIONI TEMA CHIARO (MIRATO)
   ========================================= */

/* 1. Scritte specifiche bianche con ombra (per non farle sparire sul video chiaro) */
body.light-mode .section-title,
body.light-mode #city-name,
body.light-mode .favorites-container > div {
    color: #ffffff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7); 
}

/* 2. Testo bianco per i bottoni (es. Prossimi 7 gg) */
body.light-mode .glass-btn,
body.light-mode .glass-btn-small,
body.light-mode .auth-btn {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* 3. Animazione specifica per le città preferite nel tema chiaro */
body.light-mode .favorites-container > div {
    transition: all 0.3s ease;
}

body.light-mode .favorites-container > div:hover {
    transform: translateY(-3px) scale(1.05);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    /* Sostituisce il neon colorato scuro con un bagliore bianco ed elegante */
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.5); 
}

/* =========================================
   FIX PULSANTI E FEEDBACK (TEMA CHIARO E SCURO)
   ========================================= */

/* 1. Fix animazione mancante per il pulsante Feedback (e tutti i bottoni piccoli) */
.glass-btn-small {
    transition: all 0.3s ease;
}
.glass-btn-small:hover {
    transform: translateY(-2px);
    background: rgba(0, 210, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

/* 2. Applica l'effetto luminoso "Città Preferita" ai bottoni nel Tema Chiaro */
body.light-mode .glass-btn,
body.light-mode .glass-btn-small,
body.light-mode .auth-btn,
body.light-mode #dock-toggle {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
    transition: all 0.3s ease !important;
}

/* 3. Hover (quando ci passi sopra) per Tema Chiaro */
body.light-mode .glass-btn:hover,
body.light-mode .glass-btn-small:hover,
body.light-mode .auth-btn:hover,
body.light-mode #dock-toggle:hover {
    transform: translateY(-3px) scale(1.05) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    /* Bagliore bianco morbido come le città preferite */
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.5) !important; 
}

/* =========================================
   FIX VISIBILITÀ STRUMENTI AVANZATI
   ========================================= */

/* Aumentiamo il grassetto e l'opacità delle etichette dei calcolatori */
.input-group-snow label {
    font-weight: 800 !important; /* Grassetto massimo */
    opacity: 1 !important; /* Togliamo la trasparenza per renderle solide */
    color: #ffffff !important; /* Forza il bianco */
    font-size: 0.85rem !important; /* Leggermente più grandi */
    letter-spacing: 0.5px !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important; /* Ombra per il contrasto */
}

/* Facciamo in modo che si leggano perfettamente anche se si usa il tema chiaro */
body.light-mode .input-group-snow label {
    color: #000000 !important;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8) !important;
}

/* =========================================
   FIX MOBILE: ANTI-LAG & SFONDO
   ========================================= */

/* 1. Evita il salto del layout quando scompare la barra degli indirizzi */
body {
    min-height: 100dvh; /* dvh si adatta dinamicamente senza scatti */
    overflow-x: hidden;
}

/* 2. Fissa il contenitore del video come se fosse inchiodato al muro */
.video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: -2;
    overflow: hidden;
    pointer-events: none; /* Ignora i tocchi */
}

/* 3. ACCELERAZIONE HARDWARE PER IL VIDEO E L'OVERLAY (ANTI-LAG) */
#bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translateZ(0); /* Forza l'uso della GPU dello smartphone */
    will-change: transform;   /* Avvisa il browser che questo elemento è 'pesante' */
    backface-visibility: hidden;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: -1;
    transform: translateZ(0);
    pointer-events: none;
}

/* 4. ACCELERAZIONE HARDWARE PER I PANNELLI DI VETRO */
/* Calcolare la sfocatura (backdrop-filter) mentre si scorre causa lag. Questo lo previene. */
.glass-effect, 
.forecast-card, 
.day-block, 
.widget, 
.favorites-container > div {
    transform: translateZ(0); 
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, opacity;
}

@keyframes slideUpFade { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes slideDownFade { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, 20px); } }

/* =========================================
   STILI PAGINA PRIVACY & LEGAL (OTTIMIZZATI)
   ========================================= */
.legal-container {
    width: 90%;
    max-width: 800px;
    margin: 90px auto 40px auto;
    padding: 35px;
    border-radius: 15px;
    line-height: 1.6;
    transform: translateZ(0); /* Anti-lag su mobile */
    color: rgba(255, 255, 255, 0.9); /* Testo base morbido */
}

/* Adattamento automatico al Tema Chiaro */
body.light-mode .legal-container {
    color: rgba(0, 0, 0, 0.85);
}

.legal-container h1 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 800;
}

.legal-container .last-update {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 35px;
}

.legal-container h2 {
    font-size: 1.2rem;
    margin-top: 35px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
    font-weight: 800;
}

body.light-mode .legal-container h2 {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.legal-container p, .legal-container li {
    font-size: 0.9rem; /* Scritte leggermente più piccole */
    margin-bottom: 12px;
}

.legal-container ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.legal-container strong {
    font-weight: 800;
    /* Tolti i colori fluo: ora il grassetto è solo più spesso */
}

/* Bottone Indietro Fluttuante */
.nav-home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

body.light-mode .nav-home-btn {
    background: rgba(255,255,255,0.4);
    border-color: rgba(0,0,0,0.2);
    color: black;
}

/* --- RESPONSIVE MOBILE (La vera magia per lo smartphone) --- */
/* =========================================
   FIX MENU LATERALE MOBILE CHAT
   ========================================= */
@media (max-width: 800px) {
    .chat-layout {
        padding: 10px; /* Meno padding su mobile per dare più spazio alla chat */
        margin: 10px auto;
        height: calc(100vh - 40px); /* Usa tutto lo schermo disponibile */
    }

    .chat-sidebar {
        position: fixed !important; /* Fixed lo sgancia completamente dal layout, come un popup */
        top: 0; left: 0;
        height: 100vh !important;
        z-index: 3000 !important; /* Deve stare sopra ogni altra cosa */
        background: rgba(10, 15, 30, 0.98) !important;
        backdrop-filter: blur(25px);
        transform: translateX(-100%);
        width: 75%; /* Ridotto: non occupa tutto lo schermo, lascia intravedere dietro */
        max-width: 300px;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 50px; /* Spazio in alto per non finire sotto la barra di stato del telefono */
    }
    
    .chat-sidebar.open {
        transform: translateX(0);
    }
    
    /* Aggiungiamo un overlay scuro quando la sidebar è aperta per far risaltare il menu e nascondere la chat dietro */
    .chat-layout::before {
        content: '';
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(0,0,0,0.6);
        z-index: 2999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    /* Quando la sidebar è aperta, l'overlay diventa visibile (usiamo una classe che aggiungeremo col JS) */
    .chat-layout.sidebar-active::before {
        opacity: 1;
        pointer-events: auto; /* Cattura i tocchi per chiudere la sidebar cliccando fuori */
    }

    .mobile-sidebar-toggle {
        display: block !important;
        margin-right: 15px;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }

    /* Riduciamo le bolle di testo su mobile per guadagnare spazio */
    .bubble {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* Bottone Indietro Fluttuante */
.nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.nav-home-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    border-color: #ffffff;
}

/* =========================================
   LAYOUT PRIVACY "PREMIUM" (MeteoSite Style + Glass)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;700&display=swap');

.privacy-wrapper {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 80px auto 40px auto;
    padding: 40px 32px 100px;
    font-family: 'DM Sans', sans-serif;
    color: rgba(255, 255, 255, 0.9);
}

body.light-mode .privacy-wrapper {
    color: rgba(0, 0, 0, 0.85);
}

/* Header Privacy */
.privacy-header {
    text-align: center;
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

body.light-mode .privacy-header { border-bottom-color: rgba(0,0,0,0.1); }

.privacy-header h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 15px;
}
.privacy-header h1 em { color: #00d2ff; font-style: italic; }
.privacy-meta { font-size: 0.85rem; opacity: 0.7; letter-spacing: 0.05em; }

/* Indice (TOC) a Vetro */
.privacy-toc {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 4px solid #00d2ff;
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 56px;
}
body.light-mode .privacy-toc { background: rgba(255, 255, 255, 0.5); border-color: rgba(0,0,0,0.1); }

.toc-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #00d2ff;
    margin-bottom: 16px;
}
.privacy-toc ol { list-style: none; counter-reset: toc; columns: 2; column-gap: 32px; padding: 0; }
@media(max-width: 600px) { .privacy-toc ol { columns: 1; } }
.privacy-toc li { counter-increment: toc; font-size: 0.9rem; padding: 6px 0; }
.privacy-toc li::before { content: counter(toc, decimal-leading-zero) ". "; color: #00d2ff; font-weight: bold; margin-right: 5px; }
.privacy-toc a { color: inherit; text-decoration: none; transition: 0.2s; opacity: 0.8; }
.privacy-toc a:hover { color: #00d2ff; opacity: 1; }

/* Sezioni */
.privacy-section { margin-bottom: 50px; scroll-margin-top: 90px; }
.section-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.section-number {
    font-family: 'DM Serif Display', serif;
    font-size: 0.9rem;
    color: #00d2ff;
    padding-top: 6px;
}
.privacy-section h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.6rem;
    font-weight: 400;
}
.section-body { padding-left: 44px; font-size: 0.95rem; line-height: 1.6; }
@media(max-width: 600px) { .section-body { padding-left: 0; } }

/* Cards (Griglie per i Dati) */
.privacy-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}
.privacy-card {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.3s ease;
}
body.light-mode .privacy-card { background: rgba(255,255,255,0.4); border-color: rgba(0,0,0,0.1); }
.privacy-card:hover { transform: translateY(-3px); border-color: #00d2ff; }
.privacy-card-icon { font-size: 1.5rem; margin-bottom: 10px; }
.privacy-card-title { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; color: #00d2ff; margin-bottom: 8px; }

/* Badges e Alert */
.privacy-badge {
    display: inline-block;
    background: rgba(0, 210, 255, 0.15);
    border: 1px solid #00d2ff;
    color: #00d2ff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    margin: 0 5px 5px 0;
}
.privacy-alert {
    background: rgba(255, 153, 0, 0.15);
    border-left: 4px solid #ff9900;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 20px 0;
    display: flex;
    gap: 15px;
}
.privacy-divider { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 50px 0; }
body.light-mode .privacy-divider { border-top-color: rgba(0,0,0,0.1); }

/* =========================================
   SFONDO STATICO PREMIUM (PAGINA PRIVACY)
   ========================================= */
.static-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: -2;
    background-color: #0a1628; /* Blu profondo notturno */
    
    /* Cielo stellato CSS (MeteoSite Style) */
    background-image:
      radial-gradient(1px 1px at 15% 20%, rgba(255,255,255,0.8) 0%, transparent 100%),
      radial-gradient(1px 1px at 40% 10%, rgba(255,255,255,0.5) 0%, transparent 100%),
      radial-gradient(1px 1px at 70% 35%, rgba(255,255,255,0.6) 0%, transparent 100%),
      radial-gradient(1px 1px at 85% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
      radial-gradient(1px 1px at 25% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
      radial-gradient(1.5px 1.5px at 55% 80%, rgba(255,255,255,0.6) 0%, transparent 100%),
      radial-gradient(1px 1px at 90% 15%, rgba(255,255,255,0.7) 0%, transparent 100%),
      radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,0.4) 0%, transparent 100%);
    pointer-events: none;
}

/* Il bagliore (Glow) elegante in alto al centro */
.static-bg::after {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    max-width: 800px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(26, 74, 138, 0.6) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* =========================================
   ADATTAMENTO AL TEMA CHIARO 
   ========================================= */
body.light-mode .static-bg {
    background-color: #f4f9ff; /* Azzurrino cielo molto chiaro e pulito */
    background-image: none; /* Spegniamo le stelle di giorno */
}

body.light-mode .static-bg::after {
    /* Bagliore diurno morbido */
    background: radial-gradient(ellipse, rgba(0, 210, 255, 0.15) 0%, transparent 70%);
}

/* =========================================
   BOTTONE GENERA PASSWORD (PREMIUM)
   ========================================= */
.generate-pwd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.4);
    color: #00d2ff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 30px; /* Forma a pillola super moderna */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    margin-top: 10px;
    margin-bottom: 15px;
    width: 100%; /* Occupa tutta la larghezza per allinearsi bene */
}

.generate-pwd-btn:hover {
    background: rgba(0, 210, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4); /* Effetto Glow/Neon */
    transform: translateY(-2px);
}

.generate-pwd-btn:active {
    transform: translateY(0);
}

/* Adattamento al Tema Chiaro */
body.light-mode .generate-pwd-btn {
    background: rgba(0, 150, 255, 0.1);
    color: #0088cc;
    border-color: rgba(0, 150, 255, 0.3);
}

body.light-mode .generate-pwd-btn:hover {
    background: rgba(0, 150, 255, 0.2);
    box-shadow: 0 0 12px rgba(0, 150, 255, 0.25);
}

/* =========================================
   ICONE INTERATTIVE (Info & Occhio Password)
   ========================================= */
.interactive-icon {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Assicura che l'area cliccabile sia comoda anche da smartphone */
    padding: 5px; 
}

/* Quando ci passi sopra (Hover) si illumina e si ingrandisce appena */
.interactive-icon:hover {
    color: #00d2ff;
    transform: scale(1.15);
}

/* Quando la CLICCHI (Active) si schiaccia fisicamente verso il basso */
.interactive-icon:active {
    transform: scale(0.85);
    color: #0088cc;
}

body.light-mode .interactive-icon {
    color: rgba(0, 0, 0, 0.4);
}
body.light-mode .interactive-icon:hover {
    color: #0088cc;
}

/* =========================================
   NOTE DI RILASCIO CENTRATE (Premium UI)
   ========================================= */

.modal-body {
    padding: 20px 25px 30px 25px; /* Margini più generosi */
}

.release-note-item-centered {
    text-align: center; /* Forza la centratura di TUTTO il testo */
}

.release-version-centered {
    color: #00d2ff;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.release-date-centered {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-bottom: 20px;
    font-style: italic;
}

/* Lista delle funzioni: Allineiamo gli elementi al centro e a sinistra all'interno */
.release-features-centered {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra la lista orizzontalmente */
    gap: 10px; /* Spazio tra gli elementi */
}

.release-features-centered li {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    /* Opzionale: aggiungi un text-align:left se gli elementi sono molto lunghi */
    /* text-align: left; */
}

.release-features-centered li i {
    color: #00ff88; /* Verde per indicare funzioni attive */
}

/* Riposizionamento e stile della X di chiusura */
.modal-header {
    position: relative; /* Necessario per ancorare la X */
    display: flex;
    justify-content: center; /* Centra il titolo */
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
    position: absolute; /* La stacchiamo dal flusso del testo */
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: white; /* Bianca classica */
    font-size: 1.8rem; /* Dimensione leggibile */
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 5px;
}

.close-btn:hover {
    opacity: 1;
    transform: scale(1.1); /* Leggero effetto ingrandimento */
    color: #ff4d4d; /* Diventa rossa al passaggio (opzionale, togli se vuoi resti bianca) */
}

/* Se la X sembra grigia, è perché eredita stili dai pulsanti. 
   Questo forza il bianco puro */
.modal-header .close-btn {
    color: #ffffff !important;
}

/* =========================================
   FIX SFONDO VIDEO SU MOBILE (Anti-Lag)
   ========================================= */
#bg-video { /* Metti qui l'ID o la classe esatta del tuo video */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh; /* Fallback per vecchi telefoni */
    height: 100dvh; /* Il segreto per i browser moderni (Dynamic Height) */
    object-fit: cover;
    z-index: -10; /* Lo tiene rigorosamente dietro tutto */
    
    /* Il trucco magico per forzare la fluidità (Accelerazione Hardware) */
    transform: translateZ(0); 
    will-change: transform;
    
    /* Evita che il dito interagisca per sbaglio col video */
    pointer-events: none; 
}

/* Assicurati che il body non abbia comportamenti strani */
body {
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    overflow-x: hidden;
    /* Se avevi background-attachment: fixed qui dentro, CANCELLALO! Su mobile rompe tutto. */
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Impedisce a iOS di mostrare il tasto play o i controlli sul video di sfondo */
video::-webkit-media-controls-panel, 
video::-webkit-media-controls-play-button, 
video::-webkit-media-controls-start-playback-button {
    display: none !important;
    -webkit-appearance: none;
}

#bg-video {
    object-fit: cover;
    width: 100vw;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: -10;
    /* Evita che il tocco accidentale attivi i controlli video */
    pointer-events: none; 
}

