/* =========================================
   --- SCROLLBAR "VETRO CHIARO" ---
   ========================================= */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent; 
}
::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* =========================================
   --- RESET & BASE ---
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}
body {
    margin: 0;
    padding: 0;
}
button {
    font-family: inherit;
}

/* =========================================
   --- LAYOUT ---
   ========================================= */
header {
    padding: 1rem 0;
    background: rgba(0, 0, 0, 0.1);
}
.container {
    width: 90%;
    max-width: 600px;
    margin: 0 auto;
}
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.app-container {
    width: 90%;
    max-width: 480px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

/* =========================================
   --- TIMER SECTION ---
   ========================================= */
.timer-box {
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 24px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.1);
}
.timer-modes {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.mode-btn {
    background: none;
    border: none;
    color: var(--white);
    opacity: 0.6;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.mode-btn.active {
    background: rgba(0,0,0,0.15);
    opacity: 1;
    font-weight: 700;
}
.timer-display {
    font-size: clamp(4rem, 15vw, 6.5rem); 
    font-weight: 700;
    line-height: 1;
    margin: 1rem 0 2rem 0;
    font-feature-settings: "tnum"; 
    text-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.main-action-btn {
    background: var(--white);
    color: var(--primary-bg);
    border: none;
    padding: 1rem 3rem;
    font-size: 1.5rem;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s, color 0.4s;
}
.main-action-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* =========================================
   --- TASKS & SEO ---
   ========================================= */
.tasks-section { width: 100%; }
.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.tasks-header h2 { font-size: 1.2rem; margin: 0; }
.seo-content {
    margin-top: 4rem;
    margin-bottom: 4rem;
    color: var(--white);
}
.info-block, .info-card {
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 2.5rem;
}
.seo-content h2 { font-size: 1.5rem; margin-top: 0; margin-bottom: 1rem; color: var(--white); opacity: 0.9; }
.seo-content h3 { font-size: 1.1rem; margin-top: 0; margin-bottom: 0.8rem; opacity: 0.8; color: #fbbf24; }
.seo-content p { line-height: 1.6; opacity: 0.7; margin-bottom: 0; }
.how-to-list, .features-list { padding-left: 20px; opacity: 0.75; line-height: 1.8; }
.how-to-list li, .features-list li { margin-bottom: 8px; }
.seo-content strong { color: var(--white); opacity: 1; font-weight: 600; }
@media (max-width: 768px) { .info-grid { grid-template-columns: 1fr; } }
details { background: rgba(0,0,0,0.05); margin-bottom: 1rem; border-radius: 8px; overflow: hidden; }
summary { padding: 1rem; cursor: pointer; font-weight: 600; }
details p { padding: 0 1rem 1rem 1rem; line-height: 1.6; }
body.no-scroll { overflow: hidden; }

/* =========================================
   --- DAILY STATS ---
   ========================================= */
.daily-stats {
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
    width: 100%;
}
.stats-hud {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: default;
    user-select: none;
}
.stats-hud:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}
.stats-info { display: flex; align-items: center; gap: 8px; opacity: 0.8; }
.icon-stats { width: 18px; height: 18px; fill: currentColor; color: var(--white); }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; color: var(--white); padding-top: 2px; }
.stats-separator { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.2); margin: 0 16px; }
.stat-value { font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 700; color: var(--white); line-height: 1; min-width: 24px; text-align: center; text-shadow: 0 0 10px rgba(255, 255, 255, 0.3); }

/* =========================================
   --- GLASS INPUTS & MODALS ---
   ========================================= */
.glass-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    margin: 20px 0 25px 0;
    outline: none;
    transition: all 0.2s ease;
}
.glass-input:focus { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.5); box-shadow: 0 0 15px rgba(255, 255, 255, 0.1); }
.glass-input::placeholder { color: rgba(255, 255, 255, 0.4); }

#input-modal {
    background: rgba(30, 30, 30, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    color: white;
    width: 90%;
    max-width: 380px;
    margin: auto;
    padding: 0;
    overflow: hidden;
}
#input-modal .modal-content { padding: 30px; }
#input-modal h3 { margin-top: 0; margin-bottom: 10px; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }

/* Priority Selectors */
.priority-selector { display: flex; gap: 10px; }
.priority-option { flex: 1; position: relative; cursor: pointer; }
.priority-option input { position: absolute; opacity: 0; cursor: pointer; }
.priority-option span { display: block; text-align: center; padding: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; font-size: 0.9rem; transition: all 0.2s ease; color: rgba(255, 255, 255, 0.6); }
.priority-option.low input:checked + span { background: rgba(16, 185, 129, 0.2); border-color: #10b981; color: #10b981; font-weight: 700; }
.priority-option.medium input:checked + span { background: rgba(245, 158, 11, 0.2); border-color: #f59e0b; color: #f59e0b; font-weight: 700; }
.priority-option.high input:checked + span { background: rgba(239, 68, 68, 0.2); border-color: #ef4444; color: #ef4444; font-weight: 700; }

/* Task Tags */
.task-tag { font-size: 0.65rem; padding: 3px 10px; border-radius: 12px; text-transform: uppercase; font-weight: 800; margin-left: auto; letter-spacing: 0.8px; border: 1px solid transparent; text-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: all 0.2s ease; }
.task-tag.low { color: #ffffff; background: rgba(16, 185, 129, 0.4); border-color: #10b981; box-shadow: 0 0 12px rgba(16, 185, 129, 0.5); }
.task-tag.medium { color: #ffffff; background: rgba(245, 158, 11, 0.4); border-color: #f59e0b; box-shadow: 0 0 12px rgba(245, 158, 11, 0.6); }
.task-tag.high { color: #ffffff; background: rgba(239, 68, 68, 0.45); border-color: #ef4444; box-shadow: 0 0 15px rgba(239, 68, 68, 0.7); }

.hidden { display: none !important; }

/* =========================================
   --- CUSTOM SELECT (STYLE CHIARO) ---
   ========================================= */
.custom-select { position: relative; width: 100%; cursor: pointer; user-select: none; -webkit-user-select: none; }
.custom-select .select-trigger { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 16px; background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px; color: white; font-size: 1rem; font-family: inherit; transition: all 0.2s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); }
.custom-select:hover .select-trigger { background: rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.5); transform: translateY(-1px); }
.custom-select .arrow { width: 16px; height: 16px; transition: transform 0.3s ease; opacity: 0.9; }
.custom-select.active .arrow, .custom-select.open .arrow { transform: rotate(180deg); }
.custom-select .select-options { display: none; position: absolute; top: calc(100% + 5px); left: 0; width: 100%; background: rgba(255, 255, 255, 0.2); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 9999; list-style: none; padding: 5px; margin: 0; }
.custom-select.active .select-options, .custom-select.open .select-options { display: block; animation: fadeIn 0.2s ease; }
.custom-select .select-options li { padding: 10px 15px; border-radius: 8px; color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: background 0.2s; cursor: pointer; font-size: 0.95rem; }
.custom-select .select-options li:hover { background: rgba(255, 255, 255, 0.3); color: white; }
.custom-select .select-options li.selected { background: rgba(255, 255, 255, 0.4); color: white; font-weight: 700; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   --- ZEN MODE (CENTRAGGIO CORRETTO) ---
   ========================================= */

body.zen-mode-active { overflow: hidden; }
/* HIDE ELEMENTS IN ZEN FOCUS (And also ads if not in break) */
body.zen-mode-active header, 
body.zen-mode-active .tasks-section, 
body.zen-mode-active .seo-content { 
    display: none !important; 
}

body.zen-mode-active .app-container {
    height: 100vh;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: var(--primary-bg);
}

body.zen-mode-active .timer-box {
    width: auto !important; 
    margin: 0 !important;
    background: transparent !important; 
    box-shadow: none !important;
    border: none !important;
    transform: scale(1.3);
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

body.zen-mode-active .timer-modes,
body.zen-mode-active .timer-display,
body.zen-mode-active #btn-toggle-timer,
body.zen-mode-active .daily-stats {
    display: flex !important;
}

body.zen-mode-active #zen-controls {
    display: flex !important;
    position: fixed;
    top: 20px;
    right: 20px;
    gap: 10px;
    z-index: 2000;
    animation: fadeIn 0.5s forwards;
}

/* --- ZEN MODE: BREAK STATE (Hybrid & Scrollable) --- */

/* 1. Sblocca lo scroll sul BODY se siamo in pausa */
body.zen-mode-active.break-mode {
    overflow-y: auto !important;
}

/* 2. Sblocca il container fissato per permettere al contenuto di allungarsi */
body.zen-mode-active.break-mode .app-container {
    position: relative !important;
    height: auto !important;
    min-height: 100vh;
    
    justify-content: flex-start !important;
    
    /* FIX POSIZIONE PULSANTI: */
    /* Riduciamo il padding superiore da 15vh a 1rem */
    /* Il banner sponsor farà da spaziatore naturale, mantenendo i tasti in alto */
    padding-top: 5rem !important; 
    
    padding-bottom: 50px !important;
    padding-left: 20px !important;  /* Margini laterali confermati */
    padding-right: 20px !important; /* Margini laterali confermati */
}

/* Mostra le Task */
body.zen-mode-active.break-mode .tasks-section {
    display: block !important;
    margin-top: 2rem;
    max-width: 600px;
    animation: fadeIn 0.5s ease;
}

/* =========================================
   --- PROMO BOXES MANAGEMENT ---
   ========================================= */

/* 1. Stile Base per TUTTI i banner centrali (Desktop, SEO e Mobile) */
#promo-container-center,
#promo-container-seo-1,
#promo-container-seo-2,
#promo-container-mobile-top {
    width: 100%;
    max-width: 100%;
    
    /* FIX CENTRATURA VERTICALE E ORIZZONTALE */
    margin-left: auto;
    margin-right: auto;
    text-align: center; /* Assicura che il banner interno sia centrato */
}

/* Margini specifici per quelli nel testo SEO e Task (Spaziatura Desktop) */
#promo-container-center,
#promo-container-seo-1,
#promo-container-seo-2 {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    display: block; /* Visibili sempre di base su desktop */
}

/* 2. GESTIONE SPECIFICA BANNER MOBILE TOP */
#promo-container-mobile-top {
    display: none; /* DI BASE NASCOSTO (Su Desktop non lo vogliamo) */
    margin-bottom: 20px; /* Spazio tra banner e timer */
    margin-top: 0;
}

/* MOSTRA SOLO SU MOBILE (Schermi sotto 768px) */
@media (max-width: 768px) {
    #promo-container-mobile-top {
        display: block !important; /* Forza la visibilità su mobile */
    }
}

/* Specifico per quello centrale delle Task (per non farlo troppo largo) */
#promo-container-center {
    max-width: 600px;
}

/* 3. ZEN MODE: NASCONDI TUTTI I BANNER (Se non sei in break) */
/* Include Center, SEO-1, SEO-2 e il nuovo Mobile-Top */
body.zen-mode-active:not(.break-mode) #promo-container-center,
body.zen-mode-active:not(.break-mode) #promo-container-seo-1,
body.zen-mode-active:not(.break-mode) #promo-container-seo-2,
body.zen-mode-active:not(.break-mode) #promo-container-mobile-top {
    display: none !important;
}


/* --- SIDE SPONSOR PANELS (STEALTH NAMES) --- */
.side-content-panel {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px; 
    height: 500px; /* ALTEZZA RIDOTTA */
    z-index: 1500; /* Z-INDEX ALZATO */
    
    /* Visible by default (Normal Mode) */
    display: block;
    pointer-events: none; 
}

.side-content-panel > div {
    pointer-events: auto;
}

#side-panel-left { left: 20px; }
#side-panel-right { right: 20px; }

/* NASCONDI IN ZEN MODE FOCUS (Se non sei in break, nascondi) */
body.zen-mode-active:not(.break-mode) .side-content-panel {
    display: none !important;
}

/* Nascondi solo su schermi molto piccoli (Laptop piccoli/Tablet < 1100px) */
@media (max-width: 1100px) {
    .side-content-panel {
        display: none !important;
    }
}


/* --- FOOTER LINKS STYLING --- */
.footer-links a {
    color: var(--white); /* Assicura che siano bianchi */
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
    opacity: 0.8;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* =========================================
   --- INFO PAGES (Privacy, Terms, Contacts) ---
   ========================================= */

.info-page-container {
    width: 90%; /* Standard Desktop */
    max-width: 800px;
    margin: 2rem auto;
    padding-bottom: 2rem;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-panel h1 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.glass-panel h3 {
    color: #fbbf24;
    margin-top: 35px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.glass-panel p {
    opacity: 0.85;
    line-height: 1.7;
    margin-bottom: 15px;
    font-size: 1.05rem;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    /* CORREZIONE ALLINEAMENTO: 90% come il container dell'header */
    .info-page-container {
        width: 90%; 
        margin-top: 1rem;
    }

    /* Padding ridotto per massimizzare spazio */
    .glass-panel {
        padding: 25px 20px; 
        border-radius: 16px;
    }

    .glass-panel h1 {
        font-size: 1.6rem; 
    }

    .glass-panel p {
        font-size: 0.95rem; 
    }
}

/* =========================================
   --- MOBILE ZEN MODE FIXES ---
   ========================================= */
@media (max-width: 768px) {

    /* 1. Nascondi il tasto Fullscreen in Zen Mode su Mobile */
    body.zen-mode-active #btn-fullscreen-zen {
        display: none !important;
    }

    /* 2. Adatta i pulsanti e il timer in Zen Mode su Mobile */
    body.zen-mode-active .timer-box {
        /* Annulla l'ingrandimento del 130% usato su desktop */
        transform: none !important; 
        width: 100% !important;
        padding: 0 10px; /* Un po' di margine ai lati */
    }

    /* Sistema i 3 pulsanti (Pomodoro, Short, Long) */
    body.zen-mode-active .timer-modes {
        display: flex;
        justify-content: center;
        gap: 5px; /* Riduci lo spazio tra i bottoni */
        margin-bottom: 2rem;
    }

    body.zen-mode-active .mode-btn {
        font-size: 0.85rem; /* Testo leggermente più piccolo */
        padding: 8px 12px;  /* Bottoni meno ingombranti */
        white-space: nowrap; /* Impedisce al testo di andare a capo */
        width: auto;
    }

    /* (Opzionale) Aggiusta la grandezza del timer per non farlo enorme */
    body.zen-mode-active .timer-display {
        font-size: 5.5rem; 
    }
}

/* =========================================
   --- COOKIE BANNER (Glassmorphism) ---
   ========================================= */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: 90%; /* Per mobile */
    z-index: 10000; /* Sopra a tutto */
    
    background: rgba(30, 30, 30, 0.85); /* Scuro semitrasparente */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 16px;
    
    padding: 20px;
    animation: slideUp 0.5s ease-out;
}

.cookie-banner.hidden {
    display: none !important;
}

.cookie-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #fff;
}

.cookie-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.8;
    margin-bottom: 20px;
    color: #eee;
}

.cookie-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Animazione di entrata */
@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Adattamento Mobile */
@media (max-width: 600px) {
    .cookie-banner {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0; /* Arrotondato solo sopra */
        border-bottom: none;
    }
    .cookie-actions {
        width: 100%;
    }
    .cookie-actions button {
        flex: 1; /* Bottoni larghi uguali su mobile */
    }
}