/* Bubbles chat styles */

.bubbles-container {
    max-width: 850px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    padding: 12px 16px 0;
}

.bubbles-header {
    padding: 8px 0 12px;
    flex-shrink: 0;
}

.bubbles-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.bubbles-header-row > div:first-child {
    flex: 1;
    text-align: center;
}

.bubbles-header h3 {
    font-weight: 600;
    margin-bottom: 2px;
    color: #363B51;
}

.bubbles-header p {
    color: #8c8c8c;
    font-size: 0.9em;
    margin-bottom: 0;
}

/* Messages area */
.bubbles-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
    background: #fafbfc;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    margin-bottom: 4px;
}

.bubbles-messages::-webkit-scrollbar {
    width: 6px;
}

.bubbles-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Message row */
.bubbles-msg-row {
    display: flex;
    margin-bottom: 16px;
    gap: 10px;
    animation: bubbleFadeIn 0.25s ease-out;
}

.bubbles-msg-row.user {
    flex-direction: row-reverse;
}

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

/* Avatar */
.bubbles-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.bubbles-avatar.assistant {
    background: #363B51;
    color: white;
}

.bubbles-avatar.user {
    background: #0d6efd;
    color: white;
}

/* Message bubble */
.bubbles-bubble {
    max-width: 75%;
    padding: 10px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95em;
    word-wrap: break-word;
}

.bubbles-bubble.user {
    background: #0d6efd;
    color: white;
    border-bottom-right-radius: 4px;
}

.bubbles-bubble.assistant {
    background: #f3f4f6;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.bubbles-bubble.assistant p {
    margin-bottom: 0.5em;
}

.bubbles-bubble.assistant p:last-child {
    margin-bottom: 0;
}

.bubbles-bubble.assistant h1,
.bubbles-bubble.assistant h2,
.bubbles-bubble.assistant h3,
.bubbles-bubble.assistant h4 {
    font-size: 1.05em;
    font-weight: 600;
    margin-top: 0.8em;
    margin-bottom: 0.3em;
    color: #363B51;
}

.bubbles-bubble.assistant ul,
.bubbles-bubble.assistant ol {
    margin-bottom: 0.5em;
    padding-left: 1.5em;
}

.bubbles-bubble.assistant a {
    color: #0d6efd;
}

.bubbles-bubble.user a {
    color: #cce5ff;
}

/* Typing indicator */
.bubbles-typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.bubbles-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.bubbles-typing-dots span:nth-child(1) { animation-delay: 0s; }
.bubbles-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.bubbles-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.bubbles-input-area {
    flex-shrink: 0;
    padding: 12px 0 16px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.bubbles-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 6px 6px 6px 20px;
    transition: border-color 0.2s;
}

.bubbles-input-wrapper:focus-within {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.bubbles-input-wrapper input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 0.95em;
    padding: 6px 0 !important;
}

.bubbles-send-btn {
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.2s;
}

.bubbles-new-chat-btn {
    border-radius: 20px !important;
    font-size: 0.82em;
    padding: 6px 14px !important;
    flex-shrink: 0;
}

.bubbles-char-counter {
    font-size: 0.75em;
    color: #9ca3af;
    text-align: right;
    margin-top: 4px;
    padding-right: 12px;
}

.bubbles-char-counter.near-limit {
    color: #d97706;
}

.bubbles-char-counter.at-limit {
    color: #dc2626;
    font-weight: 600;
}

/* Chart inside chat */
.bubbles-chart {
    max-width: 90%;
    margin-bottom: 16px;
    animation: bubbleFadeIn 0.3s ease-out;
}
