/* --- Styles for TermesBot Chatbot --- */
.termes-bot-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: var(--font-body), sans-serif;
}

/* Chat Button */
.termes-bot-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-gold-gradient);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(245, 166, 35, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.termes-bot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(245, 166, 35, 0.6);
}

.termes-bot-btn:active {
    transform: scale(0.95);
}

.termes-bot-btn svg {
    transition: transform 0.3s ease;
}

.termes-bot-btn .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #E53935;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg-dark);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Chat Window */
.termes-bot-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 520px;
    max-height: 80vh;
    background: rgba(17, 17, 17, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.3s;
}

.termes-bot-chat-window.hidden-chat {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

/* Header */
.chat-header {
    padding: 16px 20px;
    background: rgba(245, 166, 35, 0.1);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.avatar-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #43A047;
    border-radius: 50%;
    border: 2px solid #111;
}

.chat-title-area h2 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-white);
    margin: 0;
}

.chat-title-area p {
    font-size: 11px;
    color: var(--color-text-muted);
    margin: 0;
}

.chat-close-btn,
.chat-reset-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn:hover,
.chat-reset-btn:hover {
    color: var(--color-white);
    background: rgba(255,255,255,0.1);
}

/* Messages area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Message Bubble */
.message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeInUp 0.3s ease forwards;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.bot-message .message-content {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
}

.message-content a {
    color: #f5a623 !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 10 !important;
    word-break: break-word !important;
    display: inline !important;
}

.message-content a:hover {
    color: #f7c948 !important;
    text-decoration: none !important;
}

.user-message .message-content {
    background: var(--color-gold-gradient);
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: var(--color-text-muted);
    padding: 0 4px;
}

.user-message .message-time {
    align-self: flex-end;
}

/* Quick Replies - Compact Chips */
.quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 6px;
    animation: fadeInUp 0.3s ease forwards;
}

.quick-reply-btn {
    background: rgba(245, 166, 35, 0.08);
    border: 1px solid rgba(245, 166, 35, 0.25);
    color: var(--color-gold);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    width: auto;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: var(--color-gold-gradient);
    color: #000;
    border-color: transparent;
    transform: translateY(-1px);
}

/* Footer & Input Area */
.chat-footer-wrapper {
    background: rgba(12, 12, 14, 0.95);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-input-area {
    padding: 12px 14px 6px;
    background: transparent;
    border: none;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 9px 14px;
    border-radius: 20px;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.chat-input-area input:focus {
    border-color: var(--color-gold);
    background: rgba(255, 255, 255, 0.08);
}

.chat-input-area button {
    background: var(--color-gold-gradient);
    color: #000;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-input-area button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.3);
}

/* Typings Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
    width: fit-content;
    align-self: flex-start;
    animation: fadeInUp 0.3s ease;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--color-text-muted);
    border-radius: 50%;
    animation: wave-dots 1.3s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes wave-dots {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.hidden {
    display: none !important;
}

/* Pastilla Legal - Variant 1 Groc Daurat */
.chat-legal-notice {
    margin: 8px 14px 12px;
    padding: 8px 12px;
    background: rgba(245, 166, 35, 0.14);
    border: 1px solid rgba(245, 166, 35, 0.35);
    border-radius: 14px;
    font-family: var(--font-body), sans-serif;
    font-size: 10px;
    line-height: 1.45;
    color: #eaeaea;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.chat-legal-notice a {
    color: #ffd36e;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.chat-legal-notice a:hover {
    color: #ffffff;
}

@media (max-width: 480px) {
    .termes-bot-wrapper {
        bottom: 20px;
        right: 20px;
    }

    .termes-bot-chat-window {
        position: fixed;
        bottom: 20px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        height: 75vh;
        max-height: 560px;
        border-radius: 16px;
    }
}


