/**
 * GTG WhatsApp - Stili e Animazioni WOW
 * Plugin by G-Tech Group
 */

/* ============================================
   VARIABILI CSS
   ============================================ */
:root {
    --gtg-wa-green: #25D366;
    --gtg-wa-green-dark: #128C7E;
    --gtg-wa-green-light: #DCF8C6;
    --gtg-wa-shadow: rgba(37, 211, 102, 0.4);
    --gtg-wa-size: 60px;
    --gtg-wa-margin: 20px;
    --gtg-wa-z-index: 99999;
}

/* ============================================
   CONTAINER PRINCIPALE
   ============================================ */
.gtg-whatsapp-container {
    position: fixed;
    bottom: var(--gtg-wa-margin);
    right: var(--gtg-wa-margin);
    z-index: var(--gtg-wa-z-index);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* ============================================
   PULSANTE WHATSAPP
   ============================================ */
.gtg-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--gtg-wa-size);
    height: var(--gtg-wa-size);
    background: linear-gradient(135deg, var(--gtg-wa-green) 0%, var(--gtg-wa-green-dark) 100%);
    border-radius: 50%;
    box-shadow:
        0 4px 15px var(--gtg-wa-shadow),
        0 0 0 0 var(--gtg-wa-shadow);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Animazione di ingresso */
    animation: gtg-bounce-in 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) 1s both,
               gtg-pulse 2s ease-in-out infinite 2s;
}

/* Icona WhatsApp */
.gtg-whatsapp-icon {
    width: 32px;
    height: 32px;
    color: white;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
}

/* Hover Effects */
.gtg-whatsapp-btn:hover {
    transform: scale(1.15) rotate(10deg);
    box-shadow:
        0 8px 25px var(--gtg-wa-shadow),
        0 0 40px rgba(37, 211, 102, 0.3);
}

.gtg-whatsapp-btn:hover .gtg-whatsapp-icon {
    transform: scale(1.1) rotate(-10deg);
    animation: gtg-wiggle 0.5s ease;
}

/* Focus state per accessibilita */
.gtg-whatsapp-btn:focus {
    outline: 3px solid var(--gtg-wa-green-light);
    outline-offset: 3px;
}

/* Active/Click state */
.gtg-whatsapp-btn:active {
    transform: scale(0.95);
}

/* ============================================
   RIPPLE EFFECT
   ============================================ */
.gtg-whatsapp-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.gtg-whatsapp-ripple.active {
    animation: gtg-ripple 0.6s ease-out;
}

/* ============================================
   TOOLTIP
   ============================================ */
.gtg-whatsapp-tooltip {
    background: linear-gradient(135deg, #333 0%, #1a1a1a 100%);
    color: white;
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Freccia del tooltip */
.gtg-whatsapp-tooltip::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #1a1a1a;
}

/* Tooltip visibile */
.gtg-whatsapp-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    animation: gtg-tooltip-bounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   ANIMAZIONI KEYFRAMES
   ============================================ */

/* Bounce In - Ingresso del pulsante */
@keyframes gtg-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.3) rotate(10deg);
    }
    70% {
        transform: scale(0.9) rotate(-5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Pulse - Pulsazione continua */
@keyframes gtg-pulse {
    0% {
        box-shadow:
            0 4px 15px var(--gtg-wa-shadow),
            0 0 0 0 var(--gtg-wa-shadow);
    }
    50% {
        box-shadow:
            0 4px 15px var(--gtg-wa-shadow),
            0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow:
            0 4px 15px var(--gtg-wa-shadow),
            0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Wiggle - Icona che si muove */
@keyframes gtg-wiggle {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-15deg); }
    40% { transform: rotate(15deg); }
    60% { transform: rotate(-10deg); }
    80% { transform: rotate(10deg); }
}

/* Ripple - Effetto click */
@keyframes gtg-ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Tooltip bounce */
@keyframes gtg-tooltip-bounce {
    0% {
        opacity: 0;
        transform: translateX(30px) scale(0.8);
    }
    50% {
        transform: translateX(-5px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Shake - Attira attenzione (usato opzionalmente) */
@keyframes gtg-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media screen and (max-width: 768px) {
    :root {
        --gtg-wa-size: 55px;
        --gtg-wa-margin: 15px;
    }

    .gtg-whatsapp-icon {
        width: 28px;
        height: 28px;
    }

    .gtg-whatsapp-tooltip {
        font-size: 13px;
        padding: 8px 14px;
    }
}

@media screen and (max-width: 480px) {
    :root {
        --gtg-wa-size: 50px;
        --gtg-wa-margin: 12px;
    }

    .gtg-whatsapp-icon {
        width: 26px;
        height: 26px;
    }

    .gtg-whatsapp-tooltip {
        display: none; /* Nascondi tooltip su mobile piccoli */
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    .gtg-whatsapp-tooltip {
        background: linear-gradient(135deg, #444 0%, #2a2a2a 100%);
    }

    .gtg-whatsapp-tooltip::after {
        border-left-color: #2a2a2a;
    }
}

/* ============================================
   REDUCED MOTION - ACCESSIBILITA
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .gtg-whatsapp-btn {
        animation: none;
        transition: none;
    }

    .gtg-whatsapp-tooltip {
        transition: opacity 0.2s ease;
        transform: none;
    }

    .gtg-whatsapp-tooltip.visible {
        animation: none;
        transform: none;
    }

    .gtg-whatsapp-btn:hover {
        transform: none;
    }

    .gtg-whatsapp-btn:hover .gtg-whatsapp-icon {
        transform: none;
        animation: none;
    }
}

/* ============================================
   PRINT - Nascondi in stampa
   ============================================ */
@media print {
    .gtg-whatsapp-container {
        display: none !important;
    }
}
