/* CALENDAR STYLES */

.calendar-day {
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    background: var(--bg-overlay);
    color: var(--primary-text);
    border: 1px solid #ffffff0d;
}

.calendar-day.selected {
    background-image: linear-gradient(135deg, var(--grad-start), var(--grad-end)) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px #0000004d;
    border: none;
}

.day-indicator {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50%;
    background-color: #FF3B30 !important;
    box-shadow: 0 0 4px #ff3b3099;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.calendar-day.selected .day-indicator {
    background-color: #FFF !important;
    box-shadow: none;
}

#calendar-screen .header p {
    margin-top: 0 !important;
    opacity: .7;
    font-size: 12px;
}

#cal-prev-btn {
    left: 15px !important;
    top: calc(10px + env(safe-area-inset-top)) !important;
}

#cal-next-btn {
    right: 15px !important;
    top: calc(10px + env(safe-area-inset-top)) !important;
}

/* --- CALENDARIO STILE "OUTLINE" (Fix Invisibilità) --- */

/* 1. GIORNO "OGGI" (Testo Gradiente) */
.calendar-day.is-today {
    border: none !important;
    
    /* Definiamo il gradiente per il testo */
    background-image: linear-gradient(135deg, #5A7BED, #C764E3) !important;
    background-size: 100%;
    
    /* Ritagliamo il gradiente sulla forma del testo */
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    
    font-weight: 900 !important;
    font-size: 16px !important;
}

/* 2. GIORNO SELEZIONATO (Generico) */
.calendar-day.selected {
    /* Sfondo trasparente per far vedere solo il bordo */
    background: transparent !important; 
    box-shadow: none !important;
    border: none !important;
    
    /* Testo normale (verrà sovrascritto se è "Oggi") */
    -webkit-text-fill-color: var(--text-color) !important;
    color: var(--text-color) !important;
    
    position: relative;
    font-weight: 700;
}

/* 3. IL BORDO SOTTILE (Tramite pseudo-elemento) */
.calendar-day.selected::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    padding: 2px; /* Spessore bordo */
    background: linear-gradient(135deg, #5A7BED, #C764E3); 
    
    /* Versione WebKit (Chrome, Safari, iOS) */
    -webkit-mask: 
       linear-gradient(#fff 0 0) content-box, 
       linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;

    /* Versione Standard (Firefox, ecc.) - AGGIUNTA PER RISOLVERE IL WARNING */
    mask: 
       linear-gradient(#fff 0 0) content-box, 
       linear-gradient(#fff 0 0);
    mask-composite: exclude;
    
    pointer-events: none;
}

/* 4. FIX CRITICO: OGGI + SELEZIONATO (From style.css) */
/* Quando "Oggi" è anche selezionato, deve vincere il blu della selezione */
.calendar-day.is-today.selected {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    background-image: none !important; /* Reset gradient */
    -webkit-text-fill-color: #fff !important; /* Reset text fill */
    color: #fff !important;
}

.calendar-day.is-today.selected .day-number,
.calendar-day.is-today.selected .day-amount {
    color: #fff !important;
}

/* 5. Pallino indicatore */
.day-indicator {
    background-color: #FF3B30 !important;
    box-shadow: none !important;
}
