/* ===== Brasa Eats Chatbot ===== */

/* Floating Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a050 0%, #b8893a 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(201, 160, 80, 0.4);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(201, 160, 80, 0.55);
}

.chatbot-toggle svg {
    width: 26px;
    height: 26px;
    fill: #fff;
    transition: transform 0.3s ease;
}

.chatbot-toggle.open .icon-chat {
    display: none;
}

.chatbot-toggle.open .icon-close {
    display: block;
}

.chatbot-toggle:not(.open) .icon-close {
    display: none;
}

/* Auto-greet tooltip */
.chatbot-tooltip {
    position: fixed;
    bottom: 84px;
    right: 20px;
    background: #fff;
    color: #333;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.35s ease;
    white-space: nowrap;
    pointer-events: none;
}

.chatbot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 22px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.06);
}

.chatbot-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c9a050;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.chatbot-header-text h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.chatbot-header-text span {
    font-size: 11px;
    color: #aaa;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f7f7;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Message Bubbles */
.chatbot-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msgFadeIn 0.25s ease;
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #c9a050 0%, #b8893a 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ===== Rich HTML inside bot messages ===== */
.chatbot-msg.bot h3,
.chatbot-msg.bot h4 {
    margin: 6px 0 4px 0;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}

.chatbot-msg.bot h3:first-child,
.chatbot-msg.bot h4:first-child {
    margin-top: 0;
}

.chatbot-msg.bot strong, .chatbot-msg.bot b {
    font-weight: 700;
    color: #1a1a1a;
}

.chatbot-msg.bot em {
    color: #888;
    font-size: 12px;
}

.chatbot-msg.bot p {
    margin: 4px 0;
}

.chatbot-msg.bot ul, .chatbot-msg.bot ol {
    margin: 4px 0 4px 16px;
    padding: 0;
}

.chatbot-msg.bot li {
    margin-bottom: 3px;
}

/* Tables inside bot messages */
.chatbot-msg.bot table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}

.chatbot-msg.bot table th {
    background: #1a1a1a;
    color: #c9a050;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chatbot-msg.bot table td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.chatbot-msg.bot table tr:last-child td {
    border-bottom: none;
}

.chatbot-msg.bot table tr:hover td {
    background: #faf6ee;
}

/* Links inside bot messages */
.chatbot-msg.bot a {
    color: #b8893a;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted #c9a050;
    transition: color 0.2s, border-color 0.2s;
}

.chatbot-msg.bot a:hover {
    color: #c9a050;
    border-bottom-style: solid;
}

/* Action link buttons */
.chatbot-msg.bot .chatbot-action-link {
    display: inline-block;
    margin: 6px 6px 2px 0;
    padding: 5px 12px;
    background: linear-gradient(135deg, #c9a050, #b8893a);
    color: #fff !important;
    border: none;
    border-bottom: none;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-msg.bot .chatbot-action-link:hover {
    transform: scale(1.04);
    box-shadow: 0 2px 8px rgba(201, 160, 80, 0.35);
    border-bottom: none;
}

/* Divider inside bot messages */
.chatbot-msg.bot hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 8px 0;
}

/* Typing Indicator */
.chatbot-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #bbb;
    animation: typingBounce 1.2s infinite ease-in-out;
}

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

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        background: #bbb;
    }
    30% {
        transform: translateY(-5px);
        background: #c9a050;
    }
}

/* Input Area */
.chatbot-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e8e8e8;
    background: #fff;
    flex-shrink: 0;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f9f9f9;
}

.chatbot-input:focus {
    border-color: #c9a050;
    background: #fff;
}

.chatbot-input::placeholder {
    color: #aaa;
}

.chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a050 0%, #b8893a 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.08);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 78px;
        border-radius: 12px;
    }

    .chatbot-toggle {
        right: 14px;
        bottom: 14px;
    }

    .chatbot-tooltip {
        right: 14px;
        bottom: 78px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .chatbot-window {
        width: min(90vw, 350px);
    }
}
