/* =========================================================================
   S20: Chatbot — Sidebar Panel + Product Inline Chat
   ========================================================================= */

/* ---------- Overlay ---------- */
.oh-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99996;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.oh-chat-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Sidebar Panel ---------- */
.oh-chat-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100%;
    z-index: 99997;
    background: var(--bg-primary, #fff);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
}

.oh-chat-sidebar.is-open {
    transform: translateX(0);
}

/* ---------- Sidebar Header ---------- */
.oh-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--gold-500, #D4A843);
    flex-shrink: 0;
    background: var(--bg-primary, #fff);
}

.oh-chat-header__info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.oh-chat-header__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold-gradient, linear-gradient(135deg, #E8C547, #D4A843));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.oh-chat-header__title {
    font-family: var(--font-heading, 'DM Serif Display', serif);
    font-size: 1rem;
    font-weight: 400;
    margin: 0;
    color: var(--text-primary, #1A1A1A);
    letter-spacing: -0.01em;
}

.oh-chat-header__status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
}

.oh-chat-header__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-success, #43A047);
    display: inline-block;
}

.oh-chat-header__close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary, #4A4A4A);
    font-size: 1.5rem;
    line-height: 1;
    transition: background 0.2s ease, color 0.2s ease;
}

.oh-chat-header__close:hover {
    background: var(--bg-secondary, #FAF8F5);
    color: var(--text-primary, #1A1A1A);
}

/* ---------- Messages Area ---------- */
.oh-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Individual message */
.oh-chat-msg {
    max-width: 88%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.55;
    animation: ohChatFadeIn 0.3s ease;
}

.oh-chat-msg p {
    margin: 0 0 0.5rem 0;
}

.oh-chat-msg p:last-child {
    margin-bottom: 0;
}

.oh-chat-msg a {
    color: var(--gold-600, #B8922F);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.oh-chat-msg a:hover {
    color: var(--gold-500, #D4A843);
}

/* Bot message */
.oh-chat-msg--bot {
    align-self: flex-start;
    background: var(--bg-secondary, #FAF8F5);
    color: var(--text-primary, #1A1A1A);
    border-bottom-left-radius: 4px;
}

/* User message */
.oh-chat-msg--user {
    align-self: flex-end;
    background: var(--gold-500, #D4A843);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Bold in messages */
.oh-chat-msg strong {
    font-weight: 600;
}

/* Typing indicator */
.oh-chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary, #FAF8F5);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    animation: ohChatFadeIn 0.3s ease;
}

.oh-chat-typing__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted, #888);
    animation: ohChatPulse 1.4s ease-in-out infinite;
}

.oh-chat-typing__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.oh-chat-typing__dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* ---------- Quick Actions ---------- */
.oh-chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.oh-chat-quick-btn {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border-subtle, rgba(212, 168, 67, 0.15));
    border-radius: 20px;
    background: var(--bg-primary, #fff);
    color: var(--gold-600, #B8922F);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.oh-chat-quick-btn:hover {
    background: var(--gold-500, #D4A843);
    color: #fff;
    border-color: var(--gold-500, #D4A843);
}

/* ---------- Input Area ---------- */
.oh-chat-input-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-default, rgba(0, 0, 0, 0.08));
    flex-shrink: 0;
    background: var(--bg-primary, #fff);
}

.oh-chat-input {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-default, rgba(0, 0, 0, 0.08));
    border-radius: 24px;
    font-size: 0.9rem;
    font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
    color: var(--text-primary, #1A1A1A);
    background: var(--bg-secondary, #FAF8F5);
    outline: none;
    transition: border-color 0.2s ease;
}

.oh-chat-input:focus {
    border-color: var(--gold-500, #D4A843);
}

.oh-chat-input::placeholder {
    color: var(--text-muted, #888);
}

.oh-chat-send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--gold-500, #D4A843);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease;
}

.oh-chat-send-btn:hover {
    background: var(--gold-600, #B8922F);
}

.oh-chat-send-btn:active {
    transform: scale(0.93);
}

/* ---------- Footer ---------- */
.oh-chat-footer {
    padding: 0.5rem 1.25rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted, #888);
    border-top: 1px solid var(--border-default, rgba(0, 0, 0, 0.08));
    flex-shrink: 0;
}

/* ---------- Top bar AI badge (gold pill CTA) ---------- */
.top-bar__link--ai {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #D4A843;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 14px;
    border-radius: 20px;
    text-decoration: none !important;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    animation: ohBadgeGlow 2s ease-in-out infinite;
}

.top-bar__link--ai svg {
    stroke: #fff;
    flex-shrink: 0;
}

.top-bar__link--ai:hover {
    background: #E8C547;
    color: #fff !important;
    box-shadow: 0 0 14px 4px rgba(212, 168, 67, 0.4);
}

.top-bar__link--ai:hover svg {
    stroke: #fff;
}

@keyframes ohBadgeGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 67, 0.5); }
    50% { box-shadow: 0 0 12px 4px rgba(212, 168, 67, 0.3); }
}

/* ---------- Trigger links (top bar, CTA box) ---------- */
.oh-chat-trigger {
    cursor: pointer;
}

/* =========================================================================
   S20: Chatbot — Product Inline Chat (Accordion)
   ========================================================================= */

.oh-pchat {
    max-width: 440px;
    margin: 12px 0 0 0;
    border: 1px solid var(--border-default, rgba(0, 0, 0, 0.08));
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary, #fff);
    display: block !important;
}

.oh-pchat__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    cursor: pointer;
    user-select: none;
    background: var(--bg-secondary, #FAF8F5);
    transition: background 0.2s ease;
}

.oh-pchat__header:hover {
    background: var(--glass-bg-hover, rgba(0, 0, 0, 0.04));
}

.oh-pchat__icon {
    color: var(--gold-500, #D4A843);
    display: flex;
    align-items: center;
}

.oh-pchat__title {
    font-family: var(--font-heading, 'DM Serif Display', serif);
    font-size: 0.95rem;
    font-weight: 400;
    margin: 0;
    color: var(--text-primary, #1A1A1A);
    flex: 1;
}

.oh-pchat__badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--gold-gradient, linear-gradient(135deg, #E8C547, #D4A843));
    color: #fff;
}

.oh-pchat__arrow {
    font-size: 0.7rem;
    color: var(--text-muted, #888);
    transition: transform 0.3s ease;
}

.oh-pchat__arrow.is-open {
    transform: rotate(180deg);
}

.oh-pchat__body {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-default, rgba(0, 0, 0, 0.08));
}

.oh-pchat__context {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary, #FAF8F5);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #4A4A4A);
}

.oh-pchat__context small {
    font-size: inherit;
}

.oh-pchat__messages {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    scroll-behavior: smooth;
}

.oh-pchat__input-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =========================================================================
   Animations
   ========================================================================= */

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

@keyframes ohChatPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 768px) {
    .oh-chat-sidebar {
        width: 100%;
    }

    .oh-pchat {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .oh-chat-messages {
        padding: 1rem;
    }

    .oh-chat-input-area {
        padding: 0.75rem 1rem;
    }

    .oh-pchat__messages {
        max-height: 280px;
    }
}
