/* Container Variables */
:root {
    --bcc-primary: #2563eb;
    --bcc-secondary: #f3f4f6;
    --bcc-bot-bg: #e0f2fe;
    --bcc-user-bg: #2563eb;
    --bcc-text-user: #ffffff;
    --bcc-text-bot: #1f2937;
    --bcc-font: 'Tahoma', 'Segoe UI', sans-serif;
}

/* Base Styles */
.bcc-embed-container, .bcc-float-container {
    font-family: var(--bcc-font);
    direction: rtl;
    box-sizing: border-box;
}

.bcc-float-container {
    position: fixed;
    bottom: 20px;
    left: 20px; /* Left for Persian layout usually puts chat on left or right depending on pref, defaulting left to not block content */
    z-index: 9999;
}

/* Trigger Button */
.bcc-float-trigger {
    width: 60px;
    height: 60px;
    background: var(--bcc-primary);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.bcc-float-trigger:hover {
    transform: scale(1.05);
}
.bcc-float-trigger .dashicons {
    color: white;
    font-size: 32px;
    width: 32px;
    height: 32px;
}

/* Chat Box */
.bcc-chat-box {
    width: 380px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 550px;
    border: 1px solid #e5e7eb;
}
.bcc-hidden {
    display: none;
}
.bcc-float-container .bcc-chat-box {
    position: absolute;
    bottom: 80px;
    left: 0;
}

/* Header */
.bcc-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bcc-title {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.bcc-limits {
    font-size: 0.8em;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
}
.bcc-close-btn {
    cursor: pointer;
    font-size: 20px;
}

/* Messages Area */
.bcc-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bcc-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}
.bcc-message.bot {
    align-self: flex-start;
}
.bcc-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bcc-avatar {
    width: 30px;
    height: 30px;
    background: #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.bcc-message.bot .bcc-avatar { background: #e0f2fe; }
.bcc-message.user .bcc-avatar { background: #2563eb; color: white; }

.bcc-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.bcc-message.bot .bcc-content {
    background: white;
    color: var(--bcc-text-bot);
    border-bottom-right-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.bcc-message.user .bcc-content {
    background: var(--bcc-user-bg);
    color: var(--bcc-text-user);
    border-bottom-left-radius: 2px;
}

/* Markdown Styles inside bot messages */
.bcc-content strong { color: #1e3a8a; }
.bcc-content table { border-collapse: collapse; width: 100%; margin: 5px 0; font-size: 0.9em; }
.bcc-content th, .bcc-content td { border: 1px solid #d1d5db; padding: 4px; }
.bcc-content th { background: #f3f4f6; }

/* Chips */
.bcc-chips {
    padding: 10px;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    background: white;
    border-top: 1px solid #f3f4f6;
    white-space: nowrap;
    scrollbar-width: none;
}
.bcc-chip {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.bcc-chip:hover {
    background: #e0f2fe;
    transform: translateY(-1px);
}

/* Input Area */
.bcc-input-area {
    padding: 10px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    align-items: center;
}
#bcc-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
}
#bcc-input:focus {
    border-color: var(--bcc-primary);
}
#bcc-send-btn {
    width: 40px;
    height: 40px;
    background: var(--bcc-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bcc-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.bcc-disclaimer {
    font-size: 10px;
    color: #9ca3af;
    text-align: center;
    padding: 5px;
    background: #f9fafb;
}

/* Skeleton Loading */
.bcc-loading .bcc-content {
    min-width: 100px;
}
.bcc-skeleton {
    height: 10px;
    background: #e5e7eb;
    border-radius: 4px;
    margin: 4px 0;
    animation: bcc-pulse 1.5s infinite;
}
@keyframes bcc-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}