/* ===================================================================
   SISTEMA PASSAPAROLA E GUADAGNA - CSS UNIVERSALE
   La più bella e funzionale implementazione del web!
   =================================================================== */

/* === TASTO PASSAPAROLA PRINCIPALE === */
.passaparola-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
}

.passaparola-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.passaparola-btn:hover::before {
    left: 100%;
}

.passaparola-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    color: white;
    text-decoration: none;
}

.passaparola-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* === VARIANTI DEL TASTO === */
.passaparola-btn.compact {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 36px;
    min-height: 36px;
}

.passaparola-btn.large {
    padding: 12px 20px;
    font-size: 16px;
    min-width: 54px;
    min-height: 54px;
}

.passaparola-btn.text-variant {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.passaparola-btn.text-variant:hover {
    background: #667eea;
    color: white;
}

/* === TASTO FLOATING ONNIPRESENTE === */
.passaparola-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-soft 3s infinite;
}

.passaparola-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
    animation: none;
}

@keyframes pulse-soft {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.5);
    }
}

/* === MODAL PERSONALIZZATO === */
.passaparola-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.passaparola-modal.show {
    display: flex;
    opacity: 1;
}

.passaparola-modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.passaparola-modal.show .passaparola-modal-content {
    transform: scale(1);
}

/* === SEZIONE LINK REFERRAL === */
.referral-link-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid #e2e8f0;
}

.referral-link-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    background: white;
    margin-bottom: 12px;
}

/* === BOTTONI SOCIAL === */
.social-share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.social-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.social-btn.facebook { background: #1877f2; }
.social-btn.twitter { background: #1da1f2; }
.social-btn.whatsapp { background: #25d366; }
.social-btn.telegram { background: #0088cc; }
.social-btn.copy { background: #10b981; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .passaparola-floating {
        bottom: 70px;
        right: 15px;
        width: 54px;
        height: 54px;
        font-size: 18px;
    }
    
    .passaparola-modal-content {
        padding: 24px;
        margin: 20px;
    }
    
    .social-share-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === ANIMAZIONI === */
.passaparola-btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.passaparola-btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === INTEGRAZIONE CARD PRODOTTI === */
.product-card .passaparola-btn {
    flex-shrink: 0;
}

.product-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.actions-main {
    flex: 1;
}

.actions-secondary {
    display: flex;
    gap: 4px;
}

/* === BADGE NOTIFICA === */
.passaparola-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* === EFFETTI SPECIALI === */
.passaparola-sparkle {
    position: relative;
}

.passaparola-sparkle::after {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 16px;
    animation: sparkle 2s infinite;
    opacity: 0;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(180deg); }
}

/* === ACCESSIBILITY === */
.passaparola-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

@media (prefers-reduced-motion: reduce) {
    .passaparola-btn,
    .passaparola-floating,
    .social-btn {
        transition: none;
        animation: none;
    }
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
    .passaparola-modal-content {
        background: #1e293b;
        color: white;
    }
    
    .referral-link-section {
        background: #334155;
        border-color: #475569;
    }
    
    .referral-link-input {
        background: #334155;
        border-color: #475569;
        color: white;
    }
}
