/**
 * SGPE AI CONCIERGE WIDGET STYLES (MASTER EXECUTION 1B)
 * Strictly SGPE Brand: Navy (#0B1F33), Blue (#0365A4), Accent Red (#D7150B)
 * ZERO TOLERANCE: Strictly NO Forbidden Yellow / QVDS Color Palette
 * Perfect mobile responsiveness - Never blocks navigation or sticky CTA bar
 */


/* 1. NÚT KÍCH HOẠT CHATBOT (FLOATING BUTTON) */
.sgpe-concierge-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9980;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0365A4 0%, #0B1F33 100%);
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 24px rgba(3, 101, 164, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.sgpe-concierge-fab:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 12px 30px rgba(3, 101, 164, 0.45);
}

.sgpe-concierge-fab svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.sgpe-concierge-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #D7150B;
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid #FFFFFF;
    letter-spacing: 0.5px;
}

/* 2. CỬA SỔ HỘI THOẠI (CHAT WINDOW) */
.sgpe-concierge-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    z-index: 9990;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 120px);
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(11, 31, 51, 0.22);
    border: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sgpe-concierge-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 3. HEADER CỬA SỔ CHAT */
.sgpe-concierge-header {
    background: #0B1F33;
    color: #FFFFFF;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #0365A4;
}

.sgpe-concierge-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sgpe-concierge-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #0365A4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 800;
    font-size: 0.95rem;
}

.sgpe-concierge-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 0.3px;
}

.sgpe-concierge-info span {
    font-size: 0.75rem;
    color: #94A3B8;
    display: block;
    margin-top: 1px;
}

.sgpe-concierge-close-btn {
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s ease;
}

.sgpe-concierge-close-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

/* 4. THANH THÔNG BÁO TRỢ LÝ AI (NOTICE) */
.sgpe-concierge-notice {
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    padding: 6px 12px;
    font-size: 0.74rem;
    color: #475569;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sgpe-concierge-notice strong {
    color: #0365A4;
}

/* 5. KHUNG DANH SÁCH TIN NHẮN (MESSAGES BODY) */
.sgpe-concierge-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.sgpe-message {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    animation: fadeInMsg 0.2s ease;
}

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

.sgpe-message.bot {
    align-self: flex-start;
}

.sgpe-message.user {
    align-self: flex-end;
}

.sgpe-message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.48;
    word-break: break-word;
}

.sgpe-message.bot .sgpe-message-bubble {
    background: #FFFFFF;
    color: #0B1F33;
    border: 1px solid #E2E8F0;
    border-top-left-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sgpe-message.user .sgpe-message-bubble {
    background: #0365A4;
    color: #FFFFFF;
    border-top-right-radius: 3px;
}

.sgpe-message-time {
    font-size: 0.68rem;
    color: #94A3B8;
    margin-top: 3px;
}

.sgpe-message.user .sgpe-message-time {
    align-self: flex-end;
}

/* Nguồn trích dẫn (Sources badge) */
.sgpe-sources-tag {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #E2E8F0;
    font-size: 0.74rem;
    color: #64748B;
}

/* 6. CÂU HỎI GỢI Ý NHANH (PROMPT CHIPS) */
.sgpe-concierge-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.sgpe-chip-btn {
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #0365A4;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    line-height: 1.35;
}

.sgpe-chip-btn:hover {
    background: #EFF6FF;
    border-color: #0365A4;
    transform: translateX(2px);
}

/* 7. THANH HÀNH ĐỘNG NHANH (QUICK ACTIONS) */
.sgpe-concierge-actions {
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.sgpe-action-pill {
    white-space: nowrap;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    background: #F8FAFC;
    color: #0B1F33;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease;
}

.sgpe-action-pill:hover {
    background: #E2E8F0;
}

.sgpe-action-pill.primary {
    background: #0365A4;
    color: #FFFFFF;
    border-color: #0365A4;
}

.sgpe-action-pill.primary:hover {
    background: #025287;
}

/* 8. KHUNG NHẬP TIN NHẮN (INPUT BAR) */
.sgpe-concierge-input-bar {
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.sgpe-concierge-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.sgpe-concierge-input:focus {
    border-color: #0365A4;
    box-shadow: 0 0 0 2px rgba(3, 101, 164, 0.15);
}

.sgpe-concierge-send-btn {
    background: #0365A4;
    color: #FFFFFF;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.sgpe-concierge-send-btn:hover {
    background: #025287;
}

.sgpe-concierge-send-btn:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
}

/* 9. MODAL TIẾP NHẬN NHU CẦU (LEAD FORM OVERLAY) */
.sgpe-lead-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 31, 51, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 14px;
}

.sgpe-lead-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sgpe-lead-modal {
    background: #FFFFFF;
    width: 100%;
    max-height: 94%;
    border-radius: 12px;
    padding: 18px;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.sgpe-lead-modal h4 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    color: #0B1F33;
    font-weight: 800;
}

.sgpe-lead-modal p {
    font-size: 0.8rem;
    color: #64748B;
    margin: 0 0 14px 0;
}

.sgpe-lead-input-group {
    margin-bottom: 10px;
}

.sgpe-lead-input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 4px;
}

.sgpe-lead-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    box-sizing: border-box;
}

.sgpe-lead-consent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
    font-size: 0.76rem;
    color: #475569;
    line-height: 1.4;
}

.sgpe-lead-consent input {
    margin-top: 2px;
    accent-color: #0365A4;
}

/* 10. TYPING INDICATOR */
.sgpe-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    width: fit-content;
    border-top-left-radius: 3px;
}

.sgpe-dot {
    width: 6px;
    height: 6px;
    background: #0365A4;
    border-radius: 50%;
    animation: waveDot 1.2s infinite ease-in-out;
}

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

@keyframes waveDot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* 11. RESPONSIVE HOÀN HẢO CHO ĐIỆN THOẠI (MOBILE SPEC) */
@media (max-width: 768px) {
    /* Đặt nút chatbot nằm TRÊN thanh mobile sticky bottom bar (nâng cao >= 75px tránh đè thanh ghim) */
    .sgpe-concierge-fab {
        bottom: 80px;
        bottom: max(80px, calc(76px + env(safe-area-inset-bottom, 0px)));
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .sgpe-concierge-fab svg {
        width: 24px;
        height: 24px;
    }

    .sgpe-concierge-window {
        bottom: 80px;
        bottom: max(80px, calc(76px + env(safe-area-inset-bottom, 0px)));
        right: 10px;
        left: 10px;
        width: auto;
        height: calc(100vh - 160px);
        max-height: 560px;
    }
}
