/* Chat Widget - Siempre Tour */
.chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #215093;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(33,80,147,0.4);
    transition: transform 0.2s, background 0.2s;
    border: none;
    font-size: 24px;
}
.chat-bubble:hover {
    transform: scale(1.1);
    background: #1a3f75;
}
.chat-bubble .chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #f33807;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.chat-bubble .chat-badge.show {
    display: flex;
}

.chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(33,80,147,0.25);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.chat-window.open {
    display: flex;
}

.chat-header {
    background: #215093;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chat-header-title {
    font-weight: 600;
    font-size: 15px;
}
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-header-clear,
.chat-header-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.2s;
}
.chat-header-clear:hover,
.chat-header-close:hover {
    color: #fff;
}
.chat-header-close {
    font-size: 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}
.chat-msg.user {
    align-self: flex-end;
    background: #215093;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
    align-self: flex-start;
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 4px;
}
.chat-msg .chat-copy-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: inherit;
    opacity: 0;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    border-radius: 4px;
    transition: opacity 0.2s, background 0.2s;
}
.chat-msg:hover .chat-copy-btn {
    opacity: 0.5;
}
.chat-msg .chat-copy-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.1);
}
.chat-msg.user .chat-copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

.chat-typing {
    padding: 10px 16px;
    font-size: 14px;
    color: #999;
    display: none;
}
.chat-typing.show {
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-typing-dots {
    display: flex;
    gap: 4px;
}
.chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: #215093;
    border-radius: 50%;
    opacity: 0.4;
    animation: chatDot 1.4s infinite ease-in-out;
}
.chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes chatDot {
    0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
    40% { opacity: 1; transform: scale(1.2); }
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.chat-input:focus {
    border-color: #215093;
}
.chat-send {
    background: #215093;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}
.chat-send:hover {
    background: #1a3f75;
}
.chat-send:disabled {
    background: #a0b8d8;
    cursor: not-allowed;
}

/* Retry button */
.chat-retry-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: #215093;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.2s;
}
.chat-retry-btn:hover {
    background: #f1f1f1;
}

/* Mobile */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 120px);
        bottom: 88px;
        right: 8px;
        border-radius: 12px;
    }
    .chat-bubble {
        bottom: 16px;
        right: 16px;
    }
}
