/* ============================================
   PHOENIX INNOVATIVE TECHNOLOGIES
   CHATBOT & FLOATING BUTTONS STYLES
   ============================================ */

/* Floating Buttons Container */
.floating-buttons {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* WhatsApp Button */
.float-whatsapp {
    width: 65px !important;
    height: 65px !important;
    background: linear-gradient(135deg, #25D366, #128C7E) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 32px !important;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4) !important;
    transition: all 0.3s ease !important;
    animation: pulse-whatsapp 2s infinite !important;
    text-decoration: none !important;
    border: 3px solid white !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
    position: relative !important;
}

/* Chatbot Button */
.float-chatbot {
    width: 65px !important;
    height: 65px !important;
    background: linear-gradient(135deg, #FF6B35, #F25F3A) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 30px !important;
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.4) !important;
    transition: all 0.3s ease !important;
    animation: pulse-chatbot 2s infinite !important;
    text-decoration: none !important;
    border: 3px solid white !important;
    cursor: pointer !important;
    position: relative !important;
    -webkit-tap-highlight-color: transparent;
}

.float-whatsapp:hover, .float-chatbot:hover {
    transform: scale(1.15) rotate(5deg) !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3) !important;
}

.float-whatsapp:active, .float-chatbot:active {
    transform: scale(0.95) !important;
}

/* Pulse Animations */
@keyframes pulse-whatsapp {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

@keyframes pulse-chatbot {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7); }
    70% { box-shadow: 0 0 0 18px rgba(255, 107, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
}

/* Tooltips */
.button-tooltip {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border-left: 4px solid;
    pointer-events: none;
}

.float-whatsapp:hover .button-tooltip,
.float-chatbot:hover .button-tooltip {
    opacity: 1 !important;
    visibility: visible !important;
    right: 85px;
}

.float-whatsapp .button-tooltip {
    border-left-color: #25D366;
}

.float-chatbot .button-tooltip {
    border-left-color: #FF6B35;
}

/* Chatbot Container */
.chatbot-container {
    position: relative;
}

/* Chatbot Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    border: 1px solid rgba(255,107,53,0.2);
    z-index: 1000000 !important;
}

.chatbot-window.active {
    display: flex !important;
}

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

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #FF6B35, #F25F3A);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    padding: 5px;
    object-fit: contain;
}

.chatbot-header h6 {
    color: white !important;
    margin: 0;
    font-size: 1rem;
}

.chatbot-header small {
    color: rgba(255,255,255,0.8) !important;
    font-size: 0.8rem;
}

/* Chatbot Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

/* Message Styles */
.message {
    margin-bottom: 15px;
    max-width: 80%;
    animation: messagePop 0.3s ease;
}

@keyframes messagePop {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.bot-message {
    background: white;
    padding: 12px 15px;
    border-radius: 18px 18px 18px 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    color: #333 !important;
    word-wrap: break-word;
}

.user-message {
    background: linear-gradient(135deg, #FF6B35, #F25F3A);
    color: white !important;
    padding: 12px 15px;
    border-radius: 18px 18px 5px 18px;
    margin-left: auto;
    word-wrap: break-word;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: white;
    border-radius: 18px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1s infinite;
}

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

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

/* Chatbot Input Area */
.chatbot-input {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chatbot-input input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 25px;
    outline: none;
    transition: all 0.3s;
    font-size: 16px;
    color: #333 !important;
}

.chatbot-input input:focus {
    border-color: #FF6B35;
}

.chatbot-input input::placeholder {
    color: #999 !important;
}

.chatbot-input button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #FF6B35, #F25F3A);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.chatbot-input button:hover {
    transform: scale(1.1) rotate(90deg);
}

.chatbot-input button:active {
    transform: scale(0.95);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Close Button */
.btn-close-white {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: white;
    font-size: 24px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.btn-close-white::before {
    content: "×";
    font-size: 28px;
    font-weight: 300;
    color: white;
    display: block;
    line-height: 1;
}

.btn-close-white:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.btn-close-white:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 576px) {
    .floating-buttons {
        bottom: 15px !important;
        right: 15px !important;
        gap: 10px !important;
    }

    .float-whatsapp, .float-chatbot {
        width: 55px !important;
        height: 55px !important;
        font-size: 26px !important;
        border-width: 2px !important;
    }

    @keyframes pulse-whatsapp {
        0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
        70% { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
        100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
    }

    @keyframes pulse-chatbot {
        0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.5); }
        70% { box-shadow: 0 0 0 12px rgba(255, 107, 53, 0); }
        100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
    }

    .chatbot-window {
        width: calc(100vw - 30px);
        max-width: 320px;
        height: 500px;
        right: 0;
        bottom: 70px;
    }

    .chatbot-header {
        padding: 12px 15px;
    }

    .chatbot-header img {
        width: 35px;
        height: 35px;
    }

    .chatbot-header h6 {
        font-size: 0.95rem;
    }

    .chatbot-header small {
        font-size: 0.8rem;
    }

    .btn-close-white {
        width: 28px;
        height: 28px;
    }

    .btn-close-white::before {
        font-size: 24px;
    }

    .chatbot-messages {
        padding: 15px;
    }

    .message {
        max-width: 85%;
    }

    .bot-message, .user-message {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .chatbot-input {
        padding: 12px 15px;
    }

    .chatbot-input input {
        padding: 10px 12px;
        font-size: 16px;
    }

    .chatbot-input button {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .notification-badge {
        min-width: 20px;
        height: 20px;
        font-size: 11px;
        top: -3px;
        right: -3px;
    }

    .button-tooltip {
        display: none;
    }
}

@media (min-width: 577px) and (max-width: 767px) {
    .floating-buttons {
        bottom: 20px !important;
        right: 20px !important;
        gap: 12px !important;
    }

    .float-whatsapp, .float-chatbot {
        width: 58px !important;
        height: 58px !important;
        font-size: 28px !important;
    }

    .chatbot-window {
        width: 330px;
        height: 480px;
        bottom: 75px;
    }

    .button-tooltip {
        display: none;
    }
}

@media (max-width: 768px) {
    .float-whatsapp, 
    .float-chatbot,
    .chatbot-input button,
    .btn-close-white {
        min-width: 48px;
        min-height: 48px;
    }

    .float-whatsapp:hover,
    .float-chatbot:hover {
        transform: none !important;
    }

    .float-whatsapp:active,
    .float-chatbot:active {
        transform: scale(0.95) !important;
    }

    .chatbot-window {
        max-height: 80vh;
        max-width: 90vw;
    }

    .chatbot-messages {
        -webkit-overflow-scrolling: touch;
    }

    .floating-buttons {
        bottom: max(15px, env(safe-area-inset-bottom)) !important;
        right: max(15px, env(safe-area-inset-right)) !important;
    }
}

@media (max-height: 600px) {
    .chatbot-window {
        height: 400px;
        bottom: 70px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .floating-buttons {
        bottom: 10px !important;
        right: 10px !important;
    }

    .chatbot-window {
        height: 70vh;
        max-height: 300px;
        bottom: 65px;
    }

    .chatbot-messages {
        max-height: calc(70vh - 120px);
    }
}

@media (prefers-contrast: high) {
    .float-whatsapp {
        background: #128C7E !important;
        border: 3px solid #000 !important;
    }

    .float-chatbot {
        background: #F25F3A !important;
        border: 3px solid #000 !important;
    }

    .button-tooltip {
        border: 2px solid #000;
    }
}

@media (prefers-reduced-motion: reduce) {
    .float-whatsapp,
    .float-chatbot,
    .chatbot-window,
    .message,
    .chatbot-input button {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .floating-buttons {
        display: none !important;
    }
}