/* BPS Theme AI Chat CSS (Coffee & Warm Tones Palette) */
:root {
    --bps-primary: #a57c52;
    --bps-secondary: #8d663e;
    --bps-accent: #5c4033;
    --bps-bg: #faf7f2;
    --bps-surface: #FFFFFF;
    --bps-text-main: #222222;
    --bps-text-muted: #776655;
    --bps-border: #e6dfd5;
    --bps-user-msg-bg: linear-gradient(135deg, #a57c52, #5c4033);
    --bps-bot-msg-bg: #f5efe8;
    --bps-shadow: 0 10px 25px -5px rgba(92, 64, 51, 0.15), 0 8px 10px -6px rgba(92, 64, 51, 0.1);
}

/* Widget Toggle Button */
#bps-ai-widget-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bps-user-msg-bg);
    color: white;
    border: none;
    box-shadow: var(--bps-shadow);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#bps-ai-widget-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(92, 64, 51, 0.25);
}

/* Widget Container */
#bps-ai-widget-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 360px;
    height: 500px;
    background: var(--bps-surface);
    border-radius: 20px;
    box-shadow: var(--bps-shadow);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid var(--bps-border);
    font-family: inherit;
}

#bps-ai-widget-container.bps-ai-closed {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

#bps-ai-widget-header {
    background: var(--bps-surface);
    padding: 16px 20px;
    border-bottom: 1px solid var(--bps-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bps-ai-bot-name {
    font-weight: 600;
    color: var(--bps-accent);
    font-size: 16px;
}

#bps-ai-widget-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--bps-text-muted);
    cursor: pointer;
    line-height: 1;
}

#bps-ai-widget-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bps-bg);
}

#bps-ai-widget-footer {
    padding: 12px 16px;
    background: var(--bps-surface);
    border-top: 1px solid var(--bps-border);
}

#bps-ai-widget-form {
    display: flex;
    gap: 8px;
}

#bps-ai-widget-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid var(--bps-border);
    font-size: 14px;
    outline: none;
}

#bps-ai-widget-input:focus {
    border-color: var(--bps-primary);
}

#bps-ai-widget-submit {
    background: var(--bps-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Messages */
.bps-ai-message {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.bps-ai-message.bot {
    align-self: flex-start;
    background: var(--bps-bot-msg-bg);
    color: var(--bps-text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--bps-border);
}

.bps-ai-message.user {
    align-self: flex-end;
    background: var(--bps-user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Full Page Chat Container */
#bps-ai-page-container {
    width: 100%;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    background: transparent;
    transition: all 0.3s ease;
}

#bps-ai-page-container.bps-ai-state-hero {
    justify-content: center;
}

#bps-ai-page-container.bps-ai-state-hero .bps-ai-page-header,
#bps-ai-page-container.bps-ai-state-hero #bps-ai-page-body {
    display: none;
}

#bps-ai-hero-content {
    text-align: center;
    margin-bottom: 30px;
}

.bps-ai-hero-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
}

.bps-ai-hero-subtitle {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--bps-primary);
    margin-bottom: 8px;
}

.bps-ai-hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--bps-accent);
    margin-bottom: 12px;
}

.bps-gradient-text {
    background: linear-gradient(135deg, #a57c52, #5c4033);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bps-ai-hero-desc {
    font-size: 1.1rem;
    color: var(--bps-text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

#bps-ai-page-footer {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#bps-ai-page-form {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 40px;
    padding: 8px 16px;
    border: 1px solid var(--bps-border);
    box-shadow: 0 8px 30px rgba(92, 64, 51, 0.08);
}

#bps-ai-page-input {
    flex: 1;
    border: none;
    padding: 10px 14px;
    font-size: 15px;
    outline: none;
}

#bps-ai-page-submit {
    background: var(--bps-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bps-ai-suggestion-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bps-ai-suggestion-btn {
    background: #f5efe8;
    border: 1px solid var(--bps-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--bps-accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.bps-ai-suggestion-btn:hover {
    background: #e8dccf;
}

.bps-ai-footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--bps-text-muted);
}

.bps-contact-btn {
    background: var(--bps-primary);
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.3s ease;
}

.bps-contact-btn:hover {
    background: var(--bps-secondary);
    color: white;
}

/* Full-Page Chat Header */
.bps-ai-page-header {
    width: 100%;
    max-width: 700px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bps-border);
}

.bps-ai-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bps-ai-header-brand h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--bps-accent);
    font-weight: 600;
}

.bps-ai-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--bps-text-muted);
}

.bps-ai-status-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

/* Full-Page Chat Body */
#bps-ai-page-body {
    width: 100%;
    max-width: 700px;
    height: 480px;
    overflow-y: auto;
    background: #faf7f2;
    border: 1px solid var(--bps-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 8px rgba(92, 64, 51, 0.05);
}

/* Scrollbar customizations */
#bps-ai-page-body::-webkit-scrollbar,
#bps-ai-widget-body::-webkit-scrollbar {
    width: 6px;
}
#bps-ai-page-body::-webkit-scrollbar-track,
#bps-ai-widget-body::-webkit-scrollbar-track {
    background: transparent;
}
#bps-ai-page-body::-webkit-scrollbar-thumb,
#bps-ai-widget-body::-webkit-scrollbar-thumb {
    background: var(--bps-border);
    border-radius: 3px;
}
#bps-ai-page-body::-webkit-scrollbar-thumb:hover,
#bps-ai-widget-body::-webkit-scrollbar-thumb:hover {
    background: var(--bps-primary);
}

/* Chat animations & Markdown styles */
.bps-ai-animate-pop {
    animation: bps-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
}
.bps-ai-animate-pop.user {
    transform-origin: bottom right;
}
.bps-ai-animate-pop.bot {
    transform-origin: bottom left;
}

@keyframes bps-pop {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bps-ai-list {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.bps-ai-list li {
    margin-bottom: 4px;
}

/* Typing / thinking indicator */
.bps-ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px !important;
}

.bps-ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--bps-primary);
    border-radius: 50%;
    display: inline-block;
    animation: bps-bounce 1.4s infinite ease-in-out both;
}

.bps-ai-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.bps-ai-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bps-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.3;
    }
    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* New chat buttons & input modifications */
.bps-ai-new-chat-btn {
    background: transparent;
    border: 1px solid var(--bps-border);
    color: var(--bps-text-muted);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bps-ai-new-chat-btn:hover {
    background: #f5efe8;
    color: var(--bps-accent);
    border-color: var(--bps-primary);
}

.bps-ai-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

.bps-ai-message.user a {
    color: #fff;
}
