:root {
    /* Color Variables - matching wizard */
    --color-primary: #007bff;
    --color-success: #28a745;
    --color-gray: #6c757d;
    --color-light: #e9ecef;
    --color-border: #dee2e6;
    --color-danger: #dc3545;
    --color-text: #2c3e50;
    --color-white: #fff;
    --shadow-sm: 0 2px 10px rgb(0 0 0 / 10%);
    --transition-default: 0.3s ease;

    /* Spacing Variables */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;

    /* Breakpoints */
    --breakpoint-sm: 480px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background-color: var(--color-light);
    color: var(--color-text);
}

/* Layout Container */
.chat-layout {
    display: grid;
    grid-template-columns: minmax(250px, 25%) 1fr;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styles */
#info-bubble-container {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background-color: var(--color-white);
    padding: 0.75rem;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.info-bubble-spacer {
    flex-grow: 1;
}

.info-bubble.return-button {
    margin-bottom: 0;
}

.info-bubble {
    background: #f8f9fa;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-default);
    border: 1px solid transparent;
    line-height: 1.3;
    font-size: 0.875rem;
}

.info-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgb(0 0 0 / 10%);
    border-color: var(--color-primary);
    background: var(--color-white);
}

.info-bubble.highlight {
    background-color: var(--color-primary);
    color: var(--color-white);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    position: relative;
}

/* Title specific styles */
.info-bubble.highlight:first-child {
    background-color: var(--color-primary);
    font-size: 1.4rem;
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    cursor: default;
}

/* Return button specific styles */
.info-bubble.highlight.return-button {
    margin-bottom: 0;
    background-color: #0056b3;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all var(--transition-default);
}

.info-bubble.highlight.return-button::after {
    content: "←";
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0.9;
    transition: transform var(--transition-default);
}

.info-bubble.highlight.return-button:hover {
    background-color: #004494;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
}

.info-bubble.highlight.return-button:hover::after {
    transform: translateY(-50%) translateX(-3px);
}

.info-bubble.highlight.return-button a {
    color: var(--color-white);
    display: block;
    text-decoration: none;
    padding-right: 2rem;
}

.info-bubble.highlight.return-button a:hover {
    color: var(--color-white);
    text-decoration: none;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .info-bubble.highlight.return-button {
        background-color: #0056b3;
    }

    .info-bubble.highlight.return-button:hover {
        background-color: #004494;
    }
}

.info-bubble b {
    font-weight: 600;
    color: var(--color-text);
}

.info-bubble.highlight b {
    color: var(--color-white);
}

.info-bubble a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-default);
}

.info-bubble a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.info-bubble.highlight a {
    color: var(--color-white);
    display: block;
    text-decoration: none;
    padding-right: 2rem;
}

.info-bubble.highlight a:hover {
    color: var(--color-white);
    text-decoration: none;
}

/* Warning styles */
.info-bubble b[text="WARNING"] {
    color: var(--color-danger);
    font-weight: 700;
}

/* Main Chat Container */
#anything-llm-chat {
    margin-left: 300px !important;
    width: calc(100% - 300px) !important;
    height: 100vh !important;
    background: var(--color-white) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    padding: 0.5rem;
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-default);
}

.mobile-menu-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
}

/* Responsive Design */
@media screen and (width <= 1024px) {
    #info-bubble-container {
        width: 250px;
    }

    #anything-llm-chat {
        margin-left: 250px !important;
        width: calc(100% - 250px) !important;
    }
}

@media screen and (width <= 768px) {
    #info-bubble-container {
        transform: translateX(-100%);
        transition: transform var(--transition-default);
        z-index: 999;
        padding: 0.75rem;
        width: 85%;
        max-width: 300px;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 20px));
    }

    #info-bubble-container.active {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgb(0 0 0 / 15%);
    }

    .info-bubble {
        padding: 0.625rem;
        margin-bottom: 0.375rem;
        font-size: 0.8125rem;
    }

    .info-bubble.highlight {
        padding: 0.75rem;
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }

    #anything-llm-chat {
        margin-left: 0 !important;
        width: 100% !important;
        z-index: 1;
        position: relative;
    }

    .mobile-menu-button {
        display: block;
    }
}

@media screen and (width <= 480px) {
    #info-bubble-container {
        width: 100%;
        padding: 1rem;
    }

    .info-bubble {
        padding: 1rem;
        margin-bottom: 0.5rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --color-text: var(--color-white);
        --color-white: #1a1a1a;
        --color-light: #2d2d2d;
        --color-border: #404040;
        --color-gray: #a0a0a0;
    }

    .info-bubble {
        background: #2d2d2d;
    }

    .info-bubble:hover {
        background: #333;
        border-color: var(--color-primary);
    }

    .info-bubble b {
        color: var(--color-white);
    }

    .info-bubble a {
        color: var(--color-primary);
    }

    .info-bubble a:hover {
        color: var(--color-white);
    }

    .info-bubble.highlight:hover {
        background-color: #0056b3;
    }
}

/* Override widget styles */
button[aria-label="Close"] {
    display: none !important;
    pointer-events: none !important;
}

/* Additional override to ensure parent container doesn't show the button */
div[class*="allm-flex"][class*="allm-justify-between"] > button[aria-label="Close"] {
    display: none !important;
    pointer-events: none !important;
}

/* Hide any container that might hold the close button */
.allm-flex.allm-justify-between.allm-items-center > button[aria-label="Close"],
.allm-flex.allm-items-center > button[aria-label="Close"] {
    display: none !important;
    pointer-events: none !important;
}

/* Ensure the close button's container doesn't reserve space */
.allm-flex.allm-justify-between.allm-items-center,
.allm-flex.allm-items-center {
    position: relative;
}

.allm-z-50 {
    z-index: 1 !important;
}

/* Utility Classes */
.hidden {
    display: none;
}

.shadow {
    box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
}

.fixed-bottom {
    position: fixed;
    bottom: var(--spacing-md);
    left: var(--spacing-md);
    z-index: 900;
}

/* Code Block Styles */
code, code[class*="language-"] {
    display: block;
    position: relative;
    margin: 1rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #1a1a1a;
}

code > div, code[class*="language-"] > div {
    position: relative;
    font-family: Menlo, Monaco, 'Courier New', monospace;
}

code .bg-stone-800, code[class*="language-"] .bg-stone-800 {
    background-color: #2d2d2d;
    border-bottom: 1px solid #404040;
    padding: 0.5rem 1rem;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

code pre, code[class*="language-"] pre {
    margin: 0;
    padding: 0.5rem;
    color: #e4e4e4;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
}

code button, code[class*="language-"] button {
    background: transparent;
    border: 1px solid #666;
    border-radius: 4px;
    color: #e4e4e4;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-default);
}

code button:hover, code[class*="language-"] button:hover {
    background-color: #404040;
    border-color: #888;
}

code .hljs-keyword, code[class*="language-"] .hljs-keyword {
    color: #ff79c6;
}

code .hljs-string, code[class*="language-"] .hljs-string {
    color: #f1fa8c;
}

code .text-slate-200, code[class*="language-"] .text-slate-200 {
    color: #e4e4e4;
}

code .font-mono, code[class*="language-"] .font-mono {
    font-family: Menlo, Monaco, 'Courier New', monospace;
}

code .font-sans, code[class*="language-"] .font-sans {
    font-family: Inter, system-ui, -apple-system, sans-serif;
}

code .text-xs, code[class*="language-"] .text-xs {
    font-size: 0.75rem;
}

code .text-sm, code[class*="language-"] .text-sm {
    font-size: 0.875rem;
}

code .rounded-t-md, code[class*="language-"] .rounded-t-md {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

code .flex, code[class*="language-"] .flex {
    display: flex;
}

code .items-center, code[class*="language-"] .items-center {
    align-items: center;
}

code .justify-between, code[class*="language-"] .justify-between {
    justify-content: space-between;
}

code .gap-2, code[class*="language-"] .gap-2 {
    gap: 0.5rem;
}

code .gap-x-2, code[class*="language-"] .gap-x-2 {
    gap: 0.5rem;
}

code .w-full, code[class*="language-"] .w-full {
    width: 100%;
}

code .h-4, code[class*="language-"] .h-4 {
    height: 1rem;
}

code .w-4, code[class*="language-"] .w-4 {
    width: 1rem;
}

code .whitespace-pre-wrap, code[class*="language-"] .whitespace-pre-wrap {
    white-space: pre-wrap;
}

code .px-2, code[class*="language-"] .px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

code .pb-4, code[class*="language-"] .pb-4 {
    padding-bottom: 1rem;
}

/* Inline code style override */
p > code, li > code {
    display: inline;
    padding: 0.2rem 0.4rem;
    margin: 0 0.2rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    white-space: pre-wrap;
    background-color: #2d2d2d;
    color: #e4e4e4;
}

/* Ensure smooth scrolling */
#info-bubble-container {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray) transparent;
}

/* Customize scrollbar for webkit browsers */
#info-bubble-container::-webkit-scrollbar {
    width: 6px;
}

#info-bubble-container::-webkit-scrollbar-track {
    background: transparent;
}

#info-bubble-container::-webkit-scrollbar-thumb {
    background-color: var(--color-gray);
    border-radius: 3px;
}

.info-bubble.pageview-bubble {
    text-align: center;
    font-weight: bold;
    background: #e9ecef;
}
