/* ==========================================================================
   AI THỔ ĐỊA PHÚ QUÝ — FLOATING CONCIERGE WIDGET & RICH CARDS (MOBILE-FIRST)
   ========================================================================== */

.ai-concierge-root {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 9100;
    font-family: inherit;
}

/* Nút mở nổi (Floating Pill Launcher) */
.ai-concierge-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(15,23,42,.16);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.ai-concierge-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 119, 182, 0.48);
}

.ai-launcher-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.ai-launcher-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.ai-launcher-title {
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

/* Khung cửa sổ Chat */
.ai-concierge-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 400px;
    max-width: calc(100vw - 24px);
    height: 620px;
    max-height: calc(100dvh - 40px);
    background: #f8fafc;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(14, 116, 144, 0.16);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1060;
}

.ai-concierge-panel.is-open {
    display: flex;
    animation: aiPanelSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aiPanelSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.ai-concierge-header {
    background: #007b96;
    color: #ffffff;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.ai-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.ai-header-info { min-width: 0; }

.ai-header-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ai-header-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-header-subtitle {
    font-size: 0.72rem;
    opacity: 0.9;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ai-header-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ai-header-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Luồng tin nhắn */
.ai-concierge-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 92%;
}

.ai-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.ai-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.ai-msg-bubble {
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 0.87rem;
    line-height: 1.5;
    word-break: break-word;
}

.ai-msg-user .ai-msg-bubble {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.2);
}

.ai-msg-assistant .ai-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.ai-msg-bubble p {
    margin-bottom: 0.45rem;
}

.ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ai-msg-bubble ul {
    margin: 0.35rem 0 0.45rem 1.1rem;
    padding: 0;
}

.ai-msg-bubble li {
    margin-bottom: 0.25rem;
}

/* Gợi ý câu hỏi 1-Click */
.ai-suggested-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.ai-chip-btn {
    border: 1px solid #bae6fd;
    background: #f0f9ff;
    color: #0369a1;
    border-radius: 12px;
    padding: 6px 11px;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-chip-btn:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    transform: translateY(-1px);
}

/* Rich Cards đính kèm dưới câu trả lời */
.ai-intake-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.ai-intake-confirm,
.ai-intake-edit {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #007b96;
    border-radius: 10px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.ai-intake-confirm { background: #007b96; color: #fff; }
.ai-intake-edit { background: #fff; color: #0e7490; }
.ai-intake-confirm:hover { background: #00687f; }
.ai-intake-edit:hover { background: #e0f2fe; }
.ai-intake-confirm:focus-visible,
.ai-intake-edit:focus-visible { outline: 2px solid #0e7490; outline-offset: 3px; }

.ai-rich-cards-wrap {
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

/* Grouped Commercial Facts Card (Mobile-First, Zero Repetition) */
.ai-commercial-groups {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.ai-cg-caption {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0369a1;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 4px 9px;
    align-self: flex-start;
    max-width: 100%;
    box-sizing: border-box;
}

.ai-cg-card {
    width: 100%;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 9px 11px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
}

.ai-cg-head {
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2e8f0;
}

.ai-cg-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.ai-cg-meta {
    margin-top: 2px;
    font-size: 0.73rem;
    color: #475569;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.ai-cg-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-cg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 10px;
    font-size: 0.78rem;
    line-height: 1.4;
}

.ai-cg-row-label {
    color: #334155;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ai-cg-row-value {
    color: #0369a1;
    font-weight: 700;
    white-space: nowrap;
}

/* Card Phiếu Kế Hoạch Chuyến Đi (Chốt 2 giai đoạn) */
.ai-trip-plan-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 100%);
    border: 1.5px solid #10b981;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.14);
}

.ai-trip-plan-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    color: #047857;
    background: #d1fae5;
    padding: 2px 8px;
    border-radius: 99px;
    margin-bottom: 6px;
}

.ai-trip-plan-title {
    font-weight: 800;
    font-size: 0.92rem;
    color: #0f172a;
    margin-bottom: 4px;
}

.ai-trip-plan-meta {
    font-size: 0.78rem;
    color: #334155;
    margin-bottom: 10px;
}

.ai-trip-plan-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-plan-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, #059669, #0d9488);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.82rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.ai-plan-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #0284c7;
    color: #0284c7 !important;
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none;
}

/* Carousel ngang cho Thẻ Phòng Nghỉ */
.ai-acc-carousel {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.ai-acc-mini-card {
    min-width: 215px;
    max-width: 225px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.ai-acc-mini-img {
    height: 104px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.ai-acc-mini-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-acc-per-guest-pill {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(15, 23, 42, 0.82);
    color: #38bdf8;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 99px;
}

.ai-acc-mini-body {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.ai-acc-mini-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: #0f172a;
    line-height: 1.25;
}

.ai-acc-mini-sub {
    font-size: 0.71rem;
    color: #64748b;
}

.ai-acc-mini-price {
    font-size: 0.76rem;
    font-weight: 700;
    color: #0284c7;
    margin-top: auto;
    padding-top: 4px;
}

.ai-acc-pick-btn {
    margin-top: 5px;
    width: 100%;
    border: 1px solid #0284c7;
    background: #f0f9ff;
    color: #0284c7;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.ai-acc-pick-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

/* Quick Plan Mini Drawer */
.ai-quick-plan-drawer {
    background: #eff6ff;
    border-top: 1px solid #bfdbfe;
    padding: 8px 12px;
    flex-shrink: 0;
}

.ai-quick-plan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.73rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 6px;
}

.ai-quick-plan-row {
    display: flex;
    gap: 6px;
}

/* Footer Input */
.ai-concierge-footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 8px 12px 10px;
    flex-shrink: 0;
}

.ai-footer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}

.ai-toolbar-pill {
    border: 1px solid #99f6e4;
    background: #f0fdfa;
    color: #0f766e;
    border-radius: 99px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.ai-toolbar-pill:hover {
    background: #ccfbf1;
    border-color: #5eead4;
}

.ai-toolbar-zalo {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0284c7;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 99px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    transition: all 0.15s ease;
}

.ai-toolbar-zalo:hover {
    background: #e0f2fe;
    color: #0369a1;
}

.zalo-mini-badge {
    background: #0068ff;
    color: #fff;
    font-size: 8px;
    font-weight: 900;
    width: 13px;
    height: 13px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ai-concierge-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.ai-concierge-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.82rem;
    outline: none;
    background: #f8fafc;
    transition: all 0.15s ease;
}

.ai-concierge-input:focus {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

.ai-concierge-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #0284c7;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    font-size: 0.85rem;
}

.ai-concierge-send-btn:hover {
    background: #0369a1;
    transform: scale(1.05);
}

.ai-concierge-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Typing indicator */
.ai-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}

.ai-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0284c7;
    animation: aiDotPulse 1.2s infinite ease-in-out;
}

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

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

@keyframes aiDotPulse {
    0%, 80%, 100% {
        transform: scale(0.65);
        opacity: 0.45;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Mobile-First Adjustments */
@media (max-width: 991.98px) {
    .ai-concierge-launcher {
        padding: 7px 13px 7px 8px;
    }
}

@media (max-width: 480px) {
    .ai-concierge-panel {
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        bottom: 10px;
        max-height: calc(100dvh - 20px);
    }

    .ai-msg {
        max-width: 96%;
    }

    .ai-cg-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1px;
    }
}
