html {
    scroll-behavior: smooth;
}

/* Class for the app view, prevents scrolling */
.is-app {
    /* overflow: hidden; */
    min-height: 100vh;
    height: auto;
}

/* Class for the landing page view, allows scrolling */
.is-landing {
    overflow-x: hidden;
    overflow-y: auto;
}

/* For Webkit browsers like Chrome, Safari */
main#chat-container {
    background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 0);
    background-size: 2rem 2rem;
}

.dark main#chat-container {
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.05) 1px, transparent 0);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db; /* gray-300 */
    border-radius: 10px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563; /* gray-600 */
}

.loader {
    border: 4px solid #e5e7eb; /* gray-200 */
    border-top: 4px solid #8B5CF6; /* purple-500 */
    border-radius: 50%;
    width: 24px; /* Reduced size to fit bubble */
    height: 24px;
    animation: spin 1s linear infinite;
}

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

.chat-message {
    @apply flex w-full my-2;
}

.chat-message.user {
    @apply justify-end;
}

.chat-message.ai {
    @apply justify-start;
}

.message-bubble {
    @apply max-w-xl lg:max-w-2xl px-5 py-3 rounded-2xl relative shadow-lg text-base;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    word-wrap: break-word;
}

.user-bubble { 
    @apply bg-gradient-to-br from-purple-500 to-indigo-600 text-white leading-relaxed rounded-tr-none shadow-purple-200/50;
}

.ai-bubble { 
    @apply bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 leading-relaxed rounded-tl-none shadow-gray-200/50;
}

/* Styling for code blocks inside AI bubbles */
.ai-bubble pre {
    @apply bg-gray-800 dark:bg-black/60 p-4 rounded-lg my-3 overflow-x-auto shadow-inner;
}

.ai-bubble code {
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    @apply text-sm text-green-300;
}

.ai-bubble pre code {
    @apply text-white;
}

/* History item actions */
.history-item {
    position: relative;
}

.history-item-actions {
    @apply absolute right-2 top-1/2 -translate-y-1/2 flex items-center opacity-0 group-hover:opacity-100 transition-opacity;
}

.history-action-btn {
    @apply p-1 text-gray-400 hover:text-gray-700 dark:hover:text-gray-200;
}

.code-block-wrapper {
    @apply relative;
}

.copy-code-btn {
    @apply absolute top-2 right-2 p-1.5 text-xs bg-gray-600/50 text-white/70 rounded-md hover:bg-gray-500/70 transition-all opacity-0 group-hover:opacity-100;
}

select {
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px 0 rgba(139, 92, 246, 0.07);
    background-color: #fff;
    outline: none;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    min-width: 0;
}

.dark select {
    background-color: #374151;
    border-color: #4b5563;
}

select:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 2px #c4b5fd;
    transform: scale(1.03);
}

.group:hover select, .group:focus-within select {
    border-color: #a78bfa;
    box-shadow: 0 2px 8px 0 rgba(139, 92, 246, 0.12);
    transform: scale(1.04);
}

select option {
    padding: 0.4rem 0.8rem;
    font-size: 0.95rem;
    background: #fff;
    color: #4b5563;
    border-radius: 0.5rem;
}

.dark select option {
    background: #374151;
    color: #f3f4f6;
}

/* Custom dropdown menu styles */
.dropdown-item {
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
    width: 100%;
    text-align: left;
    transition: background 0.2s;
}

#agent-dropdown-menu, #model-dropdown-menu {
    opacity: 1 !important;
    pointer-events: auto !important;
    display: none;
}

#agent-dropdown-menu[style*="display: block"], #model-dropdown-menu[style*="display: block"] {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: fadeInDropdown 0.18s ease;
}

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

#chat-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: auto;
}

#chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    scroll-behavior: smooth;
}

#prompt-wrapper {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 10;
}

.dark #prompt-wrapper {
    background: #1f2937;
}

body, html {
    height: 100%;
    min-height: 100%;
    overflow: hidden;
}