/* CSS Custom Properties for Dynamic Viewport */
:root {
    --vh: 1vh;
    --vw: 1vw;
    /* Fallback for browsers that don't support dvh */
    --app-height: 100vh;
    /* Safe area insets for devices with notches */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);

    /* Dynamic viewport units for modern browsers */
    --dynamic-vh: 1dvh;
    --small-vh: 1svh;
    --large-vh: 1lvh;
}

/* Support for dynamic viewport units (preferred for mobile) */
@supports (height: 100dvh) {
    :root {
        --app-height: 100dvh;
        --dynamic-vh: 1dvh;
    }
}

/* Support for small viewport height (when browser UI is visible) */
@supports (height: 100svh) {
    :root {
        --small-vh: 1svh;
    }
}

/* Support for large viewport height (when browser UI is hidden) */
@supports (height: 100lvh) {
    :root {
        --large-vh: 1lvh;
    }
}

/* Specific support for Samsung Browser and other mobile browsers */
@supports (-webkit-touch-callout: none) {
    :root {
        --app-height: -webkit-fill-available;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-appearance: none) and (not (contain: paint)) {
    :root {
        --app-height: -webkit-fill-available;
    }
}

/* Chrome on Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
    :root {
        --app-height: 100vh;
    }

    @supports (height: 100dvh) {
        :root {
            --app-height: 100dvh;
        }
    }
}

/* Samsung Internet specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    @supports (-webkit-appearance: none) {
        :root {
            --app-height: -webkit-fill-available;
        }
    }
}

/* Performance Optimizations */
/* Reduce paint and layout thrashing */
* {
    /* Optimize box-sizing for better performance */
    box-sizing: border-box;
}

/* Optimize font rendering */
html {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Optimize scrolling performance */
html, body {
    scroll-behavior: smooth;
}

/* Reduce repaints for frequently animated elements */
.landing-container,
.hero-content,
.hero-visual,
.chat-preview,
.feature-card,
.cta-btn {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Optimize image loading */
img {
    max-width: 100%;
    height: auto;
    /* Improve image rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Optimize focus states for accessibility and performance */
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid #1de8e7;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .hero-content,
    .hero-visual {
        animation: none !important;
    }
}



* {
    margin: 0;
    padding: 0;
    /* box-sizing already set in performance optimizations above */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #212121;
    color: #ffffff;
    /* Use CSS custom property for dynamic height */
    height: var(--app-height);
    min-height: var(--app-height);
    overflow: hidden;
    /* Prevent horizontal scrolling on mobile */
    overflow-x: hidden;
    /* Improve touch scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    /* Prevent text selection on mobile for better UX */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Ensure proper rendering on mobile */
    position: relative;
    /* Prevent bounce scrolling on iOS */
    overscroll-behavior: none;
    /* Ensure consistent rendering across browsers */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.app-container {
    display: flex;
    height: var(--app-height);
    min-height: var(--app-height);
    /* Ensure container adapts to mobile browser UI changes */
    position: relative;
    width: 100%;
    max-width: 100vw;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    /* Prevent content from being cut off by browser UI */
    overflow: hidden;
    /* Ensure proper stacking context */
    isolation: isolate;
}

.app-container.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

.app-container.fade-in {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Sidebar backdrop - hidden by default on desktop */
.sidebar-backdrop {
    display: none;
}

/* Sidebar Styles */
.sidebar {
    width: 320px;
    background-color: #171717;
    border-right: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                visibility 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    z-index: 100;
    overflow: visible;
}

.sidebar.hidden {
    transform: translateX(-100%);
    width: 0;
    min-width: 0;
    flex: 0 0 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
}

/* Smooth content fade-out when sidebar is hidden */
.sidebar.hidden .sidebar-header {
    opacity: 0;
    transform: translateX(-15px);
}

.sidebar.hidden .chat-history {
    opacity: 0;
    transform: translateX(-15px);
}

.sidebar.hidden .sidebar-footer {
    opacity: 0;
    transform: translateX(-15px);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #2d2d2d;
    transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: transparent;
    border: 1px solid #4d4d4d;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: #2d2d2d;
}

.chat-history {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    overflow-x: visible;
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.05s,
                transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.05s;
}

.chat-item {
    padding: 14px 18px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    color: #b3b3b3;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.chat-item:hover {
    background-color: #2d2d2d;
}

.chat-item.active {
    background-color: #2d2d2d;
    color: #ffffff;
}

.chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-menu-button {
    background: none;
    border: none;
    color: #8d8d8d;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    margin-left: 8px;
    flex-shrink: 0;
}

.chat-item:hover .chat-menu-button {
    opacity: 1;
}

.chat-menu-button:hover {
    background-color: #3d3d3d;
    color: #ffffff;
}

.chat-dropdown-menu {
    position: fixed;
    background-color: #2d2d2d;
    border: 1px solid #4d4d4d;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: all 0.2s;
}

.chat-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.dropdown-item {
    width: 100%;
    background: none;
    border: none;
    color: #b3b3b3;
    font-size: 14px;
    cursor: pointer;
    padding: 12px 16px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #3d3d3d;
    color: #ffffff;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-item:only-child {
    border-radius: 8px;
}

.delete-chat-btn {
    color: #ff6b6b !important;
}

.delete-chat-btn:hover {
    background-color: #ff6b6b !important;
    color: #ffffff !important;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #2d2d2d;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s,
                transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b3b3b3;
    font-size: 14px;
    margin-bottom: 12px;
    position: relative;
}

.logout-btn {
    background: none;
    border: none;
    color: #8d8d8d;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: auto;
}

.logout-btn:hover {
    background-color: #2d2d2d;
    color: #ff6b6b;
}

.profile-settings-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.profile-settings-btn:hover {
    background-color: #2d2d2d;
    color: #ffffff;
}

.profile-settings-btn i {
    font-size: 16px;
}

/* Settings Menu */
.settings-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.settings-menu.show {
    opacity: 1;
    visibility: visible;
}

.settings-content {
    background-color: #1a1a1a;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid #2d2d2d;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-menu.show .settings-content {
    transform: scale(1) translateY(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #2d2d2d;
}

.settings-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.settings-close-btn {
    background: none;
    border: none;
    color: #8d8d8d;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.settings-close-btn:hover {
    background-color: #2d2d2d;
    color: #ffffff;
}

.settings-section {
    padding: 24px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #2d2d2d;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item label {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}

.settings-value {
    color: #b3b3b3;
    font-size: 14px;
}

.settings-value-editable {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-input {
    background-color: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
}

.settings-input:focus {
    outline: none;
    border-color: #1de8e7;
    background-color: #333333;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
}

.settings-input::placeholder {
    color: #8d8d8d;
}

.settings-edit-btn {
    background: none;
    border: none;
    color: #8d8d8d;
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.settings-edit-btn:hover {
    background-color: #404040;
    color: #ffffff;
}



.settings-toggle {
    position: relative;
    width: 50px;
    height: 24px;
}

.settings-toggle input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #404040;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #1de8e7;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.settings-actions {
    padding: 20px 24px;
    border-top: 1px solid #2d2d2d;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.settings-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.settings-btn.primary {
    background-color: #1de8e7;
    color: #000000;
}

.settings-btn.primary:hover {
    background-color: #00e6e6;
}

.settings-btn.secondary {
    background-color: transparent;
    color: #b3b3b3;
    border: 1px solid #404040;
}

.settings-btn.secondary:hover {
    background-color: #2d2d2d;
    color: #ffffff;
}

.settings-btn.danger {
    background-color: #dc3545;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-btn.danger:hover {
    background-color: #c82333;
}

.danger-section {
    border-top: 1px solid #2d2d2d;
    margin-top: 16px;
    padding-top: 24px;
}

.danger-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.danger-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}



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

.danger-description {
    color: #8d8d8d;
    font-size: 12px;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease-out;
}

.success-message i {
    font-size: 16px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Enhanced Document Preview Styles */
.document-preview-enhanced {
    background: #3a3a3a;
    border: 2px solid #ffffff;
    border-radius: 12px;
    margin: 8px auto;
    color: #ffffff;
    font-size: 14px;
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* Single Document Display */
.single-document-display {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.single-document-display i {
    color: #ffffff;
    font-size: 16px;
    opacity: 0.9;
}

.single-document-display .document-text {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.single-document-display .document-text strong {
    font-weight: 600;
    color: #ffffff;
}

/* Multiple Documents Display */
.multiple-documents-display {
    position: relative;
}

.documents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.documents-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.header-content i {
    color: #ffffff;
    font-size: 16px;
    opacity: 0.9;
}

.header-content .document-text {
    font-weight: 500;
    font-size: 14px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.expand-arrow {
    color: #ffffff;
    font-size: 14px;
    transition: transform 0.3s ease;
    opacity: 0.8;
}

.multiple-documents-display.expanded .expand-arrow {
    transform: rotate(180deg);
}

.documents-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.multiple-documents-display.expanded .documents-content {
    max-height: 400px;
    padding: 16px 20px;
}

/* Clear Documents Button */
.clear-documents-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    opacity: 0.7;
    transition: all 0.2s ease;
    font-size: 12px;
}

.clear-documents-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced Document Items */
.document-item-enhanced {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    transition: background-color 0.2s ease;
}

.document-item-enhanced:last-child {
    border-bottom: none;
}

.document-item-enhanced:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin: 0 -8px;
    padding: 10px 8px;
}

.document-item-enhanced i {
    color: #ffffff;
    width: 16px;
    opacity: 0.8;
}

.document-item-enhanced .doc-name {
    font-weight: 500;
    color: #ffffff;
    flex: 1;
}

.document-item-enhanced .doc-type {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.document-item-enhanced .doc-stats {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

/* Enhanced Document Stats */
.document-stats-enhanced {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.document-stats-enhanced i {
    margin-right: 6px;
    opacity: 0.8;
}

/* Document Preview Container */
.document-preview-container {
    padding: 0 24px;
    margin-bottom: 12px;
}

/* Responsive Design for Enhanced Document Preview */
@media (max-width: 768px) {
    .document-preview-enhanced {
        margin: 8px 16px;
        font-size: 13px;
    }

    .single-document-display {
        padding: 14px 16px;
        gap: 10px;
    }

    .documents-header {
        padding: 14px 16px;
    }

    .multiple-documents-display.expanded .documents-content {
        padding: 14px 16px;
    }

    .document-item-enhanced {
        gap: 10px;
        font-size: 12px;
    }

    .document-preview-container {
        padding: 0 16px;
    }
}

/* Animation for smooth expansion */
@keyframes expandContent {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 400px;
        opacity: 1;
    }
}

.multiple-documents-display.expanded .documents-content {
    animation: expandContent 0.3s ease-out;
}

/* Auth Error Styles */
.auth-error {
    background:
        linear-gradient(145deg, rgba(220, 38, 38, 0.15) 0%, rgba(185, 28, 28, 0.15) 100%);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #ff6b6b;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    box-shadow:
        0 4px 12px rgba(220, 38, 38, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}



/* Code Block Positioning */
pre {
    position: relative;
}



.powered-by {
    text-align: center;
    color: #8d8d8d;
}

.powered-by small {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
}

.ai-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #1de8e7;
}

.ai-branding i {
    font-size: 14px;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #212121;
    transition: margin-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.main-content.sidebar-hidden {
    margin-left: 0;
    width: 100%;
    flex: 1;
}

.header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background-color: #212121;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    margin-right: 16px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex; /* Show on all screen sizes */
}

.sidebar-toggle:hover {
    background-color: #2d2d2d;
    transform: scale(1.05);
}

.sidebar-toggle i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle:active i {
    transform: scale(0.95);
}

.app-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.new-chat-btn-header {
    background: none;
    border: none;
    color: #b3b3b3;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.new-chat-btn-header:hover {
    background-color: #2d2d2d;
    color: #ffffff;
}









/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}



.welcome-message {
    text-align: center;
    max-width: 600px;
    margin: auto;
    padding: 40px 20px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.welcome-icon {
    font-size: 48px;
    color: #1de8e7;
    margin-bottom: 24px;
}



.welcome-message h2 {
    font-size: 32px;
    margin-bottom: 16px;
    font-weight: 600;
}

.welcome-message p {
    font-size: 18px;
    color: #b3b3b3;
    margin-bottom: 40px;
}

.example-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.prompt-card {
    background-color: #2d2d2d;
    border: 1px solid #4d4d4d;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.prompt-card:hover {
    background-color: #3d3d3d;
    border-color: #6d6d6d;
}

.prompt-card i {
    font-size: 20px;
    color: #1de8e7;
}

.prompt-card span {
    font-size: 14px;
    color: #ffffff;
}

/* Message Styles */
.message {
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Only animate new messages */
.message.new-message {
    animation: message-appear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

@keyframes message-appear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}



/* Message sending feedback animations */
.send-btn.sending {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
    animation: sending-pulse 1.5s infinite ease-in-out;
    transform: scale(0.95);
}

@keyframes sending-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(243, 156, 18, 0.6);
    }
}

.input-wrapper.message-sending {
    animation: message-sending-feedback 0.3s ease-out;
}

@keyframes message-sending-feedback {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}



/* Improved message appearance for AI responses */
.ai-message.new-message {
    animation: ai-message-appear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ai-message-appear {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Subtle pulse for send button when enabled */
.send-btn:not(:disabled):not(.sending) {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn:not(:disabled):not(.sending):hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.3);
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.user-avatar {
    background-color: transparent;
    color: transparent;
    border: none;
}

.ai-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.ai-avatar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

.ai-avatar::after {
    content: '';
    position: relative;
    z-index: 1;
}

.ai-avatar i {
    position: relative;
    z-index: 1;
    animation: brain-pulse 2s infinite ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}





.message-content {
    flex: 1;
    line-height: 1.8;
    max-width: 100%;
    overflow-wrap: break-word;
    /* Enable text selection and copying */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    /* Ensure cursor shows as text selection cursor */
    cursor: text;
}

.user-message .message-content {
    background-color: #2d2d2d;
    padding: 12px 16px;
    border-radius: 12px;
    border-top-right-radius: 4px;
}

.ai-message .message-content {
    padding: 12px 0;
}

/* Ensure all text elements within messages are selectable */
.message-content *,
.message-content span,
.message-content p,
.message-content div,
.message-content code,
.message-content pre {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* HTML Formatting Styles for AI Messages */
.message-content h1,
.message-content h2,
.message-content h3 {
    font-size: 1.1em;
    color: #1de8e7;
    margin: 20px 0 12px 0;
    font-weight: 600;
    line-height: 1.4;
}

/* First header in message should have less top margin */
.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

.message-content p {
    margin: 0 0 1px 0 !important; /* Force paragraph spacing */
    line-height: 1.4;
    white-space: pre-line; /* Preserve line breaks and wrap text naturally */
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Better spacing for consecutive paragraphs */
.message-content p + p {
    margin-top: 20px !important;
}

/* Ensure all paragraphs in messages have proper spacing */
.chat-bubble .message-content p {
    margin: 0 0 10px 0 !important;
    line-height: 1.6 !important;
}

.message-content ul,
.message-content ol {
    margin: 8px 0 20px 0 !important; /* Increased top margin for better spacing */
    padding-left: 40px !important; /* Ensure enough space for bullets */
    list-style-position: outside !important; /* Ensure bullets appear outside the content area */
    display: block !important; /* Ensure proper list display */
}

/* Reduced gap between headers and lists */
.message-content h1 + ul,
.message-content h1 + ol,
.message-content h2 + ul,
.message-content h2 + ol,
.message-content h3 + ul,
.message-content h3 + ol {
    margin-top: 4px;
}

.message-content li {
    margin: 4px 0; /* Normal spacing for list items */
    line-height: 1.6; /* Comfortable line height */
    padding: 0;
}

/* Removed duplicate rule - using the one above */

.message-content ul li {
    list-style-type: disc !important;
    display: list-item !important; /* Ensure proper list item display */
}

.message-content ol li {
    list-style-type: decimal !important;
    display: list-item !important; /* Ensure proper list item display */
}

/* Removed: no-bullet class styling - all list items should show bullets */

/* Better spacing for list items with nested content */
.message-content li p {
    margin: 2px 0;
    line-height: 1.5;
}

.message-content li:last-child {
    margin-bottom: 20px; /* Add spacing after the last list item */
}

/* Semantic spacing using CSS instead of br tags */
.message-content .message-paragraph {
    margin: 0 0 20px 0;
    line-height: 1.6;
    white-space: pre-line; /* Preserve line breaks and wrap text naturally */
    display: block; /* Ensure proper block display */
}

.message-content .message-paragraph:last-child {
    margin-bottom: 0;
}

/* Ensure proper spacing between all paragraph elements */
.message-content .message-paragraph + .message-paragraph {
    margin-top: 10px;
}

/* Notification and Toast Styling */
.usage-limit-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #ff6b6b;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease-out;
}

.usage-limit-notification .notification-time {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Update notification styling */
.update-notification {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #ff6b35;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: pulse 2s infinite;
    transition: opacity 0.5s ease;
}

.update-notification.fade-out {
    opacity: 0;
}

/* Welcome message visibility states */
.welcome-message.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none;
}

.welcome-message.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: block;
}



/* Line breaks for better readability */
.message-content br {
    line-height: 1.5;
}

/* Spacing around block elements */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 20px 0 12px 0;
}

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

.message-content ul,
.message-content ol {
    margin: 16px 0;
}

.message-content ul:first-child,
.message-content ol:first-child {
    margin-top: 0;
}

.message-content ul:last-child,
.message-content ol:last-child {
    margin-bottom: 0;
}

.message-content table {
    margin: 16px 0;
}

.message-content table:first-child {
    margin-top: 0;
}

.message-content table:last-child {
    margin-bottom: 0;
}

.message-content pre {
    margin: 4px 0;
}

.message-content pre:first-child {
    margin-top: 0;
}

.message-content pre:last-child {
    margin-bottom: 0;
}

/* Minimal spacing between consecutive code blocks */
.message-content pre + pre {
    margin-top: 2px;
}

/* Reduced spacing between code blocks and other elements */
.message-content p + pre,
.message-content .message-paragraph + pre {
    margin-top: 6px;
}

.message-content pre + p,
.message-content pre + .message-paragraph {
    margin-top: 8px;
}

.message-content hr {
    margin: 24px 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Reduce spacing between headers and immediately following lists */
.message-content h1 + ul,
.message-content h1 + ol,
.message-content h2 + ul,
.message-content h2 + ol,
.message-content h3 + ul,
.message-content h3 + ol {
    margin-top: 8px;
}

/* Legacy br tag support - add spacing for any remaining br tags */
.message-content br {
    display: block;
    margin-top: 8px;
    content: "";
}

/* Enhanced Inline Code Styling - Compact Version */
.message-content code {
    background: linear-gradient(135deg, #2a2a2a 0%, #333333 100%);
    color: #1de8e7;
    padding: 2px 6px; /* Reduced from 3px 8px for more compact appearance */
    border-radius: 4px; /* Reduced from 6px for tighter look */
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em; /* Slightly smaller from 0.88em */
    font-weight: 500;
    border: 1px solid #404040;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.25), /* Reduced shadow for less visual weight */
        inset 0 1px 0 rgba(255, 255, 255, 0.08); /* Slightly reduced inner highlight */
    letter-spacing: 0.01em; /* Reduced letter spacing for compactness */
    position: relative;
    line-height: 1.2; /* Added line-height for better vertical compactness */
    /* Fix for line wrapping - preserve styling across line breaks */
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.message-content code::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(0, 255, 255, 0.04) 50%, transparent 70%); /* Slightly reduced opacity for subtlety */
    border-radius: 4px; /* Updated to match the new border-radius */
    pointer-events: none;
}

/* Enhanced Code Block Styling */
.message-content pre {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 1px solid #333333;
    border-radius: 12px;
    padding: 20px;
    margin: 4px 0 6px 0;
    overflow-x: auto;
    max-width: 100%;
    position: relative;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

/* Code block header with language indicator */
.message-content pre::before {
    content: 'Code';
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #1de8e7, #00CCCC);
    color: #000000;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 0 12px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Scrollbar styling for code blocks */
.message-content pre::-webkit-scrollbar {
    height: 8px;
}

.message-content pre::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.message-content pre::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1de8e7, #00CCCC);
    border-radius: 4px;
}

.message-content pre::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00CCCC, #009999);
}

.message-content pre code {
    background: none;
    padding: 0;
    color: #f0f6fc;
    font-size: 0.9em;
    line-height: 1.4;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 400;
    letter-spacing: 0.02em;
    word-wrap: break-word;
    white-space: pre-wrap;
    border: none;
    box-shadow: none;
    display: block;
    overflow-x: auto;
    /* Ensure proper text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.message-content pre code::before {
    display: none;
}

/* Basic Syntax Highlighting for Common Keywords */
.message-content pre code {
    /* Keywords */
    background-image:
        /* Python keywords */
        linear-gradient(transparent, transparent),
        /* JavaScript keywords */
        linear-gradient(transparent, transparent),
        /* General keywords */
        linear-gradient(transparent, transparent);
}

/* Language-specific code block styling */
.message-content pre[data-language="python"]::before {
    content: 'Python';
    background: linear-gradient(135deg, #3776ab, #ffd43b);
    color: #ffffff;
}

.message-content pre[data-language="javascript"]::before,
.message-content pre[data-language="js"]::before {
    content: 'JavaScript';
    background: linear-gradient(135deg, #f7df1e, #f0db4f);
    color: #000000;
}

.message-content pre[data-language="html"]::before {
    content: 'HTML';
    background: linear-gradient(135deg, #e34c26, #f06529);
    color: #ffffff;
}

.message-content pre[data-language="css"]::before {
    content: 'CSS';
    background: linear-gradient(135deg, #1572b6, #33a9dc);
    color: #ffffff;
}

.message-content pre[data-language="json"]::before {
    content: 'JSON';
    background: linear-gradient(135deg, #000000, #333333);
    color: #ffffff;
}

.message-content pre[data-language="bash"]::before,
.message-content pre[data-language="shell"]::before {
    content: 'Shell';
    background: linear-gradient(135deg, #4eaa25, #89e051);
    color: #000000;
}

.message-content pre[data-language="sql"]::before {
    content: 'SQL';
    background: linear-gradient(135deg, #336791, #4479a1);
    color: #ffffff;
}



/* Improved code block animations */
.message-content pre {
    animation: codeBlockFadeIn 0.3s ease-out;
}

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

/* Code block glow effect on hover */
.message-content pre:hover {
    border-color: #404040;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* Enhanced typography for code blocks */
.message-content pre code {
    /* Better font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;

    /* Improved readability */
    tab-size: 4;
    -moz-tab-size: 4;
    -o-tab-size: 4;
}



/* Responsive code blocks */
@media (max-width: 768px) {
    .message-content pre {
        padding: 16px;
        margin: 2px 0;
        border-radius: 8px;
        font-size: 0.85em;
    }

    /* Even tighter spacing on mobile for consecutive code blocks */
    .message-content pre + pre {
        margin-top: 1px;
    }

    .message-content pre::before {
        padding: 3px 8px;
        font-size: 9px;
    }
}

/* Dark theme optimizations */
.message-content pre {
    /* Better contrast for readability */
    background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
    border-color: #30363d;
}

.message-content pre code {
    color: #f0f6fc;
}

/* Enhanced Syntax highlighting colors */

/* CSS Syntax Highlighting */
.message-content pre code .css-selector {
    color: #ffa657;
    font-weight: 600;
}

.message-content pre code .css-property {
    color: #79c0ff;
}

.message-content pre code .css-value {
    color: #a5d6ff;
}

.message-content pre code .css-comment {
    color: #8b949e;
    font-style: italic;
}

/* JavaScript Syntax Highlighting */
.message-content pre code .js-keyword {
    color: #ff7b72;
    font-weight: 600;
}

.message-content pre code .js-string {
    color: #a5d6ff;
}

.message-content pre code .js-number {
    color: #79c0ff;
}

.message-content pre code .js-comment {
    color: #8b949e;
    font-style: italic;
}

/* Python Syntax Highlighting */
.message-content pre code .py-keyword {
    color: #ff7b72;
    font-weight: 600;
}

.message-content pre code .py-string {
    color: #a5d6ff;
}

.message-content pre code .py-number {
    color: #79c0ff;
}

.message-content pre code .py-comment {
    color: #8b949e;
    font-style: italic;
}

/* JSON Syntax Highlighting */
.message-content pre code .json-key {
    color: #79c0ff;
    font-weight: 600;
}

.message-content pre code .json-string {
    color: #a5d6ff;
}

.message-content pre code .json-number {
    color: #79c0ff;
}

.message-content pre code .json-literal {
    color: #ff7b72;
    font-weight: 600;
}

/* HTML Syntax Highlighting */
.message-content pre code .html-tag {
    color: #ff7b72;
    font-weight: 600;
}

.message-content pre code .html-attribute {
    color: #79c0ff;
}

.message-content pre code .html-string {
    color: #a5d6ff;
}

.message-content pre code .html-comment {
    color: #8b949e;
    font-style: italic;
}

.message-content pre code .html-doctype {
    color: #ffa657;
    font-weight: 600;
}

/* General syntax highlighting fallbacks */
.message-content pre code .keyword {
    color: #ff7b72;
    font-weight: 600;
}

.message-content pre code .string {
    color: #a5d6ff;
}

.message-content pre code .comment {
    color: #8b949e;
    font-style: italic;
}

.message-content pre code .number {
    color: #79c0ff;
}

.message-content pre code .function {
    color: #d2a8ff;
}

.message-content pre code .variable {
    color: #ffa657;
}

.message-content strong {
    color: #64b5f6;
    font-weight: 600;
}

/* Light blue bold styling for single asterisk formatting */
.message-content strong.light-blue-bold {
    color: #64b5f6;
    font-weight: 600;
}

/* Blue text styling for double asterisk formatting */
.message-content .blue-text {
    color: #64b5f6;
    font-weight: 500;
}

/* White highlight formatting for single asterisks */
.message-content .highlight-text {
    color: #ffffff; /* White color for highlighted text */
    font-weight: normal; /* Remove bold styling - only white color */
}

/* Blockquote styling */
.message-content blockquote {
    border-left: 4px solid #1de8e7;
    margin: 20px 0;
    padding: 16px 0 16px 20px;
    background-color: rgba(0, 255, 255, 0.05);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #e0e0e0;
    line-height: 1.6;
}

.message-content blockquote p {
    margin: 0 0 20px 0;
    line-height: 1.6;
}

.message-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Enhanced Horizontal rule styling */
.message-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 255, 255, 0.1) 10%,
        rgba(0, 255, 255, 0.6) 30%,
        #1de8e7 50%,
        rgba(0, 255, 255, 0.6) 70%,
        rgba(0, 255, 255, 0.1) 90%,
        transparent 100%
    );
    margin: 32px 0;
    position: relative;
    border-radius: 2px;
    box-shadow:
        0 0 10px rgba(0, 255, 255, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2);
    animation: hr-glow 3s ease-in-out infinite alternate;
}

.message-content hr::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 255, 255, 0.05) 20%,
        rgba(0, 255, 255, 0.2) 50%,
        rgba(0, 255, 255, 0.05) 80%,
        transparent 100%
    );
    border-radius: 4px;
    filter: blur(2px);
}

.message-content hr::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #1de8e7 0%, rgba(0, 255, 255, 0.3) 70%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    animation: hr-pulse 2s ease-in-out infinite;
}

@keyframes hr-glow {
    0% {
        box-shadow:
            0 0 10px rgba(0, 255, 255, 0.3),
            0 2px 4px rgba(0, 0, 0, 0.2);
        filter: brightness(1);
    }
    100% {
        box-shadow:
            0 0 20px rgba(0, 255, 255, 0.5),
            0 4px 8px rgba(0, 0, 0, 0.3);
        filter: brightness(1.2);
    }
}

@keyframes hr-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

/* Table styling */
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0 4px 0;
    background-color: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
    /* Tables are visible by default - no opacity issues */
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* Enhanced fade-in animation for tables (optional enhancement) */
.message-content table.table-fade-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@keyframes table-appear {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Code block fade-in animation for instant display */
.message-content pre.code-block-fade-in {
    animation: code-block-appear 0.2s ease-out;
}

@keyframes code-block-appear {
    0% {
        opacity: 0;
        transform: translateY(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}



.message-content th,
.message-content td {
    border: 1px solid #4d4d4d;
    padding: 12px;
    text-align: left;
}

.message-content th {
    background-color: #3d3d3d;
    font-weight: 600;
    color: #1de8e7;
}

/* Add spacing between different content types */
.message-content > * + * {
    margin-top: 12px;
}

.message-content > *:first-child {
    margin-top: 0;
}

.message-content > *:last-child {
    margin-bottom: 0;
}

/* Special spacing for specific combinations */
.message-content > p + ul,
.message-content > p + ol {
    margin-top: 12px;
}

.message-content > ul + p,
.message-content > ol + p {
    margin-top: 16px;
}

/* Input Container */
.input-container {
    padding: 20px 24px; /* Reduced from 32px 24px for thinner appearance */
    background: linear-gradient(180deg, #212121 0%, #1a1a1a 100%);
    position: relative;
}

/* Blue line above input removed for cleaner appearance */

.input-wrapper {
    max-width: 900px; /* Reduced from 1000px for thinner appearance */
    margin: 0 auto;
    position: relative;
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 50%, #2a2a2a 100%);
    border-radius: 20px; /* Reduced from 28px for thinner appearance */
    padding: 12px 20px; /* Reduced from 16px 20px for thinner appearance */
    display: flex;
    align-items: flex-end;
    gap: 12px; /* Reduced from 16px for more compact layout */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.input-wrapper::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    padding: 2px;
    background: linear-gradient(135deg, #4d4d4d 0%, #3a3a3a 50%, #4d4d4d 100%);
    border-radius: 28px;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    -webkit-mask-composite: xor;
    z-index: -1;
    transition: all 0.3s ease;
}

.input-buttons {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding-bottom: 2px;
}

.input-wrapper:hover {
    transform: translateY(-1px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.input-wrapper:hover::before {
    background: linear-gradient(135deg, #5d5d5d 0%, #4a4a4a 50%, #5d5d5d 100%);
}

.input-wrapper:focus-within {
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.input-wrapper:focus-within::before {
    background: linear-gradient(135deg, #1de8e7 0%, #00CCCC 50%, #1de8e7 100%);
    animation: border-glow 2s ease-in-out infinite alternate;
}

@keyframes border-glow {
    0% {
        background: linear-gradient(135deg, #1de8e7 0%, #00CCCC 50%, #1de8e7 100%);
        opacity: 0.8;
    }
    100% {
        background: linear-gradient(135deg, #00CCCC 0%, #1de8e7 50%, #00CCCC 100%);
        opacity: 1;
    }
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 16px; /* Reduced from 18px for thinner appearance */
    resize: none;
    outline: none;
    min-height: 20px; /* Reduced from 32px for thinner appearance */
    max-height: 120px; /* Reduced from 140px for thinner appearance */
    overflow-y: auto;
    line-height: 1.5;
    padding: 6px 0; /* Reduced from 8px 0 for thinner appearance */
    font-family: inherit;
    transition: all 0.3s ease, transform 0.15s ease;
    vertical-align: bottom;
}

#messageInput::placeholder {
    color: #888888;
    font-style: normal;
    font-weight: 400;
    opacity: 0.8;
}

#messageInput:focus::placeholder {
    color: #aaaaaa;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* Typing indicator for input */
.input-wrapper.typing {
    animation: subtle-pulse 2s ease-in-out infinite;
}

/* Paste indicator for input */
.input-wrapper.pasting {
    border-color: #1de8e7;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
    animation: paste-pulse 1s ease-in-out;
}

@keyframes paste-pulse {
    0% {
        box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(0, 255, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
    }
}

@keyframes subtle-pulse {
    0%, 100% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 2px 8px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow:
            0 12px 40px rgba(0, 0, 0, 0.5),
            0 4px 12px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.15),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    }
}

.send-btn {
    background: #ffffff;
    border: none;
    border-radius: 8px; /* Modern rounded rectangle instead of circle */
    width: 36px; /* Slightly smaller for minimalist look */
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a1a1a;
    font-size: 16px;
    box-shadow: none; /* Remove heavy shadows for minimalist look */
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Removed decorative pseudo-elements for minimalist design */

.send-btn:disabled {
    background: #4a4a4a;
    cursor: not-allowed;
    color: #888888;
    opacity: 0.5;
}

.send-btn:not(:disabled):hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.send-btn:not(:disabled):active {
    background: #e0e0e0;
    transform: scale(0.95);
}

/* Upload Button Styles */
.upload-btn {
    background: #4a4a4a;
    border: none;
    border-radius: 8px; /* Modern rounded rectangle instead of circle */
    width: 36px; /* Slightly smaller for minimalist look */
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    font-size: 16px;
    box-shadow: none; /* Remove heavy shadows for minimalist look */
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Removed decorative pseudo-elements for minimalist design */

.upload-btn:hover {
    background: #5a5a5a;
    transform: scale(1.05);
}

.upload-btn:active {
    background: #3a3a3a;
    transform: scale(0.95);
}

.upload-btn.processing {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
    animation: processing-pulse 2s ease-in-out infinite;
}

@keyframes processing-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 4px 16px rgba(243, 156, 18, 0.4),
            0 2px 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.08);
        box-shadow:
            0 8px 24px rgba(243, 156, 18, 0.6),
            0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Image Preview Container Styles */
.image-preview-container {
    max-width: 800px;
    margin: 0 auto 16px auto;
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 50%, #2a2a2a 100%);
    border-radius: 16px;
    border: 1px solid #3a3a3a;
    padding: 16px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.image-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #3a3a3a;
}

.preview-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-title i {
    color: #1de8e7;
}

.clear-images-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.clear-images-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.image-preview-item {
    position: relative;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
    transition: all 0.3s ease;
}

.image-preview-item:hover {
    border-color: #1de8e7;
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.image-preview-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.image-preview-item .image-info {
    padding: 8px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.image-preview-item .image-name {
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.image-preview-item .image-size {
    color: #888888;
    font-size: 10px;
}

.image-preview-item .remove-image-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(231, 76, 60, 0.9);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: all 0.3s ease;
}

.image-preview-item:hover .remove-image-btn {
    opacity: 1;
}

.remove-image-btn:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

/* Document Preview Grid Styles */
.document-preview-container {
    max-width: 800px;
    margin: 0 auto 16px auto;
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 50%, #2a2a2a 100%);
    border-radius: 16px;
    border: 1px solid #3a3a3a;
    padding: 16px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.document-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.document-preview-header .preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.document-preview-header .preview-title i {
    color: #6c5ce7;
    font-size: 16px;
}

.clear-documents-btn {
    background: none;
    border: none;
    color: #8d8d8d;
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-documents-btn:hover {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.document-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.document-preview-item {
    position: relative;
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
    transition: all 0.3s ease;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-preview-item:hover {
    border-color: #6c5ce7;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
    transform: translateY(-2px);
}

.document-preview-item .document-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6c5ce7 0%, #5a4fcf 100%);
    border-radius: 8px;
    color: white;
    font-size: 18px;
    margin: 0 auto 8px;
}

.document-preview-item .document-info {
    text-align: center;
}

.document-preview-item .document-name {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    word-break: break-word;
    line-height: 1.3;
}

.document-preview-item .document-size {
    color: #8d8d8d;
    font-size: 10px;
}

.document-preview-item .document-stats {
    color: #8d8d8d;
    font-size: 10px;
    margin-top: 2px;
}

.document-preview-item .remove-document-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(231, 76, 60, 0.8);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 10px;
    transition: all 0.2s;
    opacity: 0;
}

.document-preview-item:hover .remove-document-btn {
    opacity: 1;
}

.document-preview-item .remove-document-btn:hover {
    background-color: rgba(231, 76, 60, 0.9);
    transform: scale(1.1);
}

/* Image Upload Loading States */
.image-preview-item.uploading {
    border-color: #f39c12;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.image-preview-item.uploading .image-info {
    background: linear-gradient(180deg, transparent 0%, rgba(243, 156, 18, 0.8) 100%);
}

.image-preview-item.uploaded {
    border-color: #27ae60;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.image-preview-item.uploaded .image-info {
    background: linear-gradient(180deg, transparent 0%, rgba(39, 174, 96, 0.8) 100%);
}

.image-preview-item.error {
    border-color: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.image-preview-item.error .image-info {
    background: linear-gradient(180deg, transparent 0%, rgba(231, 76, 60, 0.8) 100%);
}

/* Document Upload Loading States */
.document-preview-item.uploading {
    border-color: #f39c12;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.document-preview-item.uploading .document-icon {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.document-preview-item.uploaded {
    border-color: #27ae60;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.document-preview-item.uploaded .document-icon {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.document-preview-item.error {
    border-color: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.document-preview-item.error .document-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Document Upload Status Icons */
.document-upload-status-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.document-preview-item.uploading .document-upload-status-icon {
    background: #f39c12;
    color: white;
    opacity: 1;
}

.document-preview-item.uploaded .document-upload-status-icon {
    background: #27ae60;
    color: white;
    opacity: 1;
}

.document-preview-item.error .document-upload-status-icon {
    background: #e74c3c;
    color: white;
    opacity: 1;
}

/* Upload Progress Overlay */
.upload-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-item.uploading .upload-progress-overlay {
    opacity: 1;
}

.simple-upload-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
}

.simple-upload-indicator i {
    font-size: 16px;
    color: #f39c12;
}

.simple-upload-indicator span {
    font-size: 10px;
    text-align: center;
}

/* Upload Status Icons */
.upload-status-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-item.uploading .upload-status-icon {
    background: #f39c12;
    color: white;
    opacity: 1;
}

.image-preview-item.uploaded .upload-status-icon {
    background: #27ae60;
    color: white;
    opacity: 1;
}

.image-preview-item.error .upload-status-icon {
    background: #e74c3c;
    color: white;
    opacity: 1;
}

/* Send Button Disabled State for Uploads */
.send-btn.upload-pending {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 50%, #6c7b7d 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.send-btn.upload-pending:hover {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 50%, #6c7b7d 100%);
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Upload Progress Summary */
.upload-progress-summary {
    display: none;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 50%, #d35400 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.upload-progress-summary.active {
    display: block;
    animation: upload-pulse 2s infinite ease-in-out;
}

@keyframes upload-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* File upload drag and drop styles */
.input-wrapper.drag-over {
    transform: translateY(-3px) scale(1.02);
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 50%, #2a2a2a 100%);
    box-shadow:
        0 16px 48px rgba(108, 92, 231, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.input-wrapper.drag-over::before {
    background: linear-gradient(135deg, #6c5ce7 0%, #5a4fcf 50%, #6c5ce7 100%);
    animation: drag-glow 1.5s ease-in-out infinite alternate;
}

@keyframes drag-glow {
    0% {
        opacity: 0.8;
        background: linear-gradient(135deg, #6c5ce7 0%, #5a4fcf 50%, #6c5ce7 100%);
    }
    100% {
        opacity: 1;
        background: linear-gradient(135deg, #5a4fcf 0%, #6c5ce7 50%, #5a4fcf 100%);
    }
}

/* Document Analysis Display Styles */
.document-analysis-display {
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    font-size: 12px;
}

.document-analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #6c5ce7;
    margin-bottom: 8px;
}

.document-analysis-header i {
    font-size: 14px;
}

.document-analysis-list {
    color: #b3b3b3;
    line-height: 1.4;
    font-size: 11px;
}

.document-analysis-list strong {
    color: #ffffff;
}

/* Deep Research Table Styles */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
}

.message-content table th {
    background: rgba(108, 92, 231, 0.2);
    color: #ffffff;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(108, 92, 231, 0.3);
}

.message-content table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    vertical-align: top;
}

.message-content table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.message-content table tr:hover {
    background: rgba(108, 92, 231, 0.1);
}

/* Research metadata styling */
.message-content p:has(strong:contains("Research Metadata")) {
    background: rgba(108, 92, 231, 0.05);
    border-left: 4px solid #6c5ce7;
    padding: 12px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
    font-size: 12px;
}

/* Image Display in Chat Messages */
.message-images {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-width: 600px;
}

/* Image-only message styling */
.image-only-message {
    margin-top: 8px;
    margin-bottom: 16px;
}

.image-only-message .message-images {
    margin-top: 0;
}

.message-image-container {
    position: relative;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
    transition: all 0.3s ease;
    cursor: pointer;
}

.message-image-container:hover {
    border-color: #1de8e7;
    box-shadow: 0 8px 24px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.message-image-container img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: contain;
    display: block;
    background: #000000;
}

.message-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
    padding: 12px;
    color: #ffffff;
}

.message-image-name {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-image-size {
    font-size: 11px;
    color: #888888;
}

/* Image Analysis Results */
.image-analysis-results {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #1a3a3a 0%, #1a2a2a 100%);
    border-radius: 12px;
    border: 1px solid #2a4a4a;
    border-left: 4px solid #1de8e7;
}

.image-analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1de8e7;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.image-analysis-header i {
    font-size: 16px;
}

.image-analysis-content {
    color: #ffffff;
    line-height: 1.6;
}

.image-analysis-content h3 {
    color: #1de8e7;
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 16px;
}

.image-analysis-content h3:first-child {
    margin-top: 0;
}

.image-analysis-content ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.image-analysis-content li {
    margin-bottom: 4px;
}

/* Image Modal for Full View */
.image-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.show .image-modal-content {
    transform: scale(1) translateY(0);
}

.image-modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
}

.image-modal-close:hover {
    color: #1de8e7;
    transform: scale(1.1);
}

/* File type indicator */
.file-type-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #1de8e7 0%, #00CCCC 100%);
    color: #1a1a1a;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 255, 255, 0.3);
    display: none;
}

.upload-btn.has-files .file-type-indicator {
    display: block;
}



.input-footer {
    text-align: center;
    margin-top: 12px;
}

.input-footer small {
    color: #8d8d8d;
    font-size: 12px;
}

/* Responsive Design */

/* Medium screens and tablets - Make sidebar collapsible */
@media (max-width: 1200px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .sidebar {
        position: fixed;
        top: 60px; /* Add top offset to avoid header overlap */
        left: 0;
        height: calc(100vh - 60px); /* Adjust height to account for header */
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 320px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .main-content.sidebar-hidden {
        margin-left: 0;
    }

    .header {
        padding: 12px 16px;
        position: relative;
        z-index: 101; /* Higher than sidebar to keep toggle button accessible */
    }

    .sidebar-toggle {
        display: flex; /* Show the toggle button */
        position: relative;
        z-index: 102; /* Ensure toggle button is always on top */
    }
}

/* Large tablets only */
@media (max-width: 900px) {
    .sidebar {
        width: 280px;
    }

    .message {
        max-width: 100%;
        padding: 0 16px;
    }

    .input-container {
        padding: 24px 16px;
    }

    .input-wrapper {
        max-width: 100%;
        padding: 16px 20px;
        gap: 12px;
    }

    /* Image preview responsive styles */
    .image-preview-container {
        margin: 0 auto 12px auto;
        padding: 12px;
    }

    .image-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
        max-height: 200px;
    }

    .message-images {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .message-image-container img {
        max-height: 300px;
    }

    .image-modal-content {
        width: 95%;
        height: 95%;
        padding: 10px;
    }

    .image-modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .header {
        padding: 16px 20px;
    }

    .chat-container {
        padding: 20px 16px;
    }


}

/* Mobile devices - Collapsible sidebar */
@media (max-width: 768px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        /* Improve performance */
        will-change: opacity;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: var(--app-height);
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        /* Ensure sidebar doesn't get cut off */
        max-height: var(--app-height);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Improve performance for animations */
        will-change: transform;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }

    .main-content.sidebar-hidden {
        margin-left: 0;
    }

    .header {
        padding: 12px 16px;
    }

    .app-title {
        font-size: 16px;
    }

    .header-actions {
        gap: 6px;
    }





    .example-prompts {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .prompt-card {
        padding: 16px;
        font-size: 13px;
    }

    .welcome-message {
        padding: 30px 16px;
        max-width: 100%;
    }

    .welcome-message h2 {
        font-size: 24px;
    }

    .welcome-message p {
        font-size: 16px;
    }

    .message {
        gap: 12px;
        margin-bottom: 20px;
    }

    .message-content {
        font-size: 15px;
        line-height: 1.6;
    }

    .input-container {
        padding: 20px 16px;
    }

    .input-wrapper {
        padding: 14px 16px;
        gap: 10px;
        border-radius: 24px;
    }

    #messageInput {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 6px;
    }

    .send-btn, .upload-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

/* Large mobile phones */
@media (max-width: 640px) {
    .header {
        padding: 10px 12px;
    }

    .sidebar {
        width: 260px;
    }

    .chat-container {
        padding: 16px 12px;
    }



    .message {
        gap: 10px;
        margin-bottom: 16px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .user-message .message-content {
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 14px;
    }

    .ai-message .message-content {
        font-size: 14px;
    }

    .input-container {
        padding: 16px 12px;
    }

    .input-wrapper {
        padding: 12px 14px;
        gap: 8px;
        border-radius: 20px;
    }

    #messageInput {
        font-size: 16px;
        padding: 8px 4px;
        min-height: 28px;
    }

    .send-btn, .upload-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .welcome-message {
        padding: 24px 12px;
    }

    .welcome-message h2 {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .welcome-message p {
        font-size: 15px;
        margin-bottom: 30px;
    }



    .example-prompts {
        gap: 10px;
        margin-top: 24px;
    }

    .prompt-card {
        padding: 14px;
        font-size: 12px;
    }

    .prompt-card i {
        font-size: 16px;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6d6d6d;
}

/* AI Thinking Animation */
.ai-thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

/* Enhanced Brain Icon Container */
.agent-brain-container {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.agent-brain-icon {
    font-size: 18px;
    color: #ffffff;
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
}

.agent-brain-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.agent-brain-overlay i {
    font-size: 18px;
    color: #ffffff;
    opacity: 0.3;
}

/* Agent Brain Container States */
.agent-brain-container.orchestrator {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    animation: brain-pulse-orchestrator 2s infinite ease-in-out;
}

.agent-brain-container.project_manager {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 0 20px rgba(240, 147, 251, 0.4);
    animation: brain-pulse-project 2s infinite ease-in-out;
}

.agent-brain-container.planner {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
    animation: brain-pulse-planner 2s infinite ease-in-out;
}

.agent-brain-container.sales {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    box-shadow: 0 0 20px rgba(67, 233, 123, 0.4);
    animation: brain-pulse-sales 2s infinite ease-in-out;
}

.agent-brain-container.coding {
    background: linear-gradient(135deg, #fa709a, #fee140);
    box-shadow: 0 0 20px rgba(250, 112, 154, 0.4);
    animation: brain-pulse-coding 2s infinite ease-in-out;
}

.agent-brain-container.validation {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    box-shadow: 0 0 20px rgba(168, 237, 234, 0.4);
    animation: brain-pulse-validation 2s infinite ease-in-out;
}

.agent-brain-container.transitioning {
    animation: brain-transition 0.6s ease-in-out;
}



.agent-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #ffffff;
    position: relative;
    transition: all 0.5s ease;
}

.agent-icon.orchestrator {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    animation: agent-pulse-orchestrator 2s infinite ease-in-out;
}

.agent-icon.project_manager {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 0 20px rgba(240, 147, 251, 0.4);
    animation: agent-pulse-project 2s infinite ease-in-out;
}

.agent-icon.planner {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
    animation: agent-pulse-planner 2s infinite ease-in-out;
}

.agent-icon.sales {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    box-shadow: 0 0 20px rgba(67, 233, 123, 0.4);
    animation: agent-pulse-sales 2s infinite ease-in-out;
}

.agent-icon.coding {
    background: linear-gradient(135deg, #fa709a, #fee140);
    box-shadow: 0 0 20px rgba(250, 112, 154, 0.4);
    animation: agent-pulse-coding 2s infinite ease-in-out;
}

.agent-icon.validation {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    box-shadow: 0 0 20px rgba(168, 237, 234, 0.4);
    animation: agent-pulse-validation 2s infinite ease-in-out;
}

.agent-icon.project_manager {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 0 20px rgba(240, 147, 251, 0.4);
}

.agent-icon.planner {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
}

.agent-icon.sales {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    box-shadow: 0 0 20px rgba(67, 233, 123, 0.4);
}

.agent-icon.coding {
    background: linear-gradient(135deg, #fa709a, #fee140);
    box-shadow: 0 0 20px rgba(250, 112, 154, 0.4);
}

.agent-icon.validation {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    box-shadow: 0 0 20px rgba(168, 237, 234, 0.4);
}

.agent-name {
    font-size: 12px;
    font-weight: 600;
    color: #1de8e7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: agent-text-glow 2s infinite ease-in-out;
    transition: opacity 0.3s ease;
}

.agent-status {
    font-size: 11px;
    color: #b3b3b3;
    font-style: italic;
    transition: opacity 0.3s ease;
}

/* Brain Pulse Animations for Each Agent */
@keyframes brain-pulse-orchestrator {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
    }
}

@keyframes brain-pulse-project {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(240, 147, 251, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(240, 147, 251, 0.6);
    }
}

@keyframes brain-pulse-planner {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(79, 172, 254, 0.6);
    }
}

@keyframes brain-pulse-sales {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(67, 233, 123, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(67, 233, 123, 0.6);
    }
}

@keyframes brain-pulse-coding {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(250, 112, 154, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(250, 112, 154, 0.6);
    }
}

@keyframes brain-pulse-validation {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(168, 237, 234, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(168, 237, 234, 0.6);
    }
}

@keyframes brain-transition {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(0.8) rotate(180deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* Agent Icon Pulse Animations */
@keyframes agent-pulse-orchestrator {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
    }
}

@keyframes agent-pulse-project {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(240, 147, 251, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(240, 147, 251, 0.6);
    }
}

@keyframes agent-pulse-planner {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(79, 172, 254, 0.6);
    }
}

@keyframes agent-pulse-sales {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(67, 233, 123, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(67, 233, 123, 0.6);
    }
}

@keyframes agent-pulse-coding {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(250, 112, 154, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(250, 112, 154, 0.6);
    }
}

@keyframes agent-pulse-validation {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(168, 237, 234, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(168, 237, 234, 0.6);
    }
}

@keyframes agent-text-glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    }
    50% {
        text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    }
}

/* Agent transition animation */
.agent-icon.transitioning {
    animation: agent-transition 0.6s ease-in-out;
}

@keyframes agent-transition {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(0.8) rotate(180deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

@keyframes agent-transition {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(0.8) rotate(90deg);
        opacity: 0.7;
    }
    50% {
        transform: scale(0.6) rotate(180deg);
        opacity: 0.3;
    }
    75% {
        transform: scale(0.8) rotate(270deg);
        opacity: 0.7;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

.neural-pulse {
    width: 40px;
    height: 14px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.neural-pulse::before,
.neural-pulse::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    animation: neural-pulse 2s infinite ease-in-out;
    position: relative;
    top: 0;
}

.neural-pulse::before {
    animation-delay: 0s;
}

.neural-pulse::after {
    animation-delay: 0.5s;
}

.thinking-text {
    color: #a0a0a0;
    font-size: 14px;
    font-style: italic;
    animation: fade-pulse 2s infinite ease-in-out;
    line-height: 14px;
    margin: 0;
    padding: 0;
    position: relative;
    transition: all 0.3s ease;
}

/* Enhanced thinking text with loading indicator */
.thinking-text::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #a0a0a0;
    margin-left: 8px;
    animation: thinking-pulse 1.5s infinite ease-in-out;
    opacity: 0.7;
}

/* Different states for thinking text */
.thinking-text.searching::after {
    content: '';
    width: 8px;
    height: 8px;
    border: 1px solid #a0a0a0;
    border-top: 1px solid transparent;
    border-radius: 50%;
    animation: search-spin 1s linear infinite;
    background: transparent;
}

.thinking-text.progress::after {
    content: '';
    width: 12px;
    height: 2px;
    border-radius: 1px;
    background: linear-gradient(90deg, #a0a0a0 0%, transparent 100%);
    animation: progress-bar 2s infinite ease-in-out;
    margin-left: 6px;
}

.thinking-text.deep-research::after {
    content: '🔬';
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    background: transparent;
    animation: deep-research-pulse 2s infinite ease-in-out;
    font-size: 12px;
    margin-left: 4px;
}

/* Keyframes for thinking pulse */
@keyframes thinking-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Keyframes for search spinner */
@keyframes search-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Keyframes for progress bar */
@keyframes progress-bar {
    0% {
        width: 4px;
        opacity: 0.3;
    }
    50% {
        width: 16px;
        opacity: 1;
    }
    100% {
        width: 4px;
        opacity: 0.3;
    }
}

/* Keyframes for deep research pulse */
@keyframes deep-research-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes neural-pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

@keyframes fade-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}



/* Loading Stage Indicator */
.loading-stage-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.loading-stage-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1de8e7;
    animation: stage-pulse 1.5s infinite ease-in-out;
}

@keyframes stage-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Enhanced Progress Text */
.progress-text {
    color: #1de8e7;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    animation: text-glow 2s infinite ease-in-out;
    position: relative;
    z-index: 2;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.progress-text.updating {
    animation: text-update 0.5s ease-in-out;
}

@keyframes text-glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
        opacity: 0.9;
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
        opacity: 1;
    }
}

@keyframes text-update {
    0% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.6; transform: translateY(-3px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Enhanced Agent Pills Container */
.agent-pills-container {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 0;
    border-top: 1px solid rgba(0, 255, 255, 0.1);
    justify-content: flex-start;
    align-items: center;
    position: relative;
    z-index: 2;
}

.agent-pills-container.active {
    display: flex;
    animation: pills-container-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pills-container-appear {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Agent Pills */
.agent-pills-container .agent-pill {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.06) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(0) scale(1);
}

.agent-pills-container .agent-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%);
    transition: left 0.6s ease;
    z-index: 1;
}

.agent-pills-container .agent-pill:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Agent Status Indicator */
.agent-status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    margin-left: auto;
    transition: all 0.3s ease;
}

.agent-pill.executing .agent-status-indicator {
    background: #1de8e7;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    animation: status-pulse 1.5s infinite ease-in-out;
}

.agent-pill.completed .agent-status-indicator {
    background: #00FF88;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.6);
}

@keyframes status-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Enhanced Executing State */
.agent-pills-container .agent-pill.executing {
    background: linear-gradient(135deg,
        rgba(0, 255, 255, 0.25) 0%,
        rgba(0, 255, 255, 0.15) 100%);
    border-color: rgba(0, 255, 255, 0.6);
    color: #1de8e7;
    animation: pill-executing-enhanced 2s infinite ease-in-out;
    box-shadow:
        0 0 15px rgba(0, 255, 255, 0.4),
        0 4px 12px rgba(0, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    font-weight: 700;
}

.agent-pills-container .agent-pill.executing::before {
    animation: pill-shimmer-enhanced 1.5s infinite ease-in-out;
}

@keyframes pill-executing-enhanced {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(0, 255, 255, 0.4),
            0 4px 12px rgba(0, 255, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        transform: translateY(0) scale(1);
    }
    50% {
        box-shadow:
            0 0 25px rgba(0, 255, 255, 0.6),
            0 6px 16px rgba(0, 255, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
        transform: translateY(-1px) scale(1.02);
    }
}

@keyframes pill-shimmer-enhanced {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Remove animations when pill is in selected state */
.agent-pills-container .agent-pill.executing.selected {
    animation: none;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

/* Enhanced Completed State */
.agent-pills-container .agent-pill.completed {
    background: linear-gradient(135deg,
        rgba(0, 255, 0, 0.2) 0%,
        rgba(0, 255, 0, 0.1) 100%);
    border-color: rgba(0, 255, 0, 0.5);
    color: #00FF88;
    box-shadow:
        0 0 12px rgba(0, 255, 0, 0.3),
        0 2px 8px rgba(0, 255, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
    font-weight: 700;
    animation: pill-completed-glow 3s ease-in-out;
}

@keyframes pill-completed-glow {
    0% {
        box-shadow:
            0 0 12px rgba(0, 255, 0, 0.3),
            0 2px 8px rgba(0, 255, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 0 20px rgba(0, 255, 0, 0.5),
            0 4px 12px rgba(0, 255, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    100% {
        box-shadow:
            0 0 12px rgba(0, 255, 0, 0.3),
            0 2px 8px rgba(0, 255, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

.agent-pills-container .agent-pill.completed::after {
    content: '✓';
    margin-left: 3px;
    font-size: 8px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.3) rotate(-10deg);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s,
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}

.agent-pills-container .agent-pill.completed.show-checkmark::after {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

@keyframes pill-executing {
    0%, 100% {
        box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
    }
}

/* Smooth state transition for newly created pills */
.agent-pills-container .agent-pill.new-pill {
    opacity: 0;
    transform: translateY(15px) scale(0.8);
    animation: pillFadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

.agent-pills-container .agent-pill.state-transition {
    transition: background-color 1.0s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 1.0s cubic-bezier(0.4, 0, 0.2, 1),
                color 1.0s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 1.0s cubic-bezier(0.4, 0, 0.2, 1),
                font-weight 0.5s ease;
}

/* Prevent jumping when new-pill class is removed from container pills */
.agent-pills-container .agent-pill:not(.new-pill) {
    transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                font-weight 0.4s ease,
                transform 0.1s ease-out,
                opacity 0.1s ease-out;
}

.other-agents-thinking {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.other-agent-item {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    font-weight: 400;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.other-agent-item:last-child {
    margin-bottom: 0;
}

.other-agent-dots {
    display: flex;
    gap: 2px;
}

.other-agent-dots span {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    animation: thinking-dots 1.4s infinite ease-in-out;
}

.other-agent-dots span:nth-child(1) {
    animation-delay: 0s;
}

.other-agent-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.other-agent-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Temporary Agent Response Display */
.temporary-agent-response {
    background: rgb(31, 31, 31);  /* Purple background */
    border: 1px solid rgb(255, 255, 255);  /* Purple border */
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    backdrop-filter: blur(5px);
    animation: slideInFromTop 0.3s ease-out;
    transition: opacity 0.3s ease-in-out;
}

.temporary-agent-response.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.agent-response-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agent-name {
    color: #0099ffe1;  /* Purple agent name */
    font-size: 14px;
    font-weight: 600;
}

.agent-task {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-style: italic;
}

.agent-timestamp {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
}

/* Agent Pills Container */
.agent-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.agent-pill {
    background: linear-gradient(135deg, rgba(0, 153, 255, 0.2), rgba(0, 153, 255, 0.1));
    border: 1px solid rgba(0, 153, 255, 0.3);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #0099ff;
    backdrop-filter: blur(5px);
    /* Remove conflicting animation and transition properties */
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                font-weight 0.4s ease;
}

.agent-pill:hover {
    background: linear-gradient(135deg, rgba(0, 153, 255, 0.3), rgba(0, 153, 255, 0.2));
    border-color: rgba(0, 153, 255, 0.5);
}

@keyframes pillFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.8);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.agent-response-content {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    line-height: 1.4;
    word-wrap: break-word;
}

.animated-text span {
    display: inline;
    opacity: 0;
    transition: opacity 0.7s ease-in;
}

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

/* Discussion Status Text */
.status-text {
    color: #1de8e7;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.2);
    margin-bottom: 12px;
    transition: all 0.5s ease;
    animation: status-glow 2s infinite ease-in-out;
    backdrop-filter: blur(5px);
}

@keyframes status-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
        transform: scale(1.02);
    }
}

/* Enhanced Progress Bar Container */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin: 8px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%);
    animation: container-pulse 2s infinite ease-in-out;
}

/* Enhanced Progress Bar */
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg,
        #1de8e7 0%,
        #00BFFF 25%,
        #FF00FF 50%,
        #FF69B4 75%,
        #1de8e7 100%);
    background-size: 300% 100%;
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progress-flow 3s infinite linear;
    position: relative;
    box-shadow:
        0 0 15px rgba(0, 255, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 100%);
    border-radius: 0 6px 6px 0;
    animation: progress-highlight 1.5s infinite ease-in-out;
}

@keyframes container-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

@keyframes progress-flow {
    0% { background-position: 0% 0%; }
    100% { background-position: 300% 0%; }
}

@keyframes progress-highlight {
    0%, 100% { opacity: 0; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(-5px); }
}

@keyframes agent-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@keyframes progress-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Simplified typing cursor - no gradient effects */
.message-content.typing::after {
    display: none; /* Remove the gradient cursor completely */
}

/* Remove all dynamic cursor styles */
.message-content.typing.cursor-style-1::after,
.message-content.typing.cursor-style-2::after,
.message-content.typing.cursor-style-3::after {
    display: none; /* Remove all gradient cursor variants */
}

/* Cursor animations removed - no longer needed */

/* Text shimmer animation removed - no longer needed */

/* Enhanced text effects for cinematic typing */
.message-content.typing {
    position: relative;
    overflow: hidden;
}

/* Shimmer wave effect disabled */
.message-content.typing::before {
    display: none;
}

@keyframes typing-shimmer {
    /* Animation disabled */
    0%, 100% {
        opacity: 0;
    }
}

/* Word fade-in effect for newly typed words (legacy - now using char-based) */
.message-content.typing .word-fade-in {
    animation: word-appear 0.3s ease-out;
    /* Ensure text selection works on animated spans */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

@keyframes word-appear {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.9);
        filter: blur(1px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(4px) scale(1.05);
        filter: blur(0.5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Character fade-in effect for character-by-character typing (ultra fast) */
.message-content.typing .char-fade-in {
    animation: char-appear 0.02s ease-out;
    /* Ensure text selection works on animated spans */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

@keyframes char-appear {
    0% {
        opacity: 0;
        transform: translateY(2px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Gradient text effect for special use cases (currently disabled for regular typing) */
.gradient-text {
    background: linear-gradient(45deg, #1de8e7, #FF00FF, #FFFF00);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: gradient-flow 2s ease-in-out infinite;
}

@keyframes gradient-flow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* API Setup Notification */
.api-setup-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1de8e7, #00CCCC);
    color: #ffffff;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 16px;
}

.notification-content i.fa-info-circle {
    font-size: 24px;
    color: #ffffff;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
}

.notification-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.notification-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.notification-text a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 500;
}

.notification-text a:hover {
    text-decoration: none;
}

.notification-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.notification-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}



/* Landing Page Styles */
.landing-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--app-height);
    min-height: var(--app-height);
    background: #212121;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    /* Improve touch scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    /* Prevent bounce scrolling on iOS */
    overscroll-behavior: none;
    /* Optimize for GPU acceleration */
    will-change: transform, opacity;
    /* Ensure proper stacking context */
    isolation: isolate;
    /* Prevent scrollbar from affecting layout */
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.landing-container.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    pointer-events: none;
}

.landing-container.fade-in {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.landing-background {
    min-height: var(--app-height);
    background: transparent;
    position: relative;
    /* Optimize rendering performance */
    contain: layout style paint;
}

/* Navigation */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(33, 33, 33, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #2d2d2d;
    padding: 16px 0;
    /* Account for safe areas on mobile devices */
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.nav-logo i {
    font-size: 24px;
    color: #1de8e7;
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.secondary {
    background: transparent;
    color: #ffffff;
    border: 1px solid #2d2d2d;
}

.nav-btn.secondary:hover {
    background: #2d2d2d;
    border-color: #1de8e7;
}

.nav-btn.primary {
    background: #1de8e7;
    color: #000000;
    border: none;
}

.nav-btn.primary:hover {
    background: #33D9FF;
    transform: translateY(-1px);
}

/* Hero Section */
.hero-section {
    padding: 120px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    min-height: calc(var(--app-height) - 200px);
    /* Account for safe areas on mobile devices */
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
    /* Optimize rendering performance */
    contain: layout style;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: slideInFromLeft 0.8s ease-out;
    /* Optimize for animations */
    will-change: transform;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 20px;
    color: #1de8e7;
    font-size: 14px;
    font-weight: 600;
    width: fit-content;
}

.hero-title {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    color: #ffffff;
    margin: 0;
}

.gradient-text {
    background: linear-gradient(135deg, #1de8e7 0%, #33D9FF 50%, #66E6FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 18px;
    line-height: 1.6;
    color: #b3b3b3;
    margin: 0;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.cta-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    /* Improve button performance */
    will-change: transform, background-color;
    /* Ensure proper touch targets */
    min-height: 44px;
    min-width: 44px;
}

.cta-btn.primary {
    background: #1de8e7;
    color: #000000;
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.3);
}

.cta-btn.primary:hover {
    background: #33D9FF;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 255, 0.4);
}

.cta-btn.secondary {
    background: transparent;
    color: #ffffff;
    border: 1px solid #2d2d2d;
}

.cta-btn.secondary:hover {
    background: #2d2d2d;
    border-color: #1de8e7;
}

.cta-btn.large {
    padding: 18px 36px;
    font-size: 18px;
}

/* Hero Visual */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideInFromRight 0.8s ease-out 0.2s both;
}

.chat-preview {
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 700px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    /* Optimize for animations and transforms */
    will-change: transform;
    /* Improve rendering performance */
    contain: layout style paint;
    /* Add visual depth */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-bubble.user {
    background: #2d2d2d;
    color: #ffffff;
    margin-left: 20%;
    text-align: right;
}

.chat-bubble.ai {
    background: transparent;
    color: #ffffff;
    margin-right: 20%;
    border: 1px solid #2d2d2d;
}





/* Enhanced animations for demo chat bubbles */
#chatPreviewDemo .chat-bubble {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Initial hidden state for demo elements - allows JavaScript control */
#chatPreviewDemo .chat-bubble {
    opacity: 0;
    transform: translateY(20px);
}

/* Initial state for user bubble */
#chatPreviewDemo .chat-bubble.user {
    transform: translateY(30px) scale(0.95);
}

/* Initial state for AI bubble */
#chatPreviewDemo .chat-bubble.ai {
    transform: translateY(30px) scale(0.95);
}

/* Class to ensure elements stay hidden until animation starts */
#chatPreviewDemo.demo-loading .chat-bubble {
    opacity: 0 !important;
    transform: translateY(20px) !important;
}

#chatPreviewDemo.demo-loading .chat-bubble.user {
    transform: translateY(30px) scale(0.95) !important;
}

#chatPreviewDemo.demo-loading .chat-bubble.ai {
    transform: translateY(30px) scale(0.95) !important;
}

/* Animations will be controlled by JavaScript to prevent flash */
/*
#chatPreviewDemo .chat-bubble.user {
    animation: fadeInSlideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#chatPreviewDemo .chat-bubble.ai {
    animation: fadeInSlideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
*/

@keyframes fadeInSlideUp {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.response-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #4ade80;
}

.response-header i {
    font-size: 12px;
}

/* Features Section */
.features-section {
    padding: 80px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.features-content {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.section-header h2 {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 16px 0;
}

.section-header p {
    font-size: 18px;
    color: #b3b3b3;
    line-height: 1.6;
    margin: 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    /* Optimize grid performance */
    contain: layout;
}

.feature-card {
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    /* Optimize for hover animations */
    will-change: transform, box-shadow;
    /* Improve rendering performance */
    contain: layout style paint;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: #1de8e7;
    box-shadow: 0 8px 32px rgba(0, 255, 255, 0.1);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: #1de8e7;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #000000;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 12px 0;
}

.feature-card p {
    font-size: 14px;
    color: #b3b3b3;
    line-height: 1.6;
    margin: 0;
}

/* CTA Section */
.cta-section {
    padding: 80px 24px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.cta-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.cta-content h2 {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.cta-content p {
    font-size: 18px;
    color: #b3b3b3;
    line-height: 1.6;
    margin: 0;
    max-width: 500px;
}

.cta-actions {
    margin: 16px 0;
}

.cta-features {
    display: flex;
    gap: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b3b3b3;
    font-size: 14px;
}

.cta-feature i {
    color: #1de8e7;
    font-size: 16px;
}

/* Creator Section */
.creator-section {
    padding: 80px 24px;
    max-width: 1200px;
    margin: 0 auto;
    background: #171717;
    border-radius: 20px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.creator-content {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.creator-info {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 48px;
    align-items: start;
}

.creator-image {
    display: flex;
    justify-content: center;
}

.creator-photo {
    width: 250px;
    height: 320px;
    border-radius: 16px;
    object-fit: cover;
    border: 4px solid #1de8e7;
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3);
}

.creator-details {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.creator-story h3 {
    font-size: 24px;
    font-weight: 600;
    color: #1de8e7;
    margin: 0 0 12px 0;
}

.creator-story p {
    font-size: 16px;
    color: #b3b3b3;
    line-height: 1.7;
    margin: 0 0 24px 0;
}

.creator-story p:last-child {
    margin-bottom: 0;
}

/* Mobile Viewport Fixes for Landing Page */
@media (max-width: 768px) {
    .landing-container {
        height: var(--app-height);
        min-height: var(--app-height);
        /* Ensure proper mobile viewport handling */
        position: fixed;
        width: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
        /* Optimize for mobile performance */
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    .landing-background {
        min-height: var(--app-height);
        /* Account for mobile browser UI changes */
        padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    }

    .landing-nav {
        /* Enhanced mobile safe area support */
        padding-top: max(20px, calc(16px + env(safe-area-inset-top, 0px)));
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        /* Ensure nav background extends to edges */
        margin-left: calc(-1 * env(safe-area-inset-left, 0px));
        margin-right: calc(-1 * env(safe-area-inset-right, 0px));
        margin-top: calc(-1 * env(safe-area-inset-top, 0px));
    }
}

/* Responsive Design for Landing Page */
@media (max-width: 768px) {
    .nav-content {
        padding: 0 16px;
    }

    .nav-logo span {
        display: none;
    }

    .hero-section {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 100px 16px 60px;
        text-align: center;
        /* Enhanced mobile viewport support */
        min-height: calc(var(--app-height) - 80px);
        /* Account for safe areas */
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-description {
        font-size: 16px;
    }

    .hero-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .features-section {
        padding: 60px 16px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .feature-card {
        padding: 24px 20px;
    }

    .section-header h2 {
        font-size: 28px;
    }

    .cta-section {
        padding: 60px 16px;
    }

    .cta-content h2 {
        font-size: 28px;
    }

    .cta-features {
        gap: 20px;
        flex-direction: column;
        align-items: center;
    }

    .creator-section {
        padding: 60px 16px;
        margin: 20px 16px;
    }

    .creator-info {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }

    .creator-photo {
        width: 200px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .landing-container {
        /* Enhanced small screen support */
        height: var(--app-height);
        min-height: var(--app-height);
    }

    .landing-nav {
        /* Optimized for small screens */
        padding-top: max(16px, calc(12px + env(safe-area-inset-top, 0px)));
        padding-bottom: 12px;
    }

    .nav-actions {
        gap: 8px;
    }

    .nav-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .hero-section {
        padding: 80px 16px 40px;
        /* Optimized viewport height for small screens */
        min-height: calc(var(--app-height) - 120px);
        /* Enhanced safe area support */
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        padding-bottom: max(40px, env(safe-area-inset-bottom, 0px));
    }

    .hero-title {
        font-size: 28px;
        line-height: 1.2;
    }

    .hero-description {
        font-size: 15px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .cta-btn {
        padding: 12px 24px;
        font-size: 14px;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .cta-btn.large {
        padding: 16px 32px;
        font-size: 16px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .feature-card {
        padding: 20px 16px;
    }

    .chat-preview {
        max-width: 450px;
        padding: 20px;
    }

    .response-header {
        font-size: 11px;
    }

    .back-to-landing-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .creator-section {
        padding: 40px 16px;
        margin: 16px;
    }

    .creator-photo {
        width: 180px;
        height: 230px;
    }

    .creator-story h3 {
        font-size: 20px;
    }

    .creator-story p {
        font-size: 15px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Authentication Styles */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #212121;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.auth-container.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

.auth-container.fade-in {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-background {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.auth-card {
    background: #171717;
    backdrop-filter: blur(20px);
    border: 1px solid #2d2d2d;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.4), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

.auth-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(0, 255, 255, 0.1) 50%,
        transparent 70%);
    border-radius: 22px;
    z-index: -1;
    opacity: 0;
    animation: borderGlow 4s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes borderGlow {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.3; }
}

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

.auth-header {
    text-align: left;
    margin-bottom: 30px;
    position: relative;
}

.back-to-landing-btn {
    background: transparent;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    color: #ffffff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.back-to-landing-btn:hover {
    background: #2d2d2d;
    border-color: #1de8e7;
    color: #1de8e7;
    transform: translateX(-2px);
}

.auth-title {
    text-align: center;
    margin-bottom: 32px;
}

.auth-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: -0.5px;
}

/* Removed auth-logo styles - no longer needed */

/* Removed auth-tabs styles - no longer needed */

.auth-form {
    display: block;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    color: #f0f0f0;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.form-group input {
    width: 100%;
    background:
        linear-gradient(145deg, rgba(12, 12, 12, 0.9) 0%, rgba(8, 8, 8, 0.9) 100%);
    border: 1px solid rgba(64, 224, 255, 0.2);
    border-radius: 12px;
    padding: 16px 20px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-group input:focus {
    outline: none;
    border-color: #40E0FF;
    background:
        linear-gradient(145deg, rgba(15, 15, 15, 0.95) 0%, rgba(10, 10, 10, 0.95) 100%);
    box-shadow:
        0 0 0 3px rgba(64, 224, 255, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(64, 224, 255, 0.1);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: #666666;
    font-weight: 400;
    transition: color 0.3s ease;
}

.form-group input:hover {
    border-color: rgba(64, 224, 255, 0.3);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(64, 224, 255, 0.05);
}

.form-group input:hover::placeholder {
    color: #888888;
}

/* Add a subtle focus-within effect for the form group */
.form-group:focus-within label {
    color: #40E0FF;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* Password input wrapper */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: #40E0FF;
}

.password-toggle:focus {
    outline: none;
    color: #40E0FF;
}

.auth-btn {
    width: 100%;
    background: #1de8e7;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    color: #000000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(64, 224, 255, 0.3);
    z-index: 1;
}

/* Ensure text content is above pseudo-elements */
.auth-btn > *,
.auth-btn i,
.auth-btn span {
    position: relative;
    z-index: 2;
}

/* Ensure all button text is visible */
.auth-btn,
.auth-tab {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
    z-index: 1;
}

.auth-btn:hover::before {
    left: 100%;
}

.auth-btn:hover {
    background: #33D9FF;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.4);
}

.auth-btn:focus {
    outline: none;
    background: #33D9FF;
    color: #000000;
    box-shadow:
        0 0 0 3px rgba(0, 255, 255, 0.3),
        0 4px 15px rgba(0, 255, 255, 0.3);
}

.auth-btn:active {
    color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

/* Force text visibility across all browsers */
.auth-btn,
.auth-btn:hover,
.auth-btn:focus,
.auth-btn:active {
    color: #000000 !important;
}

.auth-links {
    text-align: center;
}

.forgot-password {
    color: #1de8e7;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.forgot-password::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background: linear-gradient(90deg, #1de8e7, #33D9FF);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.forgot-password:hover {
    color: #33D9FF;
    text-decoration: none;
}

.forgot-password:hover::after {
    width: 100%;
}

/* Auth divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.auth-divider span {
    padding: 0 16px;
    color: #888888;
    font-size: 14px;
    font-weight: 500;
}

/* Auth switch */
.auth-switch {
    text-align: center;
    margin-top: 8px;
}

.auth-switch span {
    color: #888888;
    font-size: 14px;
}

.switch-link {
    color: #1de8e7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.switch-link:hover {
    color: #33D9FF;
    text-decoration: underline;
}

.terms-text {
    color: #999999;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
    font-weight: 400;
}

.auth-footer {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid rgba(64, 224, 255, 0.1);
    text-align: center;
}

.auth-footer .powered-by {
    color: #777777;
}

.auth-footer .powered-by small {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
}

.auth-footer .ai-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #1de8e7;
    font-weight: 500;
}

.auth-footer .ai-branding i {
    font-size: 16px;
}

/* Small mobile phones */
@media (max-width: 480px) {
    body {
        overflow-x: hidden;
    }

    .header {
        padding: 8px 10px;
        min-height: 50px;
    }

    .app-title {
        font-size: 14px;
        font-weight: 500;
    }

    .sidebar {
        width: 240px;
    }

    .sidebar-header {
        padding: 12px;
    }

    .new-chat-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .chat-container {
        padding: 12px 8px;
    }



    .message {
        gap: 8px;
        margin-bottom: 14px;
    }

    .message-avatar {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .user-message .message-content {
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 13px;
        line-height: 1.5;
    }

    .ai-message .message-content {
        font-size: 13px;
        line-height: 1.5;
    }

    .input-container {
        padding: 12px 8px;
    }

    .input-wrapper {
        padding: 10px 12px;
        gap: 6px;
        border-radius: 18px;
        max-width: 100%;
        margin: 0;
    }

    #messageInput {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 6px 2px;
        min-height: 24px;
        max-height: 120px;
    }

    #messageInput::placeholder {
        font-size: 15px;
    }

    .send-btn, .upload-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .welcome-message {
        padding: 20px 8px;
    }

    .welcome-message h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .welcome-message p {
        font-size: 14px;
        margin-bottom: 24px;
    }



    .example-prompts {
        gap: 8px;
        margin-top: 20px;
    }

    .prompt-card {
        padding: 12px;
        font-size: 11px;
        border-radius: 8px;
    }

    .prompt-card i {
        font-size: 14px;
    }

    /* Improve code blocks on mobile */
    .message-content pre {
        padding: 12px;
        margin: 2px 0;
        border-radius: 6px;
        font-size: 0.8em;
        overflow-x: auto;
    }

    .message-content code {
        font-size: 0.8em; /* Keeping mobile font size slightly smaller */
        padding: 1px 4px; /* Even more compact on mobile for space efficiency */
        border-radius: 3px; /* Slightly smaller radius for mobile */
        line-height: 1.1; /* Tighter line height on mobile */
    }

    /* Better list spacing on mobile */
    .message-content ul,
    .message-content ol {
        padding-left: 30px !important; /* Reduced for mobile */
        margin: 4px 0 16px 0; /* Improved spacing */
    }

    .message-content li {
        margin: 3px 0; /* Normal spacing on mobile */
        font-size: 13px;
        line-height: 1.5; /* Comfortable line height on mobile */
    }

    .message-content p {
        margin: 0 0 14px 0; /* Slightly smaller bottom margin on mobile */
        line-height: 1.4;
    }

    /* Removed: no-bullet mobile styling - all list items should show bullets */

    /* Settings menu mobile optimization */
    .settings-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
    }

    .settings-header {
        padding: 16px 20px;
    }

    .settings-section {
        padding: 20px;
    }

    .settings-actions {
        padding: 16px 20px;
        flex-direction: column;
        gap: 8px;
    }

    .settings-btn {
        width: 100%;
        padding: 12px 20px;
    }
}

/* Responsive Auth Design */
@media (max-width: 480px) {
    .auth-card {
        margin: 16px;
        padding: 32px 24px;
        max-width: none;
        border-radius: 16px;
    }

    .auth-title h1 {
        font-size: 24px;
    }

    .form-group input {
        padding: 14px 18px;
        font-size: 16px;
    }

    .password-input-wrapper input {
        padding-right: 45px;
    }

    .password-toggle {
        right: 14px;
        font-size: 14px;
    }

    .auth-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Enhanced Loading Screen Styles */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    /* Ensure perfect centering by removing any potential margin/padding interference */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Prevent any scrolling issues */
    overflow: hidden;
}

.loading-container.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Initial Loading State - Shows immediately while auth check happens */
.initial-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002; /* Higher than other loading screens */
    opacity: 1;
    visibility: visible;
}

.initial-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.initial-loading-logo {
    font-size: 48px;
    color: #4CAF50;
    animation: pulse 2s ease-in-out infinite;
}

.initial-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.initial-loading.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

/* Additional centering safeguards for all devices */
.loading-container {
    /* Force perfect centering regardless of device */
    min-height: 100vh;
    min-width: 100vw;
}

/* Ensure loading works properly on devices with safe areas */
@supports (padding: max(0px)) {
    .loading-container {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        /* Adjust height to account for safe areas */
        height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
}

.loading-content {
    text-align: center;
    max-width: 500px;
    padding: 60px 40px;
    position: relative;
    /* Ensure content is perfectly centered */
    margin: 0 auto;
    /* Prevent any layout shifts */
    box-sizing: border-box;
    /* Ensure content doesn't overflow */
    width: 100%;
}

.loading-logo {
    margin-bottom: 50px;
    position: relative;
}

.loading-logo i {
    font-size: 80px;
    color: #40E0FF;
    margin-bottom: 24px;
    display: block;
    animation: sophisticated-pulse 3s ease-in-out infinite;
    text-shadow:
        0 0 20px rgba(64, 224, 255, 0.5),
        0 0 40px rgba(64, 224, 255, 0.3),
        0 0 60px rgba(64, 224, 255, 0.1);
    position: relative;
    z-index: 2;
}

.loading-logo h2 {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.loading-spinner {
    margin: 50px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    /* Ensure spinner is perfectly centered */
    width: 100%;
    min-height: 80px;
}

/* Sophisticated Multi-Ring Spinner */
.spinner {
    position: relative;
    width: 80px;
    height: 80px;
    /* Ensure spinner is centered within its container */
    margin: 0 auto;
    flex-shrink: 0;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: sophisticated-spin 2s linear infinite;
    /* Ensure perfect positioning */
    top: 0;
    left: 0;
}

.spinner::before {
    width: 80px;
    height: 80px;
    border: 3px solid transparent;
    border-top: 3px solid #40E0FF;
    border-right: 3px solid #40E0FF;
    animation-duration: 2s;
}

.spinner::after {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border: 2px solid transparent;
    border-bottom: 2px solid #33D9FF;
    border-left: 2px solid #33D9FF;
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.loading-text {
    margin: 40px 0;
}

.loading-text p {
    font-size: 18px;
    color: #cccccc;
    margin: 0;
    font-weight: 500;
    animation: text-glow 2.5s ease-in-out infinite;
    letter-spacing: 0.5px;
}

/* Progress bar styles removed - no longer needed */
.loading-progress {
    display: none;
}













@keyframes thinking-dots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}



/* Enhanced Loading Animations */
@keyframes sophisticated-spin {
    0% {
        transform: rotate(0deg);
        filter: hue-rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
        filter: hue-rotate(360deg);
    }
}

@keyframes sophisticated-pulse {
    0%, 100% {
        transform: scale(1);
        text-shadow:
            0 0 20px rgba(64, 224, 255, 0.5),
            0 0 40px rgba(64, 224, 255, 0.3),
            0 0 60px rgba(64, 224, 255, 0.1);
    }
    50% {
        transform: scale(1.1);
        text-shadow:
            0 0 30px rgba(64, 224, 255, 0.8),
            0 0 60px rgba(64, 224, 255, 0.5),
            0 0 90px rgba(64, 224, 255, 0.3);
    }
}

@keyframes text-glow {
    0%, 100% {
        color: #cccccc;
        text-shadow: 0 0 5px rgba(64, 224, 255, 0.2);
    }
    50% {
        color: #ffffff;
        text-shadow: 0 0 15px rgba(64, 224, 255, 0.4);
    }
}

/* Progress shimmer animation removed - no longer needed */

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

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

/* Responsive Loading Screen */
@media (max-width: 480px) {
    .loading-content {
        padding: 40px 20px;
        max-width: 350px;
        /* Ensure perfect centering on mobile */
        margin: 0 auto;
        width: calc(100% - 40px);
        min-height: auto;
    }

    .loading-spinner {
        margin: 40px 0;
        /* Ensure spinner stays centered on mobile */
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .loading-logo i {
        font-size: 60px;
    }

    .loading-logo h2 {
        font-size: 28px;
    }

    .loading-text p {
        font-size: 16px;
    }

    .spinner {
        width: 60px;
        height: 60px;
        /* Ensure spinner is centered */
        margin: 0 auto;
    }

    .spinner::before {
        width: 60px;
        height: 60px;
    }

    .spinner::after {
        width: 45px;
        height: 45px;
        top: 7.5px;
        left: 7.5px;
    }

    .progress-bar {
        height: 6px;
    }
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 16px;
    max-width: 400px;
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.notification-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-toast.notification-success {
    border-color: rgba(0, 255, 0, 0.5);
    background: rgba(0, 50, 0, 0.9);
}

.notification-toast.notification-info {
    border-color: rgba(0, 255, 255, 0.5);
    background: rgba(0, 50, 50, 0.9);
}

.notification-toast.notification-warning {
    border-color: rgba(255, 255, 0, 0.5);
    background: rgba(50, 50, 0, 0.9);
}

.notification-toast.notification-error {
    border-color: rgba(255, 0, 0, 0.5);
    background: rgba(50, 0, 0, 0.9);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-message {
    flex: 1;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Very small mobile phones */
@media (max-width: 360px) {
    .header {
        padding: 6px 8px;
        min-height: 45px;
    }

    .app-title {
        font-size: 13px;
    }

    .sidebar {
        width: 220px;
    }

    .chat-container {
        padding: 10px 6px;
    }

    .input-container {
        padding: 10px 6px;
    }

    .input-wrapper {
        padding: 8px 10px;
        gap: 4px;
        border-radius: 16px;
    }

    #messageInput {
        font-size: 16px;
        padding: 4px 2px;
        min-height: 20px;
    }

    .send-btn, .upload-btn {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .welcome-message {
        padding: 16px 6px;
    }

    .welcome-message h2 {
        font-size: 18px;
    }

    .welcome-message p {
        font-size: 13px;
    }



    .prompt-card {
        padding: 10px;
        font-size: 10px;
    }

    .prompt-card i {
        font-size: 12px;
    }

    .message-content {
        font-size: 12px;
    }

    .user-message .message-content {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* MacBook-like resolutions (1400x900 and similar) - Thinner input box */
@media (min-width: 1200px) and (max-width: 1600px) and (min-height: 800px) and (max-height: 1000px) {
    .input-container {
        padding: 20px 24px; /* Reduced from 32px 24px */
    }

    .input-wrapper {
        padding: 12px 20px; /* Reduced from 20px 24px */
        border-radius: 20px; /* Reduced from 28px for thinner appearance */
        max-width: 900px; /* Reduced from 1000px */
    }

    #messageInput {
        font-size: 16px; /* Reduced from 18px */
        padding: 8px 12px; /* Reduced padding */
        min-height: 20px; /* Reduced from default */
        max-height: 100px; /* Reduced max height */
    }

    .send-btn, .upload-btn {
        width: 36px; /* Slightly smaller buttons */
        height: 36px;
        font-size: 14px;
    }
}

/* Extra thin input for smaller MacBook screens (13-inch MacBook Air/Pro) */
@media (min-width: 1280px) and (max-width: 1440px) and (min-height: 800px) and (max-height: 900px) {
    .input-container {
        padding: 16px 20px; /* Even more reduced padding */
    }

    .input-wrapper {
        padding: 10px 16px; /* More compact padding */
        border-radius: 18px; /* Even thinner appearance */
        max-width: 800px; /* Smaller max width */
    }

    #messageInput {
        font-size: 15px; /* Smaller font */
        padding: 6px 10px; /* Tighter padding */
        min-height: 18px; /* Minimal height */
        max-height: 90px; /* Reduced max height */
    }

    .send-btn, .upload-btn {
        width: 34px; /* Smaller buttons */
        height: 34px;
        font-size: 13px;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .welcome-message {
        padding: 16px 20px;
    }

    .welcome-message h2 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .welcome-message p {
        margin-bottom: 16px;
    }

    .example-prompts {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-top: 16px;
    }

    .input-container {
        padding: 12px 16px;
    }


}

/* Responsive adjustments for notifications */
@media (max-width: 768px) {
    .notification-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Mobile Browser Viewport Fixes */
@media (max-width: 768px) {
    /* Fix for Samsung Browser and other mobile browsers */
    html {
        height: var(--app-height);
        height: -webkit-fill-available;
        /* Prevent zoom on double tap */
        touch-action: manipulation;
        /* Improve text rendering on mobile */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    body {
        height: var(--app-height);
        height: -webkit-fill-available;
        /* Use absolute positioning to avoid browser UI conflicts */
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        /* Prevent rubber band scrolling */
        overscroll-behavior: none;
        /* Improve touch responsiveness */
        touch-action: manipulation;
        /* Ensure body takes full viewport */
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .app-container {
        height: var(--app-height);
        height: -webkit-fill-available;
        /* Ensure full height on mobile browsers */
        min-height: var(--app-height);
        min-height: -webkit-fill-available;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        /* Ensure proper layering */
        z-index: 0;
        /* Account for browser UI spacing */
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .main-content {
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        /* Ensure content doesn't get cut off */
        position: relative;
        /* Add spacing for browser UI */
        padding-top: 0;
        padding-bottom: 0;
    }

    .chat-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* Ensure proper scrolling on mobile */
        height: 0; /* Allow flex to control height */
        min-height: 0;
        /* Improve scroll performance */
        will-change: scroll-position;
        /* Prevent momentum scrolling issues */
        overscroll-behavior-y: contain;
        /* Add padding to ensure content isn't hidden */
        padding-top: 8px;
        padding-bottom: 8px;
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        /* Ensure chat content is properly contained */
        box-sizing: border-box;
        /* Prevent content from being cut off by browser UI */
        margin-top: 0;
        margin-bottom: 0;
        /* Ensure proper message alignment */
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
    }

    /* Allow text selection in message content */
    .message-content {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }

    /* Improve touch targets */
    .chat-item,
    .new-chat-btn,
    .prompt-card,
    .auth-btn,
    .settings-btn {
        min-height: 44px; /* iOS recommended touch target size */
        display: flex;
        align-items: center;
    }

    /* Prevent zoom on input focus (iOS) */
    input, textarea, select {
        font-size: 16px !important;
    }

    /* Improve scrolling performance */
    .chat-container,
    .chat-history,
    .settings-content {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0); /* Force hardware acceleration */
    }

    /* Prevent horizontal overflow */
    .app-container,
    .main-content,
    .chat-container,
    .input-container {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Better button spacing for touch */
    .header-actions button {
        margin: 0 2px;
        min-width: 40px;
        min-height: 40px;
    }

    /* Improve sidebar touch interactions */
    .sidebar {
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
        will-change: transform;
    }

    .sidebar.open {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }

    /* Add backdrop for sidebar */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        /* Improve performance */
        will-change: opacity;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    /* Improve code block mobile experience */
    .message-content pre {
        max-width: calc(100vw - 32px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Better table handling on mobile */
    .message-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Improve form elements */
    .auth-form input,
    #messageInput {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 8px;
    }

    /* Fix viewport issues */
    .app-container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    /* Specific fixes for Samsung Browser and iOS Safari */
    .input-container {
        /* Ensure input area is always visible above browser UI */
        position: relative;
        bottom: 0;
        /* Use safe area insets and add extra padding for browser UI */
        padding-top: 24px;
        padding-bottom: max(40px, calc(32px + env(safe-area-inset-bottom, 0px)));
        padding-left: max(24px, env(safe-area-inset-left, 0px));
        padding-right: max(24px, env(safe-area-inset-right, 0px));
        /* Prevent keyboard from pushing content up too much */
        min-height: max(100px, calc(80px + env(safe-area-inset-bottom, 0px)));
        /* Ensure input stays above browser UI */
        z-index: 10;
        /* Add margin to account for browser navigation */
        margin-bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
        /* Ensure background covers browser UI area */
        background: linear-gradient(180deg, #212121 0%, #1a1a1a 100%);
        flex-shrink: 0;
        box-sizing: border-box;
    }

    /* Ensure header stays at top and accounts for browser UI */
    .header {
        position: relative;
        top: 0;
        z-index: 100;
        /* Ensure header is always visible above browser UI */
        min-height: 60px;
        /* Use safe area insets for devices with notches */
        padding-top: max(16px, env(safe-area-inset-top, 0px));
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        padding-bottom: 8px;
        /* Ensure header background extends to edges */
        margin-top: calc(-1 * env(safe-area-inset-top, 0px));
        margin-left: calc(-1 * env(safe-area-inset-left, 0px));
        margin-right: calc(-1 * env(safe-area-inset-right, 0px));
        /* Add extra background to cover browser UI area */
        background: linear-gradient(180deg, #212121 0%, #212121 100%);
        /* Ensure header content is properly spaced */
        box-sizing: border-box;
        flex-shrink: 0;
    }

    /* Better handling of keyboard on mobile */
    .input-wrapper:focus-within {
        /* Prevent layout shift when keyboard appears */
        transform: none;
        /* Ensure input stays visible when keyboard opens */
        position: relative;
        z-index: 1000;
    }

    /* iOS Safari specific fixes */
    @supports (-webkit-touch-callout: none) {
        .header {
            /* iOS Safari: ensure header is always visible */
            position: relative;
            /* Account for dynamic address bar */
            padding-top: max(20px, calc(16px + env(safe-area-inset-top, 0px)));
            /* Prevent header from being cut off */
            margin-top: 0;
            z-index: 1000;
        }

        .input-container {
            /* iOS Safari: ensure input area adapts to keyboard and home indicator */
            position: relative;
            /* Use env() for better keyboard handling */
            padding-bottom: max(50px, calc(40px + env(safe-area-inset-bottom, 0px)));
            /* Account for home indicator */
            margin-bottom: 0;
        }

        .chat-container {
            /* iOS Safari: adjust chat area when keyboard is open */
            padding-bottom: max(16px, env(keyboard-inset-height, 0px));
            /* Ensure content doesn't get cut off */
            margin-bottom: 0;
        }



        /* iOS Safari: handle address bar visibility */
        body.browser-ui-visible .header {
            padding-top: max(25px, calc(20px + env(safe-area-inset-top, 0px)));
        }

        body.browser-ui-hidden .header {
            padding-top: max(12px, calc(8px + env(safe-area-inset-top, 0px)));
        }
    }

    /* Android Chrome specific fixes */
    @media screen and (-webkit-min-device-pixel-ratio: 0) {
        .header {
            /* Android Chrome: account for address bar */
            padding-top: max(16px, calc(12px + env(safe-area-inset-top, 0px)));
            /* Ensure header background covers address bar area */
            margin-top: 0;
        }

        .input-container {
            /* Android Chrome: account for navigation bar */
            padding-bottom: max(48px, calc(32px + env(safe-area-inset-bottom, 0px)));
            /* Ensure input is above navigation gestures */
            margin-bottom: 0;
        }

        /* Android Chrome: handle address bar visibility */
        body.browser-ui-visible .header {
            padding-top: max(24px, calc(16px + env(safe-area-inset-top, 0px)));
        }

        body.browser-ui-visible .input-container {
            padding-bottom: max(56px, calc(40px + env(safe-area-inset-bottom, 0px)));
        }
    }

    /* Android keyboard handling */
    @media (max-width: 768px) and (max-height: 600px) {
        .chat-container {
            /* Reduce chat area when in landscape or keyboard is open */
            max-height: calc(var(--app-height) - 200px);
        }

        .header {
            /* Reduce header size in landscape */
            padding-top: max(8px, env(safe-area-inset-top, 0px));
            padding-bottom: 4px;
        }

        .input-container {
            /* Reduce input padding in landscape */
            padding-top: 16px;
            padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
        }
    }

    /* Keyboard open state styles */
    body.keyboard-open .chat-container {
        /* Adjust chat container when keyboard is open */
        padding-bottom: 20px;
        /* Ensure smooth transition */
        transition: padding-bottom 0.3s ease;
    }

    body.keyboard-open .input-container {
        /* Ensure input stays visible */
        position: relative;
        z-index: 1001;
        /* Add slight background to separate from content */
        background: linear-gradient(180deg, rgba(33, 33, 33, 0.95) 0%, #212121 100%);
        backdrop-filter: blur(10px);
    }

    body.keyboard-open .header {
        /* Slightly reduce header padding when keyboard is open */
        padding-top: max(4px, env(safe-area-inset-top));
    }

    /* Browser UI visibility states */
    body.browser-ui-visible .header {
        /* Add extra padding when browser UI is visible */
        padding-top: max(20px, calc(16px + env(safe-area-inset-top, 0px)));
        /* Ensure header is not hidden behind address bar */
        margin-top: 0;
    }

    body.browser-ui-visible .input-container {
        /* Add extra padding when browser UI is visible */
        padding-bottom: max(60px, calc(40px + env(safe-area-inset-bottom, 0px)));
        /* Ensure input is not hidden behind navigation bar */
        margin-bottom: 0;
    }

    body.browser-ui-hidden .header {
        /* Reduce padding when browser UI is hidden */
        padding-top: max(8px, env(safe-area-inset-top, 0px));
    }

    body.browser-ui-hidden .input-container {
        /* Standard padding when browser UI is hidden */
        padding-bottom: max(32px, calc(24px + env(safe-area-inset-bottom, 0px)));
    }

    /* Prevent content jumping when browser UI shows/hides */
    .app-container,
    .main-content,
    .chat-container {
        /* Use contain for better performance */
        contain: layout style paint;
        /* Prevent layout shifts */
        will-change: auto;
    }

    /* Ensure smooth transitions for viewport changes */
    @media (max-width: 768px) {
        .app-container {
            transition: height 0.3s ease-out, padding 0.3s ease-out;
        }

        .main-content {
            transition: height 0.3s ease-out, padding 0.3s ease-out;
        }

        .header {
            transition: padding 0.3s ease-out, margin 0.3s ease-out;
        }

        .input-container {
            transition: padding 0.3s ease-out, margin 0.3s ease-out;
        }

        .chat-container {
            transition: max-height 0.3s ease-out, padding 0.3s ease-out;
        }
    }

    /* Prevent layout shifts during browser UI transitions */
    @media (max-width: 768px) {
        * {
            /* Prevent unexpected layout shifts */
            box-sizing: border-box;
        }

        .header,
        .input-container,
        .chat-container {
            /* Use transform for better performance */
            will-change: transform, padding;
            /* Ensure proper rendering */
            backface-visibility: hidden;
            /* Improve rendering performance */
            transform: translateZ(0);
        }

        /* Ensure content is always accessible */
        .header {
            /* Minimum height to ensure visibility */
            min-height: 50px;
        }

        .input-container {
            /* Minimum height to ensure input is accessible */
            min-height: 80px;
        }

        .chat-container {
            /* Ensure chat area is always usable */
            min-height: 200px;
        }
    }

    /* Improve scrolling behavior */
    .chat-container {
        /* Ensure smooth scrolling */
        scroll-behavior: smooth;
        /* Better momentum scrolling on iOS */
        -webkit-overflow-scrolling: touch;
        /* Prevent rubber band effect */
        overscroll-behavior: contain;
    }

    /* Improve swipe gesture performance */
    .main-content {
        /* Improve touch responsiveness */
        touch-action: pan-y;
        /* Optimize for animations */
        will-change: transform;
    }

    /* Re-enable text selection for message content */
    .message-content {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }

    /* Improve sidebar swipe area indicator */
    .main-content::before {
        content: '';
        position: fixed;
        left: 0;
        top: 0;
        width: 25px;
        height: 100%;
        z-index: 10;
        pointer-events: none;
        /* Subtle visual indicator for swipe area */
        background: linear-gradient(to right, rgba(255, 255, 255, 0.01), transparent);
        opacity: 0.5;
    }
}

@media (max-width: 480px) {
    .notification-toast {
        top: 8px;
        right: 8px;
        left: 8px;
        padding: 12px;
        font-size: 13px;
    }
}

/* Enhanced Safe Area Support for Notched Devices */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: max(8px, env(safe-area-inset-top));
    }

    .input-container {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
        padding-bottom: max(32px, env(safe-area-inset-bottom));
    }

    .sidebar {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .auth-container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* Landing page safe area support */
    .landing-container {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    .landing-nav {
        padding-left: max(16px, env(safe-area-inset-left, 0px));
        padding-right: max(16px, env(safe-area-inset-right, 0px));
        padding-top: max(16px, env(safe-area-inset-top, 0px));
    }

    .hero-section {
        padding-left: max(24px, env(safe-area-inset-left, 0px));
        padding-right: max(24px, env(safe-area-inset-right, 0px));
    }

    .features-section,
    .creator-section,
    .cta-section {
        padding-left: max(24px, env(safe-area-inset-left, 0px));
        padding-right: max(24px, env(safe-area-inset-right, 0px));
        padding-bottom: max(60px, calc(60px + env(safe-area-inset-bottom, 0px)));
    }
}

/* Landing Page Browser UI State Handling */
@media (max-width: 768px) {
    /* Browser UI visible state for landing page */
    body.browser-ui-visible .landing-nav {
        padding-top: max(24px, calc(20px + env(safe-area-inset-top, 0px)));
    }

    body.browser-ui-visible .hero-section {
        padding-top: 120px;
        min-height: calc(var(--app-height) - 200px);
    }

    /* Browser UI hidden state for landing page */
    body.browser-ui-hidden .landing-nav {
        padding-top: max(16px, calc(12px + env(safe-area-inset-top, 0px)));
    }

    body.browser-ui-hidden .hero-section {
        padding-top: 100px;
        min-height: calc(var(--app-height) - 180px);
    }

    /* Landing page specific viewport adjustments */
    .landing-container {
        /* Smooth transitions for browser UI changes */
        transition: height 0.3s ease-out, padding 0.3s ease-out;
    }

    .hero-section {
        /* Smooth transitions for content adjustments */
        transition: padding 0.3s ease-out, min-height 0.3s ease-out;
    }

    .landing-nav {
        /* Smooth transitions for navigation adjustments */
        transition: padding 0.3s ease-out;
    }
}

/* Landscape orientation fixes for mobile */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 768px) {
    .landing-container {
        height: var(--app-height);
        min-height: var(--app-height);
    }

    .landing-nav {
        padding-top: max(8px, env(safe-area-inset-top, 0px));
        padding-bottom: 8px;
    }

    .hero-section {
        padding: 60px 16px 30px;
        min-height: calc(var(--app-height) - 80px);
        gap: 30px;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-description {
        font-size: 14px;
    }

    .header {
        padding-top: max(4px, env(safe-area-inset-top));
        min-height: 44px;
    }

    .input-container {
        padding-top: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .chat-container {
        /* Optimize for landscape mode */
        padding-top: 8px;
        padding-bottom: 8px;
    }
}

/* Custom Confirmation Dialog */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-dialog-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-dialog-overlay.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

.custom-dialog {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid #4d4d4d;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.custom-dialog-overlay.show .custom-dialog {
    transform: scale(1) translateY(0);
}

.dialog-header {
    padding: 24px 24px 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dialog-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.dialog-icon.default {
    background: rgba(0, 255, 255, 0.2);
    color: #1de8e7;
    border: 2px solid rgba(0, 255, 255, 0.3);
}

.dialog-icon.danger {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    border: 2px solid rgba(255, 107, 107, 0.3);
    animation: pulse-danger 2s infinite ease-in-out;
}

@keyframes pulse-danger {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 107, 107, 0);
    }
}

.dialog-title {
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.dialog-content {
    padding: 16px 24px 24px 24px;
}

.dialog-message {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.dialog-description {
    color: #b3b3b3;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.dialog-actions {
    padding: 0 24px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.dialog-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.dialog-btn:hover::before {
    left: 100%;
}

.dialog-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dialog-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.dialog-btn.danger {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.dialog-btn.danger:hover {
    background: linear-gradient(135deg, #ff5252, #ff4444);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    transform: translateY(-2px);
}

.dialog-btn.default {
    background: linear-gradient(135deg, #1de8e7, #00CCCC);
    color: #000000;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.dialog-btn.default:hover {
    background: linear-gradient(135deg, #00CCCC, #00AAAA);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
}

/* Responsive Dialog Styles */
@media (max-width: 768px) {
    .custom-dialog {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .dialog-header {
        padding: 20px 20px 12px 20px;
    }

    .dialog-content {
        padding: 12px 20px 20px 20px;
    }

    .dialog-actions {
        padding: 0 20px 20px 20px;
        flex-direction: column;
        gap: 8px;
    }

    .dialog-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .dialog-header {
        padding: 16px 16px 8px 16px;
    }

    .dialog-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .dialog-title {
        font-size: 18px;
    }

    .dialog-content {
        padding: 8px 16px 16px 16px;
    }

    .dialog-message {
        font-size: 15px;
    }

    .dialog-description {
        font-size: 13px;
    }

    .dialog-actions {
        padding: 0 16px 16px 16px;
    }

    .dialog-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Input Dialog Specific Styles */
.input-dialog {
    max-width: 520px;
}

.input-group {
    margin-top: 20px;
}

.input-label {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.dialog-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-sizing: border-box;
}

.dialog-input:focus {
    border-color: rgba(0, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.1);
}

.dialog-input.valid {
    border-color: rgba(0, 255, 0, 0.6);
    background: rgba(0, 255, 0, 0.1);
}

.dialog-input.invalid {
    border-color: rgba(255, 107, 107, 0.6);
    background: rgba(255, 107, 107, 0.1);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.input-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #8d8d8d;
    display: flex;
    align-items: center;
    gap: 4px;
}

.expected-text {
    background: rgba(0, 255, 255, 0.2);
    color: #1de8e7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.dialog-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.dialog-btn.enabled {
    opacity: 1;
    cursor: pointer;
}

.dialog-btn.danger.enabled {
    animation: pulse-ready 2s infinite ease-in-out;
}

@keyframes pulse-ready {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 6px 25px rgba(255, 107, 107, 0.5);
    }
}

/* Input Dialog Responsive Styles */
@media (max-width: 768px) {
    .input-dialog {
        width: 95%;
        max-width: none;
    }

    .dialog-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .input-group {
        margin-top: 16px;
    }
}

/* iOS Safari specific fixes for landing page */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .landing-container {
            height: -webkit-fill-available;
            min-height: -webkit-fill-available;
        }

        .landing-background {
            min-height: -webkit-fill-available;
        }

        .hero-section {
            min-height: calc(-webkit-fill-available - 200px);
        }

        /* iOS Safari: handle address bar visibility for landing page */
        body.browser-ui-visible .landing-nav {
            padding-top: max(28px, calc(24px + env(safe-area-inset-top, 0px)));
        }

        body.browser-ui-visible .hero-section {
            padding-top: 140px;
        }

        body.browser-ui-hidden .landing-nav {
            padding-top: max(12px, calc(8px + env(safe-area-inset-top, 0px)));
        }

        body.browser-ui-hidden .hero-section {
            padding-top: 90px;
        }
    }
}

/* Android Chrome specific fixes for landing page */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (max-width: 768px) {
    .landing-nav {
        /* Android Chrome: account for address bar */
        padding-top: max(20px, calc(16px + env(safe-area-inset-top, 0px)));
    }

    .hero-section {
        /* Android Chrome: account for navigation bar */
        padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom, 0px)));
    }

    /* Android Chrome: handle address bar visibility for landing page */
    body.browser-ui-visible .landing-nav {
        padding-top: max(28px, calc(20px + env(safe-area-inset-top, 0px)));
    }

    body.browser-ui-visible .hero-section {
        padding-bottom: max(100px, calc(80px + env(safe-area-inset-bottom, 0px)));
    }
}

/* Ensure landing page content is never cut off */
@media (max-width: 768px) {
    .cta-section {
        /* Add extra bottom padding to prevent content cutoff */
        padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom, 0px)));
        margin-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    }

    .features-section {
        /* Ensure features section has proper spacing */
        padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom, 0px)));
    }

    .creator-section {
        /* Ensure creator section has proper spacing */
        padding-bottom: max(80px, calc(60px + env(safe-area-inset-bottom, 0px)));
    }

    /* Prevent any section from being cut off by browser UI */
    .landing-background > section:last-child {
        margin-bottom: max(40px, calc(20px + env(safe-area-inset-bottom, 0px)));
    }
}

    .dialog-input {
        padding: 14px 16px;
        font-size: 16px;
    }

    .input-hint {
        font-size: 11px;
    }

/* Document Context Indicator */
.document-context-indicator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Mobile adjustments for document context indicator */
@media (max-width: 768px) {
    .document-context-indicator {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: none !important;
        font-size: 11px !important;
        padding: 6px 10px !important;
    }
}
