/**
 * chat.css - Estilos del widget de chat flotante
 * Incluye animaciones, transiciones y diseño responsive
 */

/* ========== WIDGET PRINCIPAL ========== */
.xtravel-chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ========== BOTÓN FLOTANTE PRINCIPAL ========== */
.xtravel-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.xtravel-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.xtravel-chat-trigger:active {
    transform: scale(0.95);
}

/* Animación de pulso */
.xtravel-chat-trigger::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Iconos del botón */
.xtravel-chat-icon,
.xtravel-chat-close-icon {
    position: absolute;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xtravel-chat-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.xtravel-chat-close-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.xtravel-chat-trigger.active .xtravel-chat-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.xtravel-chat-trigger.active .xtravel-chat-close-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ========== MENÚ DE OPCIONES ========== */
.xtravel-chat-menu {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.xtravel-chat-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.xtravel-chat-menu-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.xtravel-chat-menu-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.xtravel-chat-menu-options {
    padding: 12px 0;
}

/* ========== OPCIONES DEL MENÚ ========== */
.xtravel-chat-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    width: 100%;
    border: none;
    background: white;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
}

.xtravel-chat-option:hover {
    background: #f8f9fa;
    transform: translateX(4px);
}

.xtravel-chat-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.xtravel-chat-option-text {
    flex: 1;
    text-align: left;
    font-weight: 500;
}

/* ========== MODALES ========== */
.xtravel-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.xtravel-chat-modal.active {
    opacity: 1;
    visibility: visible;
}

.xtravel-chat-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.xtravel-chat-modal.active .xtravel-chat-modal-content {
    transform: scale(1) translateY(0);
}

.xtravel-chat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.xtravel-chat-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

/* Área de mensajes */
.xtravel-chat-message {
    padding: 12px 16px;
    margin: 0 20px 15px 20px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideDown 0.3s ease;
}

.xtravel-chat-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.xtravel-chat-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.xtravel-chat-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.xtravel-chat-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* ========== FORMULARIOS ========== */
.xtravel-chat-form {
    padding: 20px;
}

.xtravel-chat-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.xtravel-chat-form-group {
    flex: 1;
    margin-bottom: 0;
}

.xtravel-chat-form > .xtravel-chat-form-group {
    margin-bottom: 12px;
}

.xtravel-chat-form-group input,
.xtravel-chat-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.xtravel-chat-form-group input:focus,
.xtravel-chat-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.xtravel-chat-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox de términos */
.xtravel-chat-checkbox-group {
    margin-top: 12px;
}

.xtravel-chat-checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #555555;
    line-height: 1.5;
}

.xtravel-chat-checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.xtravel-chat-checkbox-group span {
    flex: 1;
}

.xtravel-chat-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

/* ========== BOTONES ========== */
.xtravel-chat-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.xtravel-chat-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.xtravel-chat-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.xtravel-chat-btn-whatsapp {
    background: #25D366;
    color: white;
}

.xtravel-chat-btn-whatsapp:hover {
    background: #20ba5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.xtravel-chat-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.xtravel-chat-btn-secondary:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
    .xtravel-chat-widget {
        bottom: 16px;
        left: 16px;
    }
    
    .xtravel-chat-trigger {
        width: 50px;
        height: 50px;
    }
    
    .xtravel-chat-menu {
        width: calc(100vw - 32px);
        left: 0;
        bottom: 70px;
    }
    
    .xtravel-chat-menu-header {
        padding: 14px 16px;
    }
    
    .xtravel-chat-menu-header h3 {
        font-size: 16px;
    }
    
    .xtravel-chat-menu-options {
        padding: 8px 0;
    }
    
    .xtravel-chat-option {
        padding: 10px 16px;
        font-size: 14px;
        gap: 12px;
    }
    
    .xtravel-chat-modal {
        padding: 12px;
    }
    
    .xtravel-chat-modal-content {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .xtravel-chat-modal-header {
        padding: 12px;
    }
    
    .xtravel-chat-modal-header h3 {
        font-size: 15px;
    }
    
    .xtravel-chat-form {
        padding: 12px;
    }
    
    .xtravel-chat-form-row {
        gap: 6px;
        margin-bottom: 8px;
    }
    
    .xtravel-chat-form-group {
        margin-bottom: 0;
    }
    
    .xtravel-chat-form > .xtravel-chat-form-group {
        margin-bottom: 8px;
    }
    
    .xtravel-chat-form-group input,
    .xtravel-chat-form-group textarea {
        padding: 8px 10px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .xtravel-chat-form-group textarea {
        min-height: 60px;
    }
    
    .xtravel-chat-checkbox-group {
        margin-top: 10px;
    }
    
    .xtravel-chat-checkbox-group label {
        font-size: 12px;
        gap: 6px;
    }
    
    .xtravel-chat-checkbox-group input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    
    .xtravel-chat-form-actions {
        flex-direction: column;
        margin-top: 10px;
        gap: 6px;
    }
    
    .xtravel-chat-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ========== ANIMACIONES DE ENTRADA ========== */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.xtravel-chat-widget {
    animation: slideInUp 0.5s ease-out;
}

/* ========== ESTADOS DE CARGA ========== */
.xtravel-chat-btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.xtravel-chat-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}