/* ========================================
   AEROSIG - Chat Widget & WhatsApp Button
   ======================================== */

/* Contenedor de botones flotantes */
.floating-buttons {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

/* Botón de WhatsApp */
.whatsapp-btn {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.whatsapp-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Tooltip de WhatsApp */
.whatsapp-btn::before {
    content: 'Escríbenos por WhatsApp';
    position: absolute;
    right: 70px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.whatsapp-btn:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Botón del Chat */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(30, 58, 95, 0.5);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: all 0.3s ease;
}

.chat-toggle-btn .chat-close-icon {
    display: none;
}

.chat-toggle-btn.active .chat-icon {
    display: none;
}

.chat-toggle-btn.active .chat-close-icon {
    display: block;
}

/* Indicador de nuevo mensaje */
.chat-toggle-btn::after {
    content: '1';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.chat-toggle-btn.no-badge::after {
    display: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========================================
   CHAT WINDOW
   ======================================== */

.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.chat-widget.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-header-info p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    opacity: 0.9;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    background: white;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.user {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s 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(-6px); }
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-reply-btn {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-reply-btn:hover {
    background: #0369a1;
    color: white;
    border-color: #0369a1;
}

/* Contact Card in Chat */
.chat-contact-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
}

.chat-contact-card h5 {
    margin: 0 0 12px;
    color: #166534;
    font-size: 0.9rem;
}

.chat-contact-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.chat-contact-btn.whatsapp {
    background: #25D366;
    color: white;
}

.chat-contact-btn.whatsapp:hover {
    background: #1da851;
}

.chat-contact-btn.form {
    background: #1e3a5f;
    color: white;
}

.chat-contact-btn.form:hover {
    background: #0f766e;
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: #0f766e;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 480px) {
    .floating-buttons {
        bottom: 16px;
        right: 16px;
    }

    .whatsapp-btn,
    .chat-toggle-btn {
        width: 54px;
        height: 54px;
    }

    .whatsapp-btn svg {
        width: 28px;
        height: 28px;
    }

    .chat-toggle-btn svg {
        width: 24px;
        height: 24px;
    }

    .whatsapp-btn::before {
        display: none;
    }

    .chat-widget {
        bottom: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: 500px;
    }
}

