/* FG-HEADERCSS: stile che stava dentro includes/header.php (notifiche push, bottone AI), spostato qui dall'installer */
/* ========================================
   PUSH NOTIFICATION STYLES - FIXED
   ======================================== */

/* Floating Action Button (Mobile) - LEFT SIDE */
.push-fab {
    position: fixed;
    bottom: 80px;
    left: 15px;
    z-index: 999;  /* RIDOTTO per non sovrapporsi ad AI chat (1000+) */
}

.push-fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4705f 0%, #c45f4e 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(212, 112, 95, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.push-fab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 112, 95, 0.4);
}

.push-fab-btn:active {
    transform: translateY(-1px);
}

.push-fab-btn .bell-icon {
    width: 24px;
    height: 24px;
    color: white;
    animation: bellRing 2s ease-in-out infinite;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-15deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(0deg); }
}

/* Pulse Ring Animation */
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #d4705f;
    animation: pulse 2s infinite;
    opacity: 0;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Desktop Banner */
.push-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.push-banner.show {
    transform: translateY(0);
}

.push-banner.hidden {
    display: none;
}

.push-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.push-banner-icon {
    font-size: 48px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.push-banner-text h3 {
    margin: 0 0 5px 0;
    color: #d4705f;
    font-size: 18px;
}

.push-banner-text p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.push-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Buttons */
.push-btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.push-btn-primary {
    background: linear-gradient(135deg, #d4705f 0%, #c45f4e 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(212, 112, 95, 0.3);
}

.push-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 112, 95, 0.4);
}

.push-btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.push-btn-secondary:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.push-btn-large {
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
}

/* Modal */
.push-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;  /* SOPRA tutto (incluso banner donazione 10000) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.push-modal.show {
    opacity: 1;
    visibility: visible;
}

.push-modal.hidden {
    display: none;
}

.push-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.push-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.push-modal-close {
    position: absolute;
    top: 20px;  /* PIÙ IN ALTO per non essere coperto da banner */
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;  /* SOPRA tutto nel modal */
    display: flex;
    align-items: center;
    justify-content: center;
}

.push-modal-close:hover {
    background: #f44336;
    color: white;
    border-color: #f44336;
    transform: rotate(90deg) scale(1.1);
}

.push-modal-body {
    padding: 60px 30px 30px;  /* PIÙ padding top per bottone X */
    text-align: center;
}

.push-modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #d4705f 0%, #c45f4e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(212, 112, 95, 0.3);
}

.push-modal-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.push-modal-body h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
}

.push-modal-description {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Benefits */
.push-benefits {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.push-benefit {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #fef5f1;
    border-radius: 12px;
}

.benefit-icon {
    font-size: 24px;
}

.push-benefit span:last-child {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

/* Status Section */
#push-status-section {
    margin: 20px 0;
    padding: 15px;
    border-radius: 12px;
    font-size: 14px;
}

#push-status-section.status-enabled {
    background: #e8f5e9;
    color: #2e7d32;
}

#push-status-section.status-disabled {
    background: #fff3e0;
    color: #e65100;
}

#push-status-section.status-denied {
    background: #ffebee;
    color: #c62828;
}

/* Fine Print */
.push-fine-print {
    margin-top: 20px;
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .push-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .push-banner-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .push-btn {
        width: 100%;
    }
    
    .push-fab {
        bottom: 70px;
        left: 12px;
    }
    
    .push-fab-btn {
        width: 44px;
        height: 44px;
    }
    
    .push-banner {
        display: none !important;  /* Banner nascosto su mobile */
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .push-modal-content {
        width: 95%;
        border-radius: 16px;
    }
    
    .push-modal-body {
        padding: 50px 20px 20px;
    }
    
    .push-modal-body h2 {
        font-size: 20px;
    }
    
    .push-fab {
        bottom: 65px;
        left: 10px;
    }
    
    .push-fab-btn {
        width: 42px;
        height: 42px;
    }
    
    .push-fab-btn .bell-icon {
        width: 22px;
        height: 22px;
    }
    
    .push-modal-close {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
        font-size: 24px;
    }
}

/* Desktop - Hide FAB, show banner */
@media (min-width: 769px) {
    .push-fab {
        display: none;
    }
    /* NASCONDE MINICHAT SU DESKTOP */
    .floating-ai-btn,
    .mini-ai-chat {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   📱 MOBILE FAB LAYOUT - Tutti in basso a sinistra, verticali (tranne luna)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Container virtuale per FAB a sinistra */
    .push-fab,
    .floating-ai-btn,
    .dopamine-fab-container {
        position: fixed !important;
        left: 10px !important;
        right: auto !important;
        z-index: 9990 !important;
    }
    
    /* Pulsante PUSH (campanella) - più in basso */
    .push-fab {
        bottom: 70px !important;
        display: block !important;
    }
    .push-fab-btn {
        width: 36px !important;
        height: 36px !important;
        pointer-events: auto !important;
    }
    .push-fab-btn .bell-icon {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Pulsante AI CHAT - sopra campanella */
    .floating-ai-btn {
        bottom: 114px !important;
        width: 36px !important;
        height: 36px !important;
    }
    .floating-ai-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    .ai-pulse {
        display: none !important;
    }
    
    /* Pulsante GAMIFICATION (pacco) - sopra AI chat */
    .dopamine-fab-container {
        bottom: 158px !important;
    }
    .dopamine-fab-container .dopamine-fab,
    .dopamine-fab-container .dopamine-fab-main {
        width: 36px !important;
        height: 36px !important;
    }
    .dopamine-fab-container .fab-icon {
        font-size: 1rem !important;
    }
    .dopamine-fab-container .dopamine-fab-menu {
        left: 0 !important;
        right: auto !important;
        bottom: 44px !important;
    }
    .dopamine-fab-container .dopamine-fab-item {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }
    
    /* LUNA (dark mode) - A DESTRA separata dagli altri */
    .theme-toggle {
        position: fixed !important;
        bottom: 70px !important;
        right: 10px !important;
        left: auto !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%) !important;
        border: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        z-index: 9990 !important;
    }
    .theme-toggle .sun-icon,
    .theme-toggle .moon-icon {
        font-size: 1rem !important;
    }
    body.dark-mode .theme-toggle {
        background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%) !important;
    }
    
    /* Mini chat aperta - sopra tutto */
    .mini-ai-chat {
        left: 10px !important;
        right: auto !important;
        bottom: 210px !important;
        width: calc(100vw - 20px) !important;
        max-width: 350px !important;
    }
}

/* Mobile piccolo */
@media (max-width: 480px) {
    .push-fab { bottom: 65px !important; }
    .floating-ai-btn { bottom: 109px !important; }
    .dopamine-fab-container { bottom: 153px !important; }
    .theme-toggle { bottom: 65px !important; right: 10px !important; }
    .mini-ai-chat { bottom: 200px !important; }
}
/* 🤖 FLOATING AI BUTTON */
.floating-ai-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: floatIn 0.5s ease-out;
}

.floating-ai-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.6);
}

.floating-ai-btn svg {
    position: relative;
    z-index: 2;
}

.ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(20px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 💬 MINI AI CHAT POPUP */
.mini-ai-chat {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

.mini-ai-chat.active {
    display: flex;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mini-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mini-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
}

.ai-icon {
    font-size: 24px;
}

.mini-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.mini-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.mini-chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: 400px;
}

/* 🛡️ MINI DISCLAIMER STYLES */
.mini-disclaimer {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: miniDisclaimerFade 0.3s ease-out;
}

@keyframes miniDisclaimerFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mini-disclaimer.hidden {
    display: none;
}

.mini-disclaimer-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.mini-disclaimer-text {
    flex: 1;
    font-size: 12px;
    line-height: 1.4;
    color: #5d4037;
}

.mini-disclaimer-text strong {
    color: #e65100;
}

.mini-disclaimer-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.mini-disclaimer-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* Dark Mode Mini Disclaimer */
body.dark-mode .mini-disclaimer {
    background: linear-gradient(135deg, #3e2723 0%, #4e342e 100%);
    border-color: #ff9800;
}

body.dark-mode .mini-disclaimer-text {
    color: #ffcc80;
}

body.dark-mode .mini-disclaimer-text strong {
    color: #ffb74d;
}

.mini-chat-welcome h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 18px;
}

.mini-chat-welcome p {
    color: #666;
    margin-bottom: 15px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-btn {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #2c3e50;
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.or-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.or-divider::before,
.or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e0e0e0;
}

.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

.or-divider span {
    background: white;
    padding: 0 10px;
    color: #999;
    font-size: 14px;
}

.mini-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    padding: 12px 15px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    border-radius: 12px 12px 0 12px;
}

.chat-message.ai {
    background: #f5f7fa;
    color: #2c3e50;
    align-self: flex-start;
    border-radius: 12px 12px 12px 0;
}

.mini-chat-input-area {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

#miniChatInput {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
}

#miniChatInput:focus {
    outline: none;
    border-color: #667eea;
}

#miniChatSend {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#miniChatSend:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 🎤 VOICE BUTTON - Mini Chat */
#miniChatVoice {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#miniChatVoice:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

#miniChatVoice.listening {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 15px 5px rgba(76, 175, 80, 0.3); }
}

/* 📷 Camera Button */
#miniChatCamera {
    background: linear-gradient(135deg, #FF6B35, #f57c00);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
#miniChatCamera:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}
#miniChatCamera.has-image {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    animation: pulse 1.5s infinite;
}

#miniChatInput.listening {
    border-color: #4CAF50 !important;
    background: #e8f5e9 !important;
}

.mini-chat-footer {
    padding: 10px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.full-chat-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.full-chat-link:hover {
    color: #764ba2;
}

/* Loading indicator */
.loading-message {
    display: flex;
    align-items: center;
    gap: 5px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.error-message {
    background: #fee !important;
    border-left: 3px solid #f44336;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .floating-ai-btn {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
    }
    
    .mini-ai-chat {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 85px;
        max-height: 70vh;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}
