/* ============================================
   TRAVEL CHAT WIDGET - SunTour v2.0
   Modern, card-based, marketing-ready
   ============================================ */

:root {
    --tcw-primary: #f0a500;
    --tcw-primary-dark: #d49200;
    --tcw-primary-light: #fff8e6;
    --tcw-secondary: #1a1a2e;
    --tcw-secondary-light: #16213e;
    --tcw-accent: #0f3460;
    --tcw-bg: #ffffff;
    --tcw-bg-chat: #f0f2f5;
    --tcw-text: #1a1a2e;
    --tcw-text-light: #6b7280;
    --tcw-text-muted: #9ca3af;
    --tcw-border: #e5e7eb;
    --tcw-success: #25d366;
    --tcw-success-dark: #1fba59;
    --tcw-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    --tcw-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --tcw-radius: 20px;
    --tcw-radius-sm: 12px;
    --tcw-z: 10000;
    --tcw-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ====== FAB Button ====== */
.tcw-fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tcw-primary) 0%, var(--tcw-primary-dark) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(240, 165, 0, 0.45);
    z-index: var(--tcw-z);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: tcw-pulse 2.5s infinite;
}

.tcw-fab:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 28px rgba(240, 165, 0, 0.55);
}

.tcw-fab svg { width: 28px; height: 28px; fill: white; }

.tcw-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    border: 3px solid white;
    animation: tcw-badge-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Tooltip del FAB */
.tcw-fab-tooltip {
    position: absolute;
    right: 76px;
    background: var(--tcw-secondary);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--tcw-font);
    white-space: nowrap;
    box-shadow: var(--tcw-shadow-sm);
    animation: tcw-tooltip-in 0.4s ease;
    pointer-events: none;
}

.tcw-fab-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: var(--tcw-secondary);
    border-right: none;
}

@keyframes tcw-tooltip-in {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes tcw-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(240, 165, 0, 0.45); }
    50% { box-shadow: 0 4px 32px rgba(240, 165, 0, 0.7); }
}

@keyframes tcw-badge-pop {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ====== Chat Container ====== */
.tcw-container {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background: var(--tcw-bg);
    border-radius: var(--tcw-radius);
    box-shadow: var(--tcw-shadow);
    z-index: var(--tcw-z);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--tcw-font);
}

.tcw-container.tcw-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ====== Header ====== */
.tcw-header {
    background: linear-gradient(135deg, var(--tcw-secondary) 0%, var(--tcw-accent) 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.tcw-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 120px;
    height: 120px;
    background: rgba(240, 165, 0, 0.1);
    border-radius: 50%;
}

.tcw-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tcw-primary) 0%, #ffb938 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(240, 165, 0, 0.3);
    position: relative;
}

.tcw-header-avatar svg { width: 22px; height: 22px; fill: white; }

.tcw-header-avatar-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--tcw-secondary);
}

.tcw-header-info { flex: 1; min-width: 0; position: relative; }

.tcw-header-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

.tcw-header-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin: 2px 0 0 0;
}

.tcw-header-status {
    font-size: 11px;
    color: #86efac;
    margin: 2px 0 0 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.tcw-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    animation: tcw-status-pulse 2s infinite;
}

@keyframes tcw-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tcw-header-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    opacity: 0.8;
    transition: all 0.2s;
    flex-shrink: 0;
}

.tcw-header-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.2); }
.tcw-header-close svg { width: 18px; height: 18px; fill: currentColor; }

/* ====== Messages Area ====== */
.tcw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--tcw-bg-chat);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 320px;
    max-height: 380px;
    scroll-behavior: smooth;
}

.tcw-messages::-webkit-scrollbar { width: 4px; }
.tcw-messages::-webkit-scrollbar-track { background: transparent; }
.tcw-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* ====== Message Bubbles ====== */
.tcw-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: var(--tcw-radius-sm);
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    animation: tcw-msg-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.tcw-msg-bot {
    align-self: flex-start;
    background: white;
    color: var(--tcw-text);
    border: 1px solid var(--tcw-border);
    border-bottom-left-radius: 4px;
    box-shadow: var(--tcw-shadow-sm);
}

.tcw-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--tcw-primary) 0%, var(--tcw-primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(240, 165, 0, 0.25);
}

.tcw-msg-bot strong { font-weight: 700; color: var(--tcw-secondary); }
.tcw-msg-bot em { font-style: italic; color: var(--tcw-text-light); }

/* ====== Package Card ====== */
.tcw-package-card {
    align-self: flex-start;
    background: white;
    border-radius: var(--tcw-radius-sm);
    border: 1px solid var(--tcw-border);
    overflow: hidden;
    max-width: 92%;
    box-shadow: var(--tcw-shadow-sm);
    animation: tcw-msg-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tcw-package-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tcw-package-card-header {
    background: linear-gradient(135deg, var(--tcw-secondary) 0%, var(--tcw-accent) 100%);
    color: white;
    padding: 12px 14px;
    position: relative;
}

.tcw-package-card-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tcw-package-card-badge {
    display: inline-block;
    background: var(--tcw-primary);
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tcw-package-card-body {
    padding: 12px 14px;
}

.tcw-package-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 12.5px;
    color: var(--tcw-text);
    border-bottom: 1px solid #f3f4f6;
}

.tcw-package-card-row:last-child { border-bottom: none; }

.tcw-package-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.tcw-package-card-icon.tcw-icon-location { background: #ede9fe; }
.tcw-package-card-icon.tcw-icon-price { background: #dcfce7; }
.tcw-package-card-icon.tcw-icon-duration { background: #fef3c7; }
.tcw-package-card-icon.tcw-icon-includes { background: #dbeafe; }
.tcw-package-card-icon.tcw-icon-dates { background: #fce7f3; }

.tcw-package-card-label {
    font-weight: 600;
    color: var(--tcw-text-light);
    min-width: 55px;
}

.tcw-package-card-value { flex: 1; font-weight: 500; }

.tcw-package-card-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--tcw-primary-dark);
    letter-spacing: -0.5px;
}

.tcw-package-card-price-label {
    font-size: 11px;
    color: var(--tcw-text-muted);
    font-weight: 400;
}

.tcw-package-card-footer {
    padding: 10px 14px;
    background: #f9fafb;
    border-top: 1px solid var(--tcw-border);
}

.tcw-package-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tcw-package-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--tcw-primary-light);
    color: var(--tcw-primary-dark);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

/* ====== Summary Card ====== */
.tcw-summary-card {
    align-self: flex-start;
    background: white;
    border-radius: var(--tcw-radius-sm);
    border: 2px solid var(--tcw-primary);
    overflow: hidden;
    max-width: 92%;
    box-shadow: 0 4px 20px rgba(240, 165, 0, 0.15);
    animation: tcw-msg-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tcw-summary-card-header {
    background: linear-gradient(135deg, var(--tcw-primary) 0%, #ffb938 100%);
    color: white;
    padding: 14px 16px;
    text-align: center;
}

.tcw-summary-card-header-title {
    font-size: 14px;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tcw-summary-card-header-sub {
    font-size: 11px;
    margin: 4px 0 0 0;
    opacity: 0.9;
}

.tcw-summary-card-body { padding: 14px 16px; }

.tcw-summary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
    font-size: 13px;
}

.tcw-summary-row:last-child { border-bottom: none; }

.tcw-summary-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--tcw-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.tcw-summary-label {
    font-size: 11px;
    color: var(--tcw-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tcw-summary-value {
    font-weight: 700;
    color: var(--tcw-text);
    font-size: 13px;
}

/* ====== Quick Reply Chips ====== */
.tcw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    max-width: 92%;
    animation: tcw-msg-in 0.4s ease;
}

.tcw-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    background: white;
    border: 1.5px solid var(--tcw-primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tcw-primary-dark);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--tcw-font);
}

.tcw-chip:hover {
    background: var(--tcw-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(240, 165, 0, 0.3);
}

/* ====== Typing Indicator ====== */
.tcw-typing {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
    background: white;
    border: 1px solid var(--tcw-border);
    border-radius: var(--tcw-radius-sm);
    border-bottom-left-radius: 4px;
    box-shadow: var(--tcw-shadow-sm);
}

.tcw-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tcw-text-muted);
    animation: tcw-typing-bounce 1.4s infinite ease-in-out;
}

.tcw-typing-dot:nth-child(1) { animation-delay: 0s; }
.tcw-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.tcw-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes tcw-typing-bounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ====== WhatsApp Button ====== */
.tcw-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--tcw-success) 0%, var(--tcw-success-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--tcw-radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--tcw-font);
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: tcw-whatsapp-glow 2s infinite;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
    align-self: flex-start;
    max-width: 92%;
}

.tcw-whatsapp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
    color: white;
    text-decoration: none;
}

.tcw-whatsapp-btn svg { width: 22px; height: 22px; fill: white; flex-shrink: 0; }

@keyframes tcw-whatsapp-glow {
    0%, 100% { box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35); }
    50% { box-shadow: 0 4px 28px rgba(37, 211, 102, 0.55); }
}

/* ====== Input Area ====== */
.tcw-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--tcw-border);
    display: flex;
    gap: 8px;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.tcw-input {
    flex: 1;
    border: 1.5px solid var(--tcw-border);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--tcw-font);
    resize: none;
    max-height: 80px;
    line-height: 1.4;
    background: #f9fafb;
}

.tcw-input:focus {
    border-color: var(--tcw-primary);
    box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.1);
    background: white;
}

.tcw-input { color: #000000; }
.tcw-input::placeholder { color: #999999; }

.tcw-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tcw-primary) 0%, var(--tcw-primary-dark) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(240, 165, 0, 0.25);
}

.tcw-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(240, 165, 0, 0.4);
}

.tcw-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.tcw-send-btn svg { width: 18px; height: 18px; fill: white; }

/* ====== Welcome ====== */
.tcw-welcome {
    text-align: center;
    padding: 6px 0;
    color: var(--tcw-text-muted);
    font-size: 11px;
    font-weight: 500;
}

/* ====== Powered By ====== */
.tcw-powered {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: var(--tcw-text-muted);
    background: #f9fafb;
    border-top: 1px solid var(--tcw-border);
}

/* ====== Responsive ====== */
@media (max-width: 480px) {
    .tcw-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .tcw-messages {
        min-height: 50vh;
        max-height: calc(100vh - 160px);
        max-height: calc(100dvh - 160px);
    }

    .tcw-fab { bottom: 85px; right: 20px; }
    .tcw-fab-tooltip { display: none; }
}
