:root {
    --bg-color: #0b0b0d;
    --accent-color: #7c4dff;
    --accent-glow: rgba(124, 77, 255, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #9aa0a6;
    --border-color: rgba(255, 255, 255, 0.08);
    --input-bg: #111114;
    --user-bubble: #2d2d35;
    --ai-bubble: rgba(124, 77, 255, 0.05);
    --hover-bg: rgba(255, 255, 255, 0.03);
    --success-color: #00e676;
}

.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
}

body {
    background-color: var(--bg-color) !important;
    color: var(--text-primary);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* App Loader */
.app-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #09090b;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

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

.loader-logo {
    width: 60px;
    height: auto;
    animation: pulseLogo 2s infinite ease-in-out;
}

.loader-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes pulseLogo {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

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

/* 3D Animated Background */
#dotted-surface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background-color: #050505; /* Base color now here */
}

/* Updated Layout */
.app-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: row;
    background: transparent;
}

/* Sidebar Styling - Expanded for History */
.side-nav {
    width: 260px;
    height: 100%;
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden; /* Prevent overall sidebar scroll */
}

#sidebar-main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Crucial for nested scroll */
    overflow-y: hidden;
}

#sidebar-placeholder {
    height: 100%;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px 24px 12px;
}

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

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Libre Baskerville', serif;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    height: 22px;
    width: auto;
    display: block;
    object-fit: contain;
}

.logo-o {
    height: 1.1em;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    margin: 0 -0.05em;
    position: relative;
    top: -0.05em;
}

/* Actions Groups */
.top-actions, .nav-groups {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.action-item, .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.action-item:hover, .nav-item:hover {
    background: #212121;
    color: var(--text-primary);
}

.action-item .icon, .nav-item .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: inherit;
}

/* History/Recents Section */
.history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 12px;
    overflow-y: auto;
    scrollbar-width: none;
}

.history-section::-webkit-scrollbar {
    display: none;
}

.section-label {
    font-size: 0.8rem;
    color: #888;
    padding: 8px 12px;
    font-weight: 500;
}

.history-item {
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.history-item .item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.history-item.active {
    background: rgba(124, 77, 255, 0.15);
    color: #b388ff;
    font-weight: 500;
}

.history-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.history-action-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.history-action-btn.delete:hover {
    color: #ff5252;
}

/* Image Upload & Preview Styling */
.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.left-tools, .right-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.image-preview-container {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
}

.image-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.remove-img-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
}

.remove-img-btn:hover {
    background: #ff5252;
}

.ai-message-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}



/* Profile Footer */
.profile-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.user-avatar-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-plan {
    font-size: 0.75rem;
    color: #888;
}

.footer-icons {
    display: flex;
    gap: 4px;
}

.icon-btn {
    border: none;
    color: #8e8e8e !important; /* Force premium muted grey */
    cursor: pointer;
    font-size: 1.2rem;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure SVG inside uses the color */
.icon-btn svg {
    stroke: currentColor !important;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
}

/* Collapsed State */
.side-nav.collapsed {
    width: 68px;
    padding: 12px 8px;
}

.side-nav.collapsed .brand-name,
.side-nav.collapsed .label,
.side-nav.collapsed .section-label,
.side-nav.collapsed .user-details,
.side-nav.collapsed .footer-icons {
    display: none;
}

.side-nav.collapsed .sidebar-header {
    justify-content: center;
    padding: 12px 0 24px 0;
}

.side-nav.collapsed .action-item,
.side-nav.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

.side-nav.collapsed .action-item .icon,
.side-nav.collapsed .nav-item .icon {
    width: auto;
    font-size: 1.2rem;
}

.side-nav.collapsed .history-item {
    display: none;
}

.side-nav.collapsed .profile-footer {
    justify-content: center;
    padding: 16px 0;
}


.profile-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Collapsed Support for Guest View */
.side-nav.collapsed #sidebar-guest-view {
    padding: 24px 0;
    display: flex;
    justify-content: center;
}

.side-nav.collapsed .guest-container {
    padding: 12px 4px;
    background: transparent !important;
    border: none !important;
    align-items: center;
    box-shadow: none !important;
}

.side-nav.collapsed .guest-container h3,
.side-nav.collapsed .guest-container p,
.side-nav.collapsed .guest-container .label {
    display: none !important;
}

.side-nav.collapsed .guest-container button {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 8px;
}

.side-nav.collapsed .user-info,
.side-nav.collapsed .settings-btn {
    display: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--hover-bg);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-btn {
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0.7;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    max-width: none;
    margin: 0;
    padding: 0 40px;
    height: 100%;
    transition: padding 0.3s ease;
}

header {
    width: 100%;
    max-width: 900px;
    padding: 24px 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    z-index: 10;
}

.mobile-only {
    display: none !important;
}

#mobile-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header {
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.sidebar-header span {
    font-weight: 600;
    font-size: 0.9rem;
}

#close-sidebar {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 95;
    animation: fadeIn 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }

    .side-nav {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px !important; /* Force full width on mobile */
        background: #0d0d0f;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
        display: flex; /* Ensure it's flex when showing */
        padding: 24px; /* Restore padding */
        z-index: 1000;
    }

    .side-nav.active {
        left: 0;
    }

    /* Force visibility of labels on mobile active state */
    .side-nav.active .brand-name,
    .side-nav.active .label,
    .side-nav.active .section-label,
    .side-nav.active .user-details,
    .side-nav.active .footer-icons {
        display: flex !important;
    }

    .side-nav.active .sidebar-header {
        justify-content: space-between !important;
        padding: 0 0 24px 0 !important;
    }

    .side-nav.active .nav-item {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
    }

    .side-nav.active .history-item {
        display: flex !important;
    }

    .toggle-sidebar {
        display: none; /* Hide desktop toggle on mobile */
    }

    .main-content {
        padding: 0 16px;
    }
    
    header {
        padding: 16px 0;
    }

    .welcome-message h2 { font-size: 2.2rem; }

    footer {
        padding: 0 0 24px 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 24px) !important;
        gap: 8px;
    }

    .input-container {
        padding: 12px;
        margin-bottom: 12px;
    }
}

.logo h1 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Center Content */
main {
    flex: 1;
    width: 100%;
    max-width: 850px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 0;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

main::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.welcome-message {
    text-align: center;
    animation: fadeIn 1s ease-out;
}

.welcome-message h2 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff 40%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    opacity: 0.7;
}

/* New Modern Input System */
footer {
    width: 100%;
    max-width: 768px;
    padding: 0 0 100px 0; /* Further increased for desktop */
    padding-bottom: env(safe-area-inset-bottom, 100px);
    margin-bottom: 30px; /* Added significant margin for spacing */
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    z-index: 10;
}

.input-container {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: border-color 0.3s ease;
}

.input-container:focus-within {
    border-color: rgba(124, 77, 255, 0.5);
}

textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 300px;
}

.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

#send-btn, #stop-btn {
    background: #1e1e22;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#send-btn:not(:disabled) {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

#stop-btn {
    background: #ff5252;
    border-color: #ff5252;
    color: white;
}

/* Model Selector Styles */
.model-selector-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.model-selector-wrapper:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

#current-model-display {
    color: #cecece;
    font-size: 0.85rem;
    font-weight: 500;
}

.select-chevron {
    color: #8e8e8e;
    transition: transform 0.2s;
}

.model-selector-wrapper.active .select-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.model-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: 280px;
    background: rgba(18, 18, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    transform-origin: bottom right;
    animation: dropdownPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.model-dropdown.hidden {
    display: none;
}

.model-item {
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.model-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.model-item.active {
    background: rgba(124, 77, 255, 0.1);
}

.model-info {
    flex: 1;
}

.model-title {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.model-desc {
    color: #8e8e8e;
    font-size: 0.75rem;
    line-height: 1.2;
}

.check-icon {
    color: #7c4dff;
    opacity: 0;
    transition: opacity 0.2s;
}

.model-item.active .check-icon {
    opacity: 1;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 8px;
}

.extended-thinking-toggle {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toggle-title {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
}

.toggle-desc {
    color: #8e8e8e;
    font-size: 0.75rem;
}

/* Modern Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #7c4dff;
}

input:focus + .slider {
    box-shadow: 0 0 1px #7c4dff;
}

input:checked + .slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

#send-btn:hover:not(:disabled), #stop-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px var(--accent-glow);
}



/* Message Styles - Centered Column */
#messages {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 20px;
    width: 100%;
    max-width: 900px;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    gap: 6px;
}

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

.message-wrapper.ai {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message {
    font-size: 1rem;
    line-height: 1.6;
    animation: fadeIn 0.4s ease-out;
}

.message.user {
    color: var(--text-primary);
    background: linear-gradient(135deg, #4f46e5 0%, #7c4dff 100%);
    padding: 10px 20px;
    border-radius: 20px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.2);
}

.message.ai {
    color: var(--text-primary);
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important; /* Force items to stick to the left */
    gap: 16px;
    width: 100%;
}

/* Claude-Style Code Cards - Rebuilt */
.code-card {
    background: #0d0d0d !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    margin: 12px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    display: block !important;
    text-align: left !important; /* Kill any inherited centering */
}

.code-header {
    background: #1a1a1a !important;
    padding: 0 16px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    height: 38px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.code-lang {
    font-size: 12px !important;
    color: #8e8e8e !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    text-transform: lowercase !important;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 500 !important;
}

.copy-button {
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px !important;
    border-radius: 4px !important;
    transition: background 0.2s !important;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.copy-icon {
    width: 16px !important;
    height: 16px !important;
    stroke: #ffffff !important;
    stroke-width: 2px !important;
    display: block !important;
}

.copy-text {
    display: none !important;
}

.message.ai pre {
    padding: 20px 16px !important;
    margin: 0 !important;
    overflow-x: auto !important;
    font-family: 'SFMono-Regular', Consolas, "Liberation Mono", Menlo, Courier, monospace !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    background: transparent !important;
    color: #e6edf3 !important;
    text-align: left !important;
}

.message-footer {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.footer-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.feedback-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.timestamp {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin: 0 4px;
}

/* Art Generator Specific */
#art-container {
    width: 100%;
    padding-top: 120px;
}

#image-display-area {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Animations */
/* Premium Typing Indicator */
.typing-indicator-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
    margin-bottom: 20px;
}

.typing-status {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 0 8px var(--accent-glow);
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

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


/* Search Modal Styles */
.search-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    padding-top: 15vh;
    transition: opacity 0.3s ease;
}

.search-modal.hidden {
    display: none;
    opacity: 0;
}

.search-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.search-content {
    position: relative;
    width: 100%;
    max-width: 650px;
    background: rgba(20, 20, 23, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.search-input-wrapper {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-icon {
    color: #888;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    outline: none;
}

#close-search {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

#close-search:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.search-results {
    max-height: 450px;
    overflow-y: auto;
    padding: 8px;
}

.search-item {
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: #ccc;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.search-item .item-icon {
    font-size: 1.1rem;
    color: #888;
    background: rgba(255, 255, 255, 0.03);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.search-item .item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.search-item .item-title {
    font-size: 0.95rem;
    font-weight: 500;
}

.search-item .item-meta {
    font-size: 0.75rem;
    color: #666;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}


/* Auth Overlay System */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(20, 20, 23, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative; /* For absolute close button */
    max-height: 95vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.auth-card::-webkit-scrollbar {
    display: none;
}

.close-overlay-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-overlay-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

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

.auth-header h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 2rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--accent-color);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-color);
}

.auth-submit-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #444;
    font-size: 0.8rem;
    font-weight: 700;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.social-auth {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.social-btn img {
    width: 20px;
    height: 20px;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.social-btn.loading {
    opacity: 0.8;
    cursor: wait;
}

.close-auth-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
    margin-top: 8px;
}

.close-auth-btn:hover {
    opacity: 1;
    color: white;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px;
        margin: 16px;
    }
}

/* Sidebar Guest View Styling */
#sidebar-guest-view {
    padding: 24px 8px;
    flex: 1;
}

.guest-container {
    background: rgba(124, 77, 255, 0.03);
    border: 1px solid rgba(124, 77, 255, 0.1);
    border-radius: 20px;
    padding: 32px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(5px);
}

.guest-container h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.guest-container p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    opacity: 0.8;
}

.guest-container .action-item {
    justify-content: center;
    padding: 14px;
    font-size: 0.9rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.guest-container .primary-btn {
    background: var(--accent-color) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 8px 20px var(--accent-glow);
}

.guest-container .primary-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-3px);
    box-shadow: 0 12px 25px var(--accent-glow);
}

.guest-container .secondary-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.guest-container .secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-3px);
}

/* Premium Toast System */
.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 320px;
    max-width: 450px;
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transform: translateX(100px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: scale(0.9) translateY(10px);
    opacity: 0;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.toast.success .toast-icon { color: #00e676; background: rgba(0, 230, 118, 0.1); }
.toast.error .toast-icon { color: #ff5252; background: rgba(255, 82, 82, 0.1); }
.toast.info .toast-icon { color: #40c4ff; background: rgba(64, 196, 255, 0.1); }

.toast-content {
    flex: 1;
    color: #efefef;
    font-size: 0.95rem;
    font-weight: 500;
}

.toast-close {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Success type accent line */
.toast.success::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: #00e676;
    border-radius: 4px 0 0 4px;
}

.toast.error::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: #ff5252;
    border-radius: 4px 0 0 4px;
}

/* Modern Confirmation Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-container {
    width: 100%;
    max-width: 400px;
    background: rgba(22, 22, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal-overlay.show .modal-container {
    transform: scale(1);
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #fff;
}

.modal-message {
    font-size: 0.95rem;
    color: #8e8e8e;
    line-height: 1.6;
    margin-bottom: 28px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-width: 120px;
}

.modal-btn.cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
}

.modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-btn.confirm {
    background: #ff5252;
    color: white;
}

.modal-btn.confirm:hover {
    background: #ff1744;
}
/* Recents Page Styles */
#recents-view {
    flex: 1;
    padding: 40px 60px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    scrollbar-width: none;
}

#recents-view::-webkit-scrollbar { display: none; }

.recents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.recents-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.premium-btn {
    background: white;
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.premium-btn:hover { transform: scale(1.05); }

.recents-search-wrapper {
    position: relative;
    margin-bottom: 40px;
}

.recents-search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

#recents-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 14px 14px 48px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

#recents-search-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.recents-container {
    display: flex;
    flex-direction: column;
}

.recent-chat-card {
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: opacity 0.2s;
}

.recent-chat-card:hover {
    opacity: 0.8;
}

.recent-chat-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.recent-chat-card .timestamp {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#recents-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

/* Bulk Actions Bar */
.recents-bulk-bar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    animation: slideInBottom 0.3s ease;
}

.bulk-info {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.bulk-btns {
    display: flex;
    gap: 12px;
}

.bulk-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-btn.dangerous {
    background: #ff5252;
    color: white;
}

.bulk-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Card Updates */
.recent-chat-card {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 16px 12px !important;
    border-radius: 12px !important;
    margin-bottom: 4px !important;
    transition: background 0.2s !important;
}

.recent-chat-card:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    opacity: 1 !important;
}

.recent-card-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.recent-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    accent-color: var(--accent-color);
}

.recent-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.recent-chat-card:hover .recent-actions {
    opacity: 1;
}

.recent-action-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: transparent;
    color: #8e8e8e;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-action-btn:hover {
    background: white;
    color: black;
    border-color: white;
}

.recent-action-btn.delete:hover {
    background: #ff5252;
    color: white;
    border-color: #ff5252;
}

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

/* Profile Popup Claude-Style */
.profile-popup {
    position: absolute;
    bottom: 85px;
    left: 12px;
    right: 12px;
    background: #1a1a1c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    animation: popupFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.popup-header {
    padding: 12px 12px 10px;
}

.popup-email {
    font-size: 0.85rem;
    color: #8e8e8e;
    word-break: break-all;
    font-weight: 500;
}

.popup-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 6px 0;
}

.popup-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.popup-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.popup-item .icon {
    font-size: 1.1rem;
    opacity: 0.8;
}

.popup-item.logout-trigger:hover {
    background: rgba(255, 82, 82, 0.1);
    color: #ff5252;
}

#profile-trigger {
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 12px;
}

#profile-trigger:hover {
    background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 768px) {
    #recents-view {
        padding: 20px;
    }
    
    .recents-header h2 {
        font-size: 1.5rem;
    }
    .recent-actions {
        opacity: 1;
    }
}

