/**
 * XTravel Chat WhatsApp - Estilos
 * Estilos Tailwind nativos con diseño minimalista
 * @package XTravel
 * @version 2.0.0
 */

/* ====================================
   BOTÓN FLOTANTE
   ==================================== */
.xtravel-chat-trigger {
    position: fixed !important;
    bottom: 1rem !important;
    left: 1rem !important;
    right: auto !important;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.xtravel-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15);
}

.xtravel-chat-trigger:active {
    transform: scale(0.95);
}

.xtravel-chat-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.xtravel-chat-text {
    display: none;
}

/* ====================================
   MODAL
   ==================================== */
.xtravel-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: flex-end;
    justify-content: flex-end;
}

.xtravel-chat-modal.active {
    display: flex;
}

.xtravel-chat-overlay {
    position: absolute;
    inset: 0;
    background-color: transparent;
    pointer-events: none;
}

/* ====================================
   CONTENEDOR DEL CHAT
   ==================================== */
.xtravel-chat-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    background-color: #f0fdf4;
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ====================================
   HEADER
   ==================================== */
.xtravel-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 60px;
}

.xtravel-chat-header-content {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.xtravel-chat-avatar {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
    border-radius: 50%;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.xtravel-chat-avatar svg {
    width: 1.25rem;
    height: 1.25rem;
}

.xtravel-chat-title-wrapper {
    flex: 1;
}

.xtravel-chat-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.xtravel-chat-subtitle {
    font-size: 0.6875rem;
    opacity: 0.9;
    margin: 0.125rem 0 0 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.xtravel-chat-subtitle::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #4ade80;
    border-radius: 50%;
    display: inline-block;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.xtravel-chat-close-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.xtravel-chat-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.xtravel-chat-close-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ====================================
   MENSAJES
   ==================================== */
.xtravel-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    scroll-behavior: smooth;
    background: linear-gradient(to bottom, #f0fdf4 0%, #ffffff 100%);
}

.xtravel-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.xtravel-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.xtravel-chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #16a34a, #15803d);
    border-radius: 9999px;
}

.xtravel-message {
    max-width: 82%;
    padding: 0.625rem 0.875rem;
    border-radius: 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    animation: messageAppear 0.3s ease-out;
    position: relative;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.xtravel-message-bot {
    align-self: flex-start;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(22, 163, 74, 0.1);
}

.xtravel-message-bot::before {
    content: '';
    position: absolute;
    left: -6px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 12px 12px;
    border-color: transparent transparent #ffffff transparent;
    filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.05));
}

.xtravel-message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.3);
}

.xtravel-message-user::before {
    content: '';
    position: absolute;
    right: -6px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 12px 12px 0;
    border-color: transparent #15803d transparent transparent;
}

/* ====================================
   OPCIONES (Botones rápidos)
   ==================================== */
.xtravel-chat-options {
    padding: 0 0.75rem 0.5rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    max-height: 35vh;
    overflow-y: auto;
}

.xtravel-chat-options::-webkit-scrollbar {
    width: 3px;
}

.xtravel-chat-options::-webkit-scrollbar-thumb {
    background: rgba(22, 163, 74, 0.3);
    border-radius: 9999px;
}

.xtravel-option-btn {
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    color: #16a34a;
    border: 1.5px solid #16a34a;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.xtravel-option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.xtravel-option-btn:hover::before {
    left: 100%;
}

.xtravel-option-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border-color: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3);
}

.xtravel-option-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ====================================
   INPUT
   ==================================== */
.xtravel-chat-input-wrapper {
    border-top: 1px solid rgba(22, 163, 74, 0.1);
    background: linear-gradient(to top, #ffffff 0%, #f9fafb 100%);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.xtravel-chat-input-wrapper.hidden {
    display: none;
}

.xtravel-chat-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
}

.xtravel-chat-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8125rem;
    outline: none;
    transition: all 0.2s;
    background-color: #ffffff;
}

.xtravel-chat-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
    background-color: #ffffff;
}

.xtravel-chat-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

.xtravel-chat-send-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.xtravel-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.xtravel-chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.xtravel-chat-send-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    opacity: 0.5;
}

.xtravel-chat-send-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ====================================
   MENSAJE FINAL
   ==================================== */
.xtravel-chat-final-message {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(10px);
    z-index: 100;
    padding: 1.5rem;
    text-align: center;
}

.xtravel-chat-final-message.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.xtravel-chat-final-content {
    max-width: 280px;
}

.xtravel-chat-final-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border-radius: 50%;
    animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 16px rgba(22, 163, 74, 0.3);
}

@keyframes scaleIn {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.xtravel-chat-final-icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.xtravel-chat-final-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #15803d;
    margin: 0 0 0.625rem 0;
    animation: slideDown 0.5s ease-out 0.2s backwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.xtravel-chat-final-text {
    font-size: 0.8125rem;
    color: #374151;
    margin: 0 0 1.25rem 0;
    line-height: 1.6;
    animation: slideDown 0.5s ease-out 0.3s backwards;
}

.xtravel-chat-final-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    color: #16a34a;
    font-size: 0.8125rem;
    font-weight: 500;
    animation: slideDown 0.5s ease-out 0.4s backwards;
}

.xtravel-spinner {
    width: 1.125rem;
    height: 1.125rem;
    border: 2.5px solid rgba(22, 163, 74, 0.2);
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====================================
   DATE PICKER (Selector de fecha)
   ==================================== */
.xtravel-date-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(to top, #ffffff 0%, #f9fafb 100%);
    border-top: 1px solid rgba(22, 163, 74, 0.1);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.xtravel-date-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.8125rem;
    outline: none;
    transition: all 0.2s;
    background-color: #ffffff;
}

.xtravel-date-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.xtravel-date-btn {
    padding: 0.625rem 1.125rem;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.xtravel-date-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.xtravel-date-btn:active {
    transform: translateY(0);
}

/* ====================================
   RESPONSIVE - TABLET Y DESKTOP
   ==================================== */
@media (min-width: 640px) {
    .xtravel-chat-trigger {
        width: auto;
        padding: 0.875rem 1.25rem;
        border-radius: 9999px;
        gap: 0.625rem;
    }
    
    .xtravel-chat-text {
        display: inline;
        font-size: 0.875rem;
    }
    
    .xtravel-chat-modal {
        align-items: flex-end;
        justify-content: flex-start;
    }
    
    .xtravel-chat-container {
        width: 400px;
        max-width: 400px;
        height: auto;
        max-height: 700px;
        margin-left: 1.25rem;
        margin-bottom: 5rem;
        border-radius: 1.25rem;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .xtravel-chat-header {
        border-radius: 1.25rem 1.25rem 0 0;
        padding: 1rem 1.25rem;
    }
    
    .xtravel-chat-avatar {
        width: 2.75rem;
        height: 2.75rem;
    }
    
    .xtravel-chat-avatar svg {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .xtravel-chat-title {
        font-size: 1rem;
    }
    
    .xtravel-chat-subtitle {
        font-size: 0.75rem;
    }
    
    .xtravel-chat-messages {
        padding: 1rem;
        gap: 0.875rem;
    }
    
    .xtravel-message {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    .xtravel-chat-options {
        padding: 0 1rem 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .xtravel-option-btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .xtravel-chat-input-container {
        padding: 0.875rem 1rem;
    }
    
    .xtravel-chat-input {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    .xtravel-chat-send-btn {
        width: 2.75rem;
        height: 2.75rem;
    }
    
    .xtravel-chat-send-btn svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .xtravel-date-picker {
        padding: 0.875rem 1rem;
    }
    
    .xtravel-date-input {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
    
    .xtravel-date-btn {
        font-size: 0.875rem;
        padding: 0.75rem 1.25rem;
    }
    
    .xtravel-chat-final-content {
        max-width: 320px;
    }
    
    .xtravel-chat-final-icon {
        width: 4rem;
        height: 4rem;
    }
    
    .xtravel-chat-final-icon svg {
        width: 2rem;
        height: 2rem;
    }
    
    .xtravel-chat-final-title {
        font-size: 1.25rem;
    }
    
    .xtravel-chat-final-text {
        font-size: 0.875rem;
    }
}

@media (min-width: 768px) {
    .xtravel-chat-container {
        width: 420px;
        max-width: 420px;
        max-height: 750px;
    }
}

/* ====================================
   ACCESIBILIDAD
   ==================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para accesibilidad */
.xtravel-chat-trigger:focus-visible,
.xtravel-chat-close-btn:focus-visible,
.xtravel-chat-send-btn:focus-visible,
.xtravel-option-btn:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}
