/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: var(--font-body);
}

/* Chat Bubble (Toggle Button) */
.chat-bubble {
    width: 60px;
    height: 60px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    outline: none;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.chat-bubble svg {
    width: 30px;
    height: 30px;
    fill: var(--bg-color);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    /* Slightly wider for cards */
    height: 600px;
    /* Taller for content */
    background-color: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    /* Prevent interaction when closed */
}

.chat-window.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    padding: 15px;
    background-color: rgba(212, 175, 55, 0.1);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-family: var(--font-cinzel);
    font-size: 1.2rem;
    color: var(--accent-color);
}

.close-chat {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-chat:hover {
    color: var(--accent-color);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background-color: var(--accent-color);
    color: var(--bg-color);
    border-bottom-right-radius: 2px;
}

.message.ai {
    align-self: flex-start;
    background-color: rgba(255, 255, 255, 0.05);
    /* Slightly darker for better contrast with cards */
    color: var(--text-color);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    /* Allow AI container to be full width for cards */
    max-width: 95%;
    /* But slightly constrained */
    padding: 0;
    /* Let content handle padding */
    background: transparent;
    /* Remove bg for container, apply to text bubble only */
    border: none;
    /* Remove border for container */
}

/* Inner Text Bubble for AI - mimics old .message.ai */
.ai-text-bubble {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 10px;
    border-bottom-left-radius: 2px;
    display: inline-block;
    margin-bottom: 10px;
}

.message.system {
    align-self: center;
    background: none;
    color: #888;
    font-size: 0.8rem;
    text-align: center;
    border: none;
}

/* Rich UI Elements - Cards */
.bot-card-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 5px;
    width: 100%;
}

.bot-card {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
    padding: 15px;
    transition: transform 0.2s, border-color 0.2s;
}

.bot-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.bot-card h4 {
    margin: 0 0 5px 0;
    color: var(--accent-color);
    font-family: var(--font-cinzel);
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bot-card .price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    background: rgba(212, 175, 55, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
}

.bot-card ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    font-size: 0.85rem;
    color: #ccc;
}

.bot-card ul li {
    margin-bottom: 5px;
    padding-left: 15px;
    position: relative;
}

.bot-card ul li::before {
    content: "â€¢";
    color: var(--accent-color);
    position: absolute;
    left: 0;
}

.bot-action-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-weight: bold;
    cursor: pointer;
}

.bot-action-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    align-self: flex-start;
    width: fit-content;
    display: none;
    /* Hidden by default */
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--text-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 15px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    border-color: var(--accent-color);
}

.send-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.send-btn:disabled {
    color: #555;
    cursor: not-allowed;
    transform: none;
}