/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: var(--bg-card);
    border-radius: 15px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    animation: slideUp 0.3s ease-in-out;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h2 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header p {
    margin: 5px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
}

.close-btn:hover {
    transform: scale(1.2);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-card-2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ff6b6b;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ee5a6f;
}

/* Message Styles */
.message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease-in-out;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
}

.user-message .message-avatar {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.message-content {
    flex: 1;
    padding: 12px 15px;
    border-radius: 12px;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-mild);
}

.user-message .message-content {
    background: #ff6b6b;
    color: white;
    border-radius: 12px 0 12px 12px;
}

.user-message {
    justify-content: flex-end;
}

/* Restaurant List in Message */
.restaurant-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.restaurant-item {
    background: var(--bg-card-2);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid #ff6b6b;
}

.restaurant-item:hover {
    background: var(--bg-hover);
    transform: translateX(5px);
}

.restaurant-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.restaurant-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

.restaurant-rating {
    color: #ff6b6b;
    font-weight: 600;
}

.restaurant-distance {
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.restaurant-distance i {
    color: #ff6b6b;
    font-size: 10px;
}

.restaurant-address {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.4;
}

.restaurant-address i {
    color: #ff6b6b;
    margin-top: 2px;
    font-size: 10px;
    flex-shrink: 0;
}

/* Suggestions Area */
.suggestions-area {
    padding: 15px 20px;
    background: var(--bg-card);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 100px;
    overflow-y: auto;
}

.suggestion-btn {
    padding: 12px;
    background: var(--bg-elevated);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.suggestion-btn:hover {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
    transform: scale(1.05);
}

/* Back / Home button — visually distinct from action chips */
.suggestion-back-btn {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 2px dashed var(--border-mild);
    font-size: 12px;
    grid-column: 1 / -1; /* span full width */
    justify-content: center;
    padding: 8px;
}

.suggestion-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-mild);
    border-style: dashed;
    transform: scale(1.02);
}

.suggestion-btn i {
    font-size: 14px;
}

/* Input Area */
.chat-input-area {
    padding: 15px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-mild);
    border-radius: 0 0 15px 15px;
}

.chat-input-area .input-group { /* scoped: the bare class also hit the feed search bar */
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.chat-input {
    flex: 1;
    border: 2px solid var(--border-mild);
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    background: var(--bg-card-2);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #ff6b6b;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 16px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

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

.input-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9998;
    font-size: 24px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.5);
}

/* Tooltip implementation */
.chatbot-toggle::after {
    content: "Chat with Foodie Assistant";
    position: absolute;
    bottom: 75px;
    right: 0;
    background: #1a1a1a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    border: 1.5px solid #ffcc00; /* Golden border like in image */
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    transform: translateY(10px);
    z-index: 10000;
}

.chatbot-toggle::before {
    content: "";
    position: absolute;
    bottom: 65px;
    right: 20px;
    border-width: 10px 10px 0 10px;
    border-style: solid;
    border-color: #ffcc00 transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    transform: translateY(10px);
    z-index: 10001;
}

.chatbot-toggle:hover::after,
.chatbot-toggle:hover::before {
    opacity: 1;
    transform: translateY(0);
}

.chatbot-toggle span {
    display: none; /* Hide old text */
}


/* Modal for Restaurant Details */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.restaurant-detail-header {
    margin-bottom: 20px;
}

.restaurant-detail-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.restaurant-detail-name {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.restaurant-detail-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 14px;
}

.meta-item i {
    color: #ff6b6b;
    font-size: 16px;
}

.restaurant-detail-section {
    margin-bottom: 20px;
}

.restaurant-detail-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.restaurant-detail-section p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.review-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #ff6b6b;
}

.review-rating {
    color: #ff6b6b;
    font-weight: 600;
    margin-bottom: 5px;
}

.review-text {
    color: #333;
    font-size: 13px;
}

.review-date {
    color: #999;
    font-size: 11px;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 600px) {
    /* sit above the mobile bottom nav */
    .chatbot-toggle { bottom: 84px; right: 16px; width: 52px; height: 52px; }
    .chatbot-toggle::after, .chatbot-toggle::before { display: none; }
    .chatbot-container { right: 10px; bottom: 80px; height: min(560px, calc(100dvh - 100px)); }
    .chatbot-container {
        width: calc(100% - 20px);
        height: 500px;
        border-radius: 10px;
    }

    .suggestions-area {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Loading State */
.message.typing {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* ── Craving chatbot (v2) ── */
.chatbot-container { font-family: inherit; overflow: hidden; }
.chatbot-container .message-avatar { font-size: 18px; }
.bot-message .message-avatar { background: linear-gradient(135deg, #FFB700, #FF6B35); }
.message-content p + p { margin-top: 6px; }
.message-content { min-width: 0; line-height: 1.8; font-size: 14px; }
[dir="rtl"] .user-message .message-content { border-radius: 0 12px 12px 12px; }
.user-message .message-content { flex: 0 1 auto; max-width: 80%; }

/* Chips: one swipeable row instead of a cramped grid */
.suggestions-area { display: flex; gap: 8px; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 10px 14px; scrollbar-width: none;
  border-top: 1px solid var(--border-subtle); grid-template-columns: none; }
.suggestions-area::-webkit-scrollbar { display: none; }
.suggestions-area .suggestion-btn { flex: none; padding: 8px 14px; border-radius: var(--radius-full, 999px); border: 1px solid var(--border-mild);
  background: var(--bg-elevated); font: inherit; font-size: 13px; white-space: nowrap; }
.suggestions-area .suggestion-btn:hover { transform: none; background: rgba(255, 183, 0, .14); border-color: #FFB700; color: var(--text-primary); }
.suggestions-area .suggestion-btn:focus-visible { outline: 2px solid #FFB700; outline-offset: 2px; }

.cb-section { font-weight: 700; margin-bottom: 8px; }
.cb-dishes { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.cb-dish { flex: none; width: 120px; scroll-snap-align: start; text-decoration: none; color: var(--text-primary); display: flex; flex-direction: column; gap: 2px; }
.cb-dish img { width: 120px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--bg-elevated); }
.cb-dish-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-dish-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cb-places { display: flex; flex-direction: column; gap: 8px; }
.cb-place { display: flex; gap: 10px; padding: 8px; border-radius: 12px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); }
.cb-place-img { flex: none; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--bg-hover); }
.cb-place-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cb-place-name { font-weight: 800; font-size: 14px; color: var(--text-primary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-place-name:hover { color: #FFB700; }
.cb-place-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--text-secondary); }
.cb-rating { color: #FFB700; font-weight: 700; }
.cb-reason { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-foryou { align-self: flex-start; font-size: 11px; font-weight: 700; color: #2EC4B6; background: rgba(46, 196, 182, .12); padding: 1px 8px; border-radius: 999px; }
.cb-place-actions { display: flex; gap: 6px; margin-top: 4px; }
.cb-place-actions a { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-decoration: none; color: var(--text-primary); border: 1px solid var(--border-mild); }
.cb-place-actions a:hover, .cb-place-actions a:focus-visible { border-color: #FFB700; color: #FFB700; }

/* "Pick one for me" */
.cb-spin { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.cb-spin-label { font-size: 13px; color: var(--text-secondary); }
.cb-spin-name { font-size: 17px; min-height: 1.6em; }
.cb-pick-title { font-weight: 800; margin-bottom: 8px; }
.cb-place-big { flex-direction: column; border-color: rgba(255, 183, 0, .5); background: radial-gradient(circle at 50% 0, rgba(255, 183, 0, .15), transparent 70%), var(--bg-elevated);
  animation: cbPop .45s cubic-bezier(.2, 1.4, .4, 1); }
.cb-place-big .cb-place-img { width: 100%; height: 130px; }
.cb-place-big .cb-place-name { font-size: 17px; }
@keyframes cbPop { from { transform: scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cb-place-big { animation: none; } }
