/* ================================================
   Stay2Hotel Chatbot Widget v5
   ================================================ */

/* Toggle Button */
.chatbot-toggle-btn {
    position: fixed;
    bottom: 140px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ed7423, #f59542);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(237,116,35,0.4);
    cursor: pointer;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.chatbot-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(237,116,35,0.5);
}
.chatbot-toggle-btn .chatbot-close-icon { display: none; }
.chatbot-toggle-btn.active .chatbot-open-icon { display: none; }
.chatbot-toggle-btn.active .chatbot-close-icon { display: block; }

/* ---- Chat Panel ---- */
.chatbot-panel {
    position: fixed;
    bottom: 206px;
    right: 16px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 1049;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.chatbot-panel.open { display: flex; }

/* ---- Header ---- */
.chatbot-header {
    background: linear-gradient(135deg, #ed7423, #f59542);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.chatbot-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.chatbot-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.chatbot-header-avatar i { font-size: 18px; }
.chatbot-header-info { min-width: 0; }
.chatbot-header-title {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
}
.chatbot-header-status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chatbot-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}
.chatbot-header-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.chatbot-header-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chatbot-header-btn:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

/* ---- Messages Area ---- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #faf9f7;
    -webkit-overflow-scrolling: touch;
}

/* Message Bubbles */
.chatbot-msg {
    display: flex;
    max-width: 88%;
}
.chatbot-msg.assistant { align-self: flex-start; }
.chatbot-msg.user { align-self: flex-end; }

.chatbot-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}
.chatbot-msg.assistant .chatbot-msg-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #ede9e3;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.chatbot-msg.user .chatbot-msg-bubble {
    background: linear-gradient(135deg, #ed7423, #f59542);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 4px rgba(237,116,35,0.2);
}

/* Links */
.chatbot-msg-bubble a { color: #ed7423; text-decoration: underline; }
.chatbot-msg.user .chatbot-msg-bubble a { color: #fff; }

/* Markdown */
.chatbot-msg-bubble ul, .chatbot-msg-bubble ol { margin: 4px 0; padding-left: 18px; }
.chatbot-msg-bubble p { margin: 4px 0; }
.chatbot-msg-bubble strong { font-weight: 600; }

/* ---- Typing Indicator ---- */
.chatbot-typing {
    padding: 6px 12px;
    flex-shrink: 0;
    background: #faf9f7;
}
.chatbot-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #ede9e3;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 10px 16px;
}
.chatbot-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ccc;
    animation: chatbot-bounce 1.2s infinite;
}
.chatbot-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ---- Hotel Cards ---- */
.chatbot-hotel-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.chatbot-hotel-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #ede9e3;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.chatbot-hotel-card:hover {
    border-color: #ed7423;
    box-shadow: 0 2px 10px rgba(237,116,35,0.12);
    text-decoration: none;
    color: #333;
}
.chatbot-hotel-card-info { flex: 1; min-width: 0; }
.chatbot-hotel-card-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chatbot-hotel-card-meta { font-size: 11.5px; color: #999; margin-top: 2px; }
.chatbot-hotel-card-price { font-size: 13px; font-weight: 700; color: #ed7423; white-space: nowrap; }
.chatbot-hotel-card-rating { font-size: 12px; color: #f5a623; }

/* ---- Suggestions ---- */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.chatbot-suggestion-btn {
    background: #fff;
    border: 1px solid #e0dcd6;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12.5px;
    color: #666;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.chatbot-suggestion-btn:hover {
    border-color: #ed7423;
    color: #ed7423;
    background: #fff8f3;
}

/* ---- Bottom Area (disclaimer + input) ---- */
.chatbot-bottom {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #eee;
}
.chatbot-disclaimer {
    font-size: 10.5px;
    color: #bbb;
    text-align: center;
    padding: 6px 12px 0;
}
.chatbot-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 10px;
}
.chatbot-input {
    flex: 1;
    border: 1.5px solid #e0dcd6;
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 14px;
    outline: none;
    line-height: 1.4;
    font-family: inherit;
    background: #faf9f7;
    transition: border-color 0.15s, background 0.15s;
    /* prevent zoom on iOS */
    font-size: 16px;
}
.chatbot-input:focus {
    border-color: #ed7423;
    background: #fff;
}
.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ed7423, #f59542);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    transition: opacity 0.15s, transform 0.15s;
}
.chatbot-send-btn:hover { transform: scale(1.06); }
.chatbot-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ================================================
   Mobile (< 576px) — panel above bottom nav
   ================================================ */
@media (max-width: 575.98px) {
    .chatbot-panel {
        bottom: 64px;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100dvh - 64px);
        max-height: calc(100dvh - 64px);
        border-radius: 16px 16px 0 0;
    }
    .chatbot-toggle-btn {
        bottom: 132px;
        right: 12px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}

/* ================================================
   Dark mode
   ================================================ */
@media (prefers-color-scheme: dark) {
    .chatbot-panel { background: #1a1a1a; }
    .chatbot-messages { background: #111; }
    .chatbot-msg.assistant .chatbot-msg-bubble {
        background: #222; color: #e0e0e0; border-color: #333;
    }
    .chatbot-hotel-card { background: #222; border-color: #333; color: #e0e0e0; }
    .chatbot-hotel-card:hover { color: #e0e0e0; }
    .chatbot-hotel-card-meta { color: #888; }
    .chatbot-bottom { background: #1a1a1a; border-color: #333; }
    .chatbot-input { background: #222; border-color: #444; color: #e0e0e0; }
    .chatbot-input:focus { background: #2a2a2a; }
    .chatbot-suggestion-btn { background: #222; border-color: #444; color: #bbb; }
    .chatbot-suggestion-btn:hover { background: #2a2a2a; }
    .chatbot-disclaimer { color: #555; }
    .chatbot-typing-dots { background: #222; border-color: #333; }
}
