/* --- Animazioni per Pulsanti CTA (on hover) --- */

/* L'animazione base è applicata a tutti i pulsanti CTA nel frontend */
.cta-animated-btn {
    transition: all 0.2s ease-out; /* Transizione base per un feedback morbido */
    /* Aggiunto il 'filter' per animare l'opacità in modo più fluido */
}

/* 1. Animazione PULSE */
/* Il pulsante "pulsa" con un effetto di ingrandimento e riduzione,
   dando una sensazione di "battito". */
.cta-hover-pulse:hover {
    animation: pulse 1s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 2. Animazione SHAKE (leggera) */
/* L'animazione originale è perfetta, la lascio così com'è. */
.cta-hover-shake:hover {
    animation: shake-horizontal 0.6s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake-horizontal {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

/* 3. Animazione GLOW (bagliore) */
/* L'ombra esterna pulsa, simulando un vero e proprio bagliore. */
.cta-hover-glow:hover {
    animation: glow-effect 1.5s infinite ease-in-out;
}

@keyframes glow-effect {
    0%, 100% {
        box-shadow: 0 0 8px 3px #673ab7b8, 0 0 20px 5px rgba(255, 255, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 12px 6px #673ab7b8, 0 0 30px 8px rgba(255, 255, 255, 0.6);
    }
}

/* 4. Animazione FADE (cambio opacità) */
/* Il pulsante sbiadisce e torna visibile ciclicamente.
   Ho usato `filter: opacity` per una maggiore compatibilità e fluidità. */
.cta-hover-fade:hover {
    animation: fade-effect 1.2s infinite ease-in-out;
}

@keyframes fade-effect {
    0%, 100% { filter: opacity(1); }
    50% { filter: opacity(0.7); }
}

/*Health ECG*/
/* Stile per il monitor ECG */
.ecg-monitor {
    width: 100%;
    height: 80px; /* Altezza del monitor */
    background: #f8f9fa; /* Sfondo leggermente grigio, come un vero monitor */
    border-radius: 8px;
    overflow: hidden; /* Nasconde la linea quando esce dai bordi */
    position: relative;
}

.ecg-line {
    width: 200%; /* La linea è il doppio del monitor per poter scorrere */
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    animation: scrollEcg 2s linear infinite;
}

@keyframes scrollEcg {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%); /* Scorre da destra a sinistra */
    }
}

/* Stile per il testo dinamico */
#analysisStatusText {
    transition: opacity 0.2s ease-in-out;
}

/*Badge Health*/
.health-badge {
    position: fixed;
    top: 30%;
    right: 20px;
    z-index: 9999;
    cursor: pointer;
    user-select: none;
    transition:
        width 0.5s cubic-bezier(.68,-0.55,.27,1.55),
        min-height 0.5s cubic-bezier(.68,-0.55,.27,1.55),
        border-radius 0.5s cubic-bezier(.68,-0.55,.27,1.55),
        background 0.3s,
        box-shadow 0.3s;
    will-change: width, min-height, border-radius, box-shadow;
}

.health-badge.minimized {
    width: 50px;
    height: 50px;
    background: #ffffff61;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 12px 0 rgba(102, 126, 234, 0.45), 0 0 0 0 rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.health-badge.expanded {
    animation: badge-pop-in 0.6s cubic-bezier(.68,-0.55,.27,1.55);
    width: 280px;
    min-height: 120px;
    border-radius: 20px!important;
    background: rgb(255 255 255 / 29%);
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
}

.health-badge.closing {
    animation: badge-close-out 0.4s cubic-bezier(.68,-0.55,.27,1.55);
    animation-fill-mode: forwards;
}

@keyframes badge-pop-in {
    0% {
        transform: scale(0.7) translateY(60px);
        opacity: 0;
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }
    60% {
        transform: scale(1.08) translateY(-10px);
        opacity: 1;
        box-shadow: 0 16px 48px rgba(102, 126, 234, 0.2);
    }
    85% {
        transform: scale(0.95) translateY(0);
        box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
}

@keyframes badge-close-out {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
    50% {
        transform: scale(0.93) translateY(10px);
        opacity: 0.6;
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    }
    100% {
        transform: scale(0.7) translateY(40px);
        opacity: 0;
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }
}

.health-badge.expanded .badge-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.health-badge.expanded .score-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 12px;
    color: white;
}

.health-badge.expanded .score-text {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
}

.health-badge.expanded .score-description {
    font-size: 12px;
    color: #718096;
    line-height: 1.4;
}

.score-excellent { background: linear-gradient(135deg, #48bb78, #38a169); }
.score-good { background: linear-gradient(135deg, #6822ff, #00BCD4); }
.score-average { background: linear-gradient(135deg, #ed8936, #dd6b20); }
.score-poor { background: linear-gradient(135deg, #f56565, #e53e3e); }

.health-badge.minimized .badge-content {
    display: none;
}

.health-badge-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    background: transparent;
    display: none;
}

.trash-zone {
    position: fixed;
    bottom: -80px; /* Inizia nascosto sotto */
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: #ff4757;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; 
    transition: bottom 0.3s ease, transform 0.3s ease, background 0.2s ease;
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.4);
    color: white; /* <-- IMPORTANTE 1: Colore per l'icona */
    font-size: 22px; /* <-- IMPORTANTE 2: Dimensione per l'icona */
}

.trash-zone.visible {
    bottom: 30px; /* Appare da sotto */
	z-index: 11111; /* Un z-index molto alto per stare sopra a tutto */
}

.trash-zone.active {
    background: #ff3838;
    transform: translateX(-50%) scale(1.2);
}

