/**
 * Chatbot Sidebar Styles
 * Handles sidebar panel, messages, and chat interface
 *
 * @author Vine AI Team
 * @date January 2026
 */

/* ============================================================================
   SIDEBAR STRUCTURE
   ============================================================================ */

.vine-chatbot-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    cursor: default;
}

.vine-chatbot-sidebar.show {
    transform: translateX(0);
}

/* ============================================================================
   BACKDROP OVERLAY
   ============================================================================ */

.chatbot-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    cursor: pointer;
}

.chatbot-backdrop.show {
    opacity: 1;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
}

.chatbot-header-title {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.chatbot-header-icon {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
    filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(90%);
}

.chatbot-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    color: #333;
}

.chatbot-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chatbot-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* ============================================================================
   MESSAGES CONTAINER
   ============================================================================ */

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
}

/* ============================================================================
   LOADING INDICATOR
   ============================================================================ */

.history-loading {
    padding: 12px 0 4px 0;
}

.history-loading .skeleton-row {
    margin-bottom: 12px;
    animation: none;
}

.history-loading .skeleton-bubble {
    animation: skeletonPulse 1.4s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================================
   DATE SEPARATOR
   ============================================================================ */

.chat-date-separator {
    text-align: center;
    margin: 20px 0 16px 0;
}

.chat-date-separator span {
    display: inline-block;
    padding: 4px 12px;
    background: #f1f1f1;
    color: #666;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

/* ============================================================================
   CHAT MESSAGE
   ============================================================================ */

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.chat-message.user {
    align-items: flex-end;
}

.chat-message.assistant {
    align-items: flex-start;
}

/* ============================================================================
   MESSAGE BUBBLE
   ============================================================================ */

.bubble {
    padding: 14px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 16px;
    max-width: 80%;
    user-select: text;
    cursor: default;
}

.chat-message.user .bubble {
    background: #35744B;
    color: white;
    border-bottom-right-radius: 6px;
}

/* Wrapper keeps bubble + footer the same width for assistant messages */
.bubble-wrap {
    max-width: 80%;
    min-width: 0;
}

.bubble-wrap .bubble {
    max-width: 100%; /* bubble fills the wrap, wrap controls the constraint */
}

.chat-message.assistant .bubble {
    background: #F5F5F5;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 6px;
    overflow-wrap: break-word;
    min-width: 0; /* allows flex child to shrink below content size */
}

/* ============================================================================
   TIMESTAMP
   ============================================================================ */

.timestamp {
    font-size: 13px;
    color: #999;
    padding: 0 8px;
}

/* ============================================================================
   MARKDOWN CONTENT STYLING
   ============================================================================ */

/* Headings in assistant messages */
.chat-message.assistant .bubble h1,
.chat-message.assistant .bubble h2,
.chat-message.assistant .bubble h3 {
    margin-top: 12px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
}

.chat-message.assistant .bubble h1:first-child,
.chat-message.assistant .bubble h2:first-child,
.chat-message.assistant .bubble h3:first-child {
    margin-top: 0;
}

.chat-message.assistant .bubble h1 {
    font-size: 20px;
}

.chat-message.assistant .bubble h2 {
    font-size: 18px;
}

.chat-message.assistant .bubble h3 {
    font-size: 16px;
}

/* Lists */
.chat-message.assistant .bubble ul,
.chat-message.assistant .bubble ol {
    margin: 8px 0;
    padding-left: 24px;
}

.chat-message.assistant .bubble li {
    margin: 4px 0;
}

/* Bold and italic */
.chat-message.assistant .bubble strong {
    font-weight: 600;
}

.chat-message.assistant .bubble em {
    font-style: italic;
}

/* Inline code */
.chat-message.assistant .bubble code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #d73a49;
}

/* Code blocks */
.chat-message.assistant .bubble pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.chat-message.assistant .bubble pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 13px;
}

/* Paragraphs */
.chat-message.assistant .bubble p {
    margin: 8px 0;
}

.chat-message.assistant .bubble p:first-child {
    margin-top: 0;
}

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

/* Links */
.chat-message.assistant .bubble a {
    color: #35744B;
    text-decoration: underline;
}

.chat-message.assistant .bubble a:hover {
    color: #2d5f3d;
}

/* Blockquotes */
.chat-message.assistant .bubble blockquote {
    border-left: 3px solid #35744B;
    padding-left: 12px;
    margin: 8px 0;
    color: #666;
    font-style: italic;
}

/* Horizontal rules */
.chat-message.assistant .bubble hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 12px 0;
}

/* Tables — scroll horizontally within bubble, never break layout */
.chat-message.assistant .bubble table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 14px;
    -webkit-overflow-scrolling: touch;
}

.chat-message.assistant .bubble th,
.chat-message.assistant .bubble td {
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    text-align: left;
    white-space: nowrap;
}

.chat-message.assistant .bubble th {
    background: #e8e8e8;
    font-weight: 600;
    color: #333;
}

.chat-message.assistant .bubble tr:nth-child(even) td {
    background: #fafafa;
}

/* ============================================================================
   CITATIONS & SOURCES
   ============================================================================ */

/* Inline citation links [1], [2] */
.chat-message.assistant .bubble .citation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    margin: 0 2px;
    background: #e8f0eb;
    color: #35744B;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
    transition: all 0.2s;
}

.chat-message.assistant .bubble .citation:hover {
    background: #35744B;
    color: white;
}

/* Sources section */
.chat-message.assistant .bubble .sources-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.chat-message.assistant .bubble .sources-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.chat-message.assistant .bubble .sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-message.assistant .bubble .sources-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #555;
}

.chat-message.assistant .bubble .sources-list .source-number {
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f0eb;
    color: #35744B;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.chat-message.assistant .bubble .sources-list .source-link {
    color: #35744B;
    text-decoration: none;
    word-break: break-word;
}

.chat-message.assistant .bubble .sources-list .source-link:hover {
    text-decoration: underline;
}

.chat-message.assistant .bubble .sources-list .source-page {
    color: #888;
    font-size: 12px;
}

/* ============================================================================
   FOLLOW-UP SUGGESTIONS
   ============================================================================ */

.follow-up-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
}

.suggestion-chip {
    background: #f0f7f2;
    border: 1px solid #35744B;
    color: #35744B;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    line-height: 1.4;
}

.suggestion-chip:hover {
    background: #35744B;
    color: white;
}

.suggestion-chip:focus {
    outline: 2px solid #35744B;
    outline-offset: 2px;
}

/* ============================================================================
   TYPING INDICATOR
   ============================================================================ */

.chatbot-typing {
    padding: 0 20px 16px 20px;
    background: #ffffff;
}

.typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.typing-status {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   STREAMING TOKEN RENDERING
   ============================================================================ */

.streaming-bubble {
    min-height: 24px;
    line-height: 1.6;
}

.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #666;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink-cursor 0.8s step-end infinite;
}

@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============================================================================
   INPUT AREA
   ============================================================================ */

.chatbot-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
    flex-shrink: 0;
    position: relative;
}

.chatbot-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    width: 100%;
    padding: 10px 50px 10px 14px;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border: 2px solid #35744B;
}

.chatbot-input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.chatbot-send-icon-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: #35744B;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.chatbot-send-icon-btn:hover:not(:disabled) {
    background: #2d5f3d;
}

.chatbot-send-icon-btn:active:not(:disabled) {
    background: #264f33;
}

.chatbot-send-icon-btn:disabled {
    background: #c8c8c8;
    color: #888;
    cursor: not-allowed;
}

.chatbot-send-icon-btn svg {
    width: 14px;
    height: 14px;
}

.chatbot-send-icon-btn svg path {
    stroke: white !important;
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

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

/* ============================================================================
   BUBBLE EXPAND ACTION
   ============================================================================ */

.bubble-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.bubble-actions {
    display: flex;
    gap: 4px;
}

.bubble-expand-btn {
    background: none;
    border: 1px solid #35744B;
    color: #35744B;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.bubble-expand-btn:hover {
    background: #35744B;
    border-color: #35744B;
    color: white;
}

.bubble-expand-btn:focus {
    outline: none;
}

.bubble-expand-btn svg {
    width: 11px;
    height: 11px;
}

/* ============================================================================
   BUBBLE MODAL (full-screen expand)
   ============================================================================ */

.bubble-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.bubble-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.bubble-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.bubble-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.bubble-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Copy + close share the same base button style — cohesive pair */
.bubble-modal-copy-btn,
.bubble-modal-close-btn {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.bubble-modal-copy-btn:hover,
.bubble-modal-close-btn:hover {
    background: #ebebeb;
    border-color: #d0d0d0;
    color: #333;
}

/* Copy-specific: icon swap on success */
.bubble-modal-copy-btn .check-icon { display: none; }

.bubble-modal-copy-btn.copied {
    background: #edf7f1;
    border-color: #b2d9c0;
    color: #35744B;
}

.bubble-modal-copy-btn.copied .copy-icon { display: none; }
.bubble-modal-copy-btn.copied .check-icon { display: block; }

/* Close button uses a slightly larger × rendered via font */
.bubble-modal-close-btn {
    font-size: 18px;
    line-height: 1;
}

.bubble-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    cursor: default;
}

.bubble-modal-body h1,
.bubble-modal-body h2,
.bubble-modal-body h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.bubble-modal-body h1:first-child,
.bubble-modal-body h2:first-child,
.bubble-modal-body h3:first-child { margin-top: 0; }

.bubble-modal-body h1 { font-size: 20px; }
.bubble-modal-body h2 { font-size: 18px; }
.bubble-modal-body h3 { font-size: 16px; }

.bubble-modal-body p { margin: 8px 0; }
.bubble-modal-body p:first-child { margin-top: 0; }
.bubble-modal-body p:last-child { margin-bottom: 0; }

.bubble-modal-body ul,
.bubble-modal-body ol { margin: 8px 0; padding-left: 24px; }
.bubble-modal-body li { margin: 4px 0; }

.bubble-modal-body strong { font-weight: 600; }
.bubble-modal-body em { font-style: italic; }

.bubble-modal-body a { color: #35744B; text-decoration: underline; }
.bubble-modal-body a:hover { color: #2d5f3d; }

.bubble-modal-body code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #d73a49;
}

.bubble-modal-body pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.bubble-modal-body pre code { background: none; padding: 0; color: #333; font-size: 13px; }

.bubble-modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 14px;
}

.bubble-modal-body th,
.bubble-modal-body td {
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    text-align: left;
}

.bubble-modal-body th { background: #e8e8e8; font-weight: 600; color: #333; }
.bubble-modal-body tr:nth-child(even) td { background: #fafafa; }

.bubble-modal-body blockquote {
    border-left: 3px solid #35744B;
    padding-left: 12px;
    margin: 8px 0;
    color: #666;
    font-style: italic;
}

.bubble-modal-body hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 12px 0;
}

/* ============================================================================
   MESSAGES WRAP (positions scroll-to-bottom button)
   ============================================================================ */

.chatbot-messages-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chatbot-messages-wrap .chatbot-messages {
    flex: 1;
    height: 0; /* flex trick: gives children a resolvable 100% height reference */
}

/* ============================================================================
   SCROLL TO BOTTOM BUTTON
   ============================================================================ */

.chatbot-scroll-btn {
    position: absolute;
    bottom: 12px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #35744B;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
}

.chatbot-scroll-btn:hover {
    background: #2d5f3d;
    transform: translateY(-1px);
}

.chatbot-scroll-btn svg path {
    stroke: white;
}

/* ============================================================================
   MESSAGE ENTRY ANIMATIONS
   ============================================================================ */

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

@keyframes historyFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.chat-message-new {
    animation: messageEnter 0.2s ease-out both;
}

.chat-message-history {
    animation: historyFadeIn 0.25s ease both;
}

/* ============================================================================
   DISABLED / UPGRADE CARD (rendered inside assistant bubble via message key)
   ============================================================================ */

.chatbot-disabled-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-disabled-badge {
    display: inline-block;
    background: #e8f0eb;
    color: #35744B;
    border: 1px solid #b2d9c0;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    width: fit-content;
}

.chatbot-disabled-title {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #222 !important;
    line-height: 1.3 !important;
}

.chatbot-disabled-desc {
    margin: 0 !important;
    font-size: 14px !important;
    color: #555 !important;
    line-height: 1.55 !important;
}

.chatbot-disabled-contacts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #d8d8d8;
}

.chatbot-disabled-contact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #444;
}

.chatbot-disabled-icon {
    flex-shrink: 0;
    color: #666;
}

/* ============================================================================
   INITIAL LOAD SPINNER
   ============================================================================ */

.chat-initial-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.chat-initial-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e8e8e8;
    border-top-color: #5a9e6f;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* ============================================================================
   INITIAL LOAD SKELETON (legacy classes retained for history-loading)
   ============================================================================ */

@keyframes skeletonPulse {
    0%, 100% { background-color: #eeeeee; }
    50%       { background-color: #e0e0e0; }
}

@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.initial-skeleton {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    height: 100%;
    padding: 16px 20px;
    box-sizing: border-box;
}

.skeleton-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

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

.skeleton-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-content {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-width: 72%;
}

.skeleton-msg.user .skeleton-content {
    align-items: flex-end;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-line.short  { width: 38%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.long   { width: 82%; }

/* Legacy — used by history-loading spinner context */
.skeleton-row { display: flex; flex-direction: column; }
.skeleton-bubble {
    height: 14px;
    border-radius: 8px;
    animation: skeletonPulse 1.4s ease-in-out infinite;
}

.skeleton-bubble.short  { width: 38%; }
.skeleton-bubble.medium { width: 58%; }
.skeleton-bubble.long   { width: 75%; }

/* ============================================================================
   SLASH COMMAND UI
   ============================================================================ */

/* [/] trigger button — left side of input wrapper */
.chatbot-slash-btn {
    position: absolute;
    left: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    transition: border-color 0.15s, color 0.15s;
    z-index: 2;
    flex-shrink: 0;
    padding: 0;
}
.chatbot-slash-btn:hover,
.chatbot-slash-btn:focus {
    border-color: #35744B;
    color: #35744B;
    outline: none;
}

/* Active command badge — reuses suggestion-chip palette exactly */
.chatbot-command-badge {
    position: absolute;
    left: 42px;
    top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #f0f7f2;
    border: 1px solid #35744B;
    color: #35744B;
    border-radius: 6px;
    padding: 2px 6px 2px 8px;
    font-size: 12px;
    font-family: monospace;
    white-space: nowrap;
    z-index: 2;
    pointer-events: auto;
}
.chatbot-command-badge-text {
    font-weight: 600;
}
.chatbot-command-badge-clear {
    background: none;
    border: none;
    color: #35744B;
    cursor: pointer;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    opacity: 0.55;
    display: flex;
    align-items: center;
}
.chatbot-command-badge-clear:hover,
.chatbot-command-badge-clear:focus {
    opacity: 1;
    outline: none;
}

/* Command menu — floats above input, spans full input width like Cursor / Claude Code */
@keyframes commandMenuIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chatbot-command-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e2e2e2;
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.13), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 200;
    padding: 6px;
    animation: commandMenuIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.chatbot-command-menu-header {
    padding: 5px 10px 7px;
    font-size: 10px;
    font-weight: 600;
    color: #bbb;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid #f2f2f2;
    margin-bottom: 4px;
}
.chatbot-command-menu-item {
    display: flex;
    align-items: center;
    padding: 10px 10px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.14s ease;
    gap: 12px;
}
.chatbot-command-menu-item:hover,
.chatbot-command-menu-item:focus {
    background: #f4faf6;
    outline: none;
}
.chatbot-command-menu-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f0f7f2;
    border: 1px solid #c8e0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #35744B;
    transition: background 0.14s ease, border-color 0.14s ease;
}
.chatbot-command-menu-item:hover .chatbot-command-menu-item-icon {
    background: #e4f2ea;
    border-color: #35744B;
}
.chatbot-command-menu-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chatbot-command-menu-item-name {
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}
.chatbot-command-menu-item-desc {
    font-size: 12px;
    color: #999;
    line-height: 1.35;
}

/* Shift textarea left padding to make room for [/] button */
#chatbot-input {
    padding-left: 44px;
}
/* When a command badge is active — badge sits at top-left, text flows below at full width */
#chatbot-input.has-command {
    padding-top: 36px;
    padding-left: 44px;
}
