/* Global Styles */
:root {
    --bg-color: #131314;
    --sidebar-bg: #0f0f10;
    --text-color: #f8f8f8;
    --secondary-text: #a9a9a9;
    --accent-color: #24b9bd;
    --button-bg: #252526;
    --border-color: #333;
    --input-bg: #252526;
    --hover-color: #333;
    --card-bg: #1e2124;
    --table-stripe-bg: rgba(255, 255, 255, 0.03);
    --bg-secondary: var(--card-bg);
    --text-muted: #999; /* Used for shared conversation meta info */
    --scrollbar-track: #1e2124;
    --scrollbar-thumb: #555;
    scroll-padding-top: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Prevent horizontal scrolling on all elements */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

/* iOS Safari specific fixes */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: 80px; /* Account for fixed navigation bar */
    background-color: #2a303c;
}

/* Additional iOS Safari viewport fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS-only styles - less aggressive approach */
    
    /* Prevent double-tap zoom while preserving layout */
    * {
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Allow text selection in specific areas */
    .message-content,
    input,
    textarea {
        -webkit-user-select: text;
        -webkit-touch-callout: default;
    }
    
    /* Ensure proper scrolling on iOS */
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Mobile Performance Optimizations */
/* Eliminate 300ms tap delay on all interactive elements */
button,
a,
input,
textarea,
select,
.clickable,
.model-preset-btn,
.conversation-item,
.chat-input-container button,
.mobile-preset-btn,
.mobile-panel-preset-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Optimize scrolling performance */
.chat-messages,
.conversation-list,
.sidebar,
.model-selector-dropdown {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* GPU acceleration for transforms and animations */
.sidebar,
.sidebar-backdrop,
.model-selector,
.mobile-model-panel,
.mobile-model-selection,
.message,
.typing-indicator,
.mobile-preset-btn,
.conversation-item {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Prevent layout shifts with content visibility */
.chat-messages .message {
    content-visibility: auto;
    contain-intrinsic-size: 0 100px;
}

/* Smooth animations using transforms only */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-preset-btn,
.model-preset-btn {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Immediate visual feedback for touch interactions */
.mobile-preset-btn:active,
.model-preset-btn:active,
button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease-out;
}

/* Loading skeleton animations */
@keyframes skeleton-loading {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--card-bg) 0%, rgba(255,255,255,0.1) 50%, var(--card-bg) 100%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* Reserve space for dynamic content */
.conversation-item {
    min-height: 48px;
}

.message {
    min-height: 60px;
}

.model-info-placeholder {
    height: 24px;
    background: var(--card-bg);
    border-radius: 4px;
    margin: 4px 0;
}

/* Mobile notification system */
.mobile-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 10000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100vw - 40px);
    width: auto;
    min-width: 200px;
}

.mobile-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.mobile-notification.success {
    border-left: 4px solid #28a745;
}

.mobile-notification.error {
    border-left: 4px solid #dc3545;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    font-size: 14px;
}

.notification-content i {
    font-size: 16px;
}

.mobile-notification.success .notification-content i {
    color: #28a745;
}

.mobile-notification.error .notification-content i {
    color: #dc3545;
}

/* Enhanced loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--secondary-text);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Touch feedback improvements */
.touch-pressing {
    transform: scale(0.98);
    opacity: 0.8;
    transition: all 0.1s ease-out;
}

.active-longpress {
    transform: scale(1.02);
    box-shadow: 0 0 0 2px rgba(36, 185, 189, 0.3);
    transition: all 0.2s ease-out;
}

/* Enhanced ripple effect for better touch feedback */
@keyframes subtle-ripple {
    0% {
        transform: scale(1, 1) translate(-50%, -50%);
        opacity: 1;
    }
    100% {
        transform: scale(8, 8) translate(-50%, -50%);
        opacity: 0;
    }
}

/* Improve pull-to-refresh behavior on mobile Chrome */
@media (max-width: 576px) {
    body {
        overscroll-behavior-y: contain;
    }
    
    .chat-container {
        overscroll-behavior-y: contain;
    }
}

/* Better keyboard handling */
.keyboard-visible {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Optimize images for mobile */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Better focus indicators for mobile accessibility */
@media (max-width: 576px) {
    button:focus-visible,
    input:focus-visible,
    textarea:focus-visible {
        outline: 2px solid var(--accent-color);
        outline-offset: 2px;
    }
}

/* === Cost Band Indicators (Updated for Subtle Style) === */
.cost-band-indicator {
    display: inline-block;
    margin-left: 6px;      /* Spacing from model name */
    font-size: 0.8em;       /* Slightly smaller */
    vertical-align: middle; /* Align with text */
    padding: 1px 2px;       /* Minimal padding, adjust if needed */
    border-radius: 3px;     /* Optional: slight rounding */
    font-weight: 600;       /* Make symbols slightly bolder by default */
    line-height: 1;         /* Consistent height */
    background-color: transparent !important; /* Ensure no background */
}

/* Specific band styles with high specificity for pricing table */
#pricingTable .cost-band-indicator.cost-band-free {
    color: #24b9bd !important; /* Cyan for free models */
}
#pricingTable .cost-band-indicator.cost-band-1 {
    color: #24b9bd !important; /* Cyan for $ */
    font-weight: normal; /* Less emphasis for low cost */
}
#pricingTable .cost-band-indicator.cost-band-2 {
    color: #24b9bd !important; /* Cyan for $$ */
    font-weight: normal; /* Less emphasis for medium-low cost */
}
#pricingTable .cost-band-indicator.cost-band-3-warn {
    color: #ff9800 !important; /* Orange text for $$$ */
}
#pricingTable .cost-band-indicator.cost-band-4-danger {
    color: #e53935 !important; /* Red text for $$$$ */
    font-weight: bold !important;
}
#pricingTable .cost-band-indicator.cost-band-auto {
    color: #90a4ae !important; /* Neutral blue-grey for Auto Router */
    font-weight: bold !important;
}

/* General cost band styles for other parts of the app */
.cost-band-free {
    color: #24b9bd; /* Cyan for free models */
}
.cost-band-auto {
    color: #90a4ae; /* Neutral blue-grey for Auto Router */
    font-weight: bold;
}
.cost-band-1 {
    color: #24b9bd; /* Cyan for $ */
    font-weight: normal;
}
.cost-band-2 {
    color: #24b9bd; /* Cyan for $$ */
    font-weight: normal;
}
.cost-band-3-warn {
    color: #ff9800; /* Orange text for $$$ */
    font-weight: bold;
}
.cost-band-4-danger {
    color: #e53935; /* Red text for $$$$ */
    font-weight: bold;
}

/* Style for the header indicator span (inherits color/weight from above) */
#selected-model-cost-indicator {
    margin-left: 8px; /* Space from model name */
    font-weight: bold; /* Ensure header indicator is always bold */
    background-color: transparent !important; /* Ensure no background */
    padding: 0; /* Remove padding for header */
}
/* === End Cost Band Indicators === */

/* Removed conflicting pricing table text colors - using specific cost-band classes instead */

/* === End Pricing Table Colors === */

/* --- Previous CSS rules below this line --- */
/* ... (rest of your style.css content) ... */



/* Bootstrap Dark Theme Overrides */
/* These styles ensure Bootstrap components work with our dark theme */

/* Global smooth scrolling */
html {
    scroll-behavior: smooth;
    touch-action: manipulation; /* Optimize touch behavior */
}

/* General Body & Text */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Card components */
.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.card-title, .card-header, .card-footer {
    color: var(--text-color);
}

/* Table styles */
.table {
    color: var(--text-color) !important;
}

/* Target all cells in tables directly */
table tbody tr td, 
table thead tr th,
.table tbody tr td,
.table thead tr th {
    color: var(--text-color) !important;
}

/* Force text color in all table rows */
tr, tr td, tr th {
    color: var(--text-color) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--table-stripe-bg);
}

.table-striped > tbody > tr:nth-of-type(even) {
    background-color: var(--card-bg);
}

.table th, .table td {
    border-color: var(--border-color);
}

.table-dark {
    background-color: var(--card-bg);
    color: var(--text-color) !important;
}

.table-dark th, .table-dark td {
    border-color: var(--border-color);
}

/* Force color for all td and th elements, using higher specificity */
.card .table td, 
.card .table th,
div.table-responsive table td,
div.table-responsive table th {
    color: var(--text-color) !important;
}

/* Form elements */
.form-control, .form-select {
    background-color: var(--input-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* Force color for input types */
input[type="text"], 
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"],
input[type="week"],
input[type="color"],
textarea,
select {
    background-color: var(--input-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.form-control:focus, .form-select:focus {
    background-color: var(--input-bg) !important;
    border-color: var(--accent-color) !important;
    color: var(--text-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(36, 185, 189, 0.25) !important;
}

.form-control::placeholder {
    color: var(--secondary-text) !important;
    opacity: 0.7;
}

.form-label, .form-text, .form-check-label {
    color: var(--text-color) !important;
}

.form-text {
    color: var(--secondary-text) !important;
}

/* Checkbox styling */
.form-check-input {
    background-color: var(--input-bg) !important;
    border-color: var(--border-color) !important;
}

.form-check-input:checked {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
}

/* Navigation tabs */
.nav-tabs .nav-link {
    color: var(--secondary-text);
}

.nav-tabs .nav-link:hover {
    color: var(--text-color);
    background-color: var(--hover-color);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--accent-color);
    background-color: var(--card-bg);
    border-color: var(--border-color) var(--border-color) var(--card-bg);
    border-bottom: 2px solid var(--accent-color);
}

/* Badge styles */
.badge {
    color: var(--text-color);
}

.badge.bg-success {
    color: #fff;
}

.badge.bg-warning {
    color: #212529;
}

.badge.bg-info {
    color: #fff;
    background-color: var(--accent-color) !important;
}

.badge.bg-danger {
    color: #fff;
}

/* Alert styles */
.alert {
    border-color: var(--border-color);
}

.alert-info {
    background-color: rgba(36, 185, 189, 0.15);
    color: var(--text-color);
    border-color: rgba(36, 185, 189, 0.3);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.15);
    color: var(--text-color);
    border-color: rgba(40, 167, 69, 0.3);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.15);
    color: var(--text-color);
    border-color: rgba(255, 193, 7, 0.3);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--text-color);
    border-color: rgba(220, 53, 69, 0.3);
}

/* Text utilities */
.text-muted {
    color: var(--secondary-text) !important;
}

.text-primary {
    color: var(--accent-color) !important;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-primary:hover {
    background-color: #1da5a9;
    border-color: #1b979b;
}

/* Make primary buttons larger for emphasis */
.btn-lg {
    font-size: 16px;
    padding: 12px 24px;
}

.btn-outline-secondary {
    color: var(--text-color);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    color: var(--text-color);
    background-color: var(--hover-color);
    border-color: var(--border-color);
}

/* Tooltip styles */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-container .tooltip-text {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Account page specific styles */
.balance-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
}

.balance-amount {
    font-size: 2.5rem;
    color: #4cd964;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Affiliate Dashboard styles */
.stat-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    height: 100%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--secondary-text);
    font-size: 0.9rem;
}

.data-table {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.data-table thead {
    background-color: #2c2f33;
}

.data-table th, .data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color) !important;
}

.status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: bold;
}

.pending {
    background-color: #ffc107;
    color: #212529;
}

.approved {
    background-color: #28a745;
    color: #fff;
}

.rejected {
    background-color: #dc3545;
    color: #fff;
}

.paid {
    background-color: #17a2b8;
    color: #fff;
}

.tier-1 {
    background-color: #007bff;
    color: #fff;
}

.tier-2 {
    background-color: #5cb85c;
    color: #fff;
}

.caption {
    font-size: 0.9rem;
    opacity: 0.7;
    color: var(--secondary-text);
}

.package-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 100%;
    transition: all 0.3s ease;
}

.package-card:hover {
    background-color: #23262a;
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(36, 185, 189, 0.3);
}

.package-title {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.package-price {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.package-feature {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

/* List group styles - used in account settings & usage analytics */
.list-group-item {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.list-group-item-action {
    color: var(--text-color) !important;
}

.list-group-item-action:hover {
    background-color: var(--hover-color) !important;
}

.list-group-item.bg-transparent {
    background-color: transparent !important;
}

/* Usage Analytics specific styles */
.usage-stat {
    color: var(--text-color) !important;
}

.usage-stat-value {
    color: var(--text-color) !important;
    font-weight: bold;
}

.usage-stat-label {
    color: var(--secondary-text) !important;
}

/* Button group fixes */
.btn-group .btn {
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.btn-group .btn.active {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: white !important;
}

/* Account settings specific overrides */
#settings .form-control[readonly] {
    background-color: rgba(0, 0, 0, 0.2) !important;
    color: var(--text-color) !important;
}

/* Fix for input fields that need to be editable */
.editable-field {
    background-color: var(--input-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    pointer-events: auto !important;
    cursor: text !important;
}

/* Custom select buttons */
.select-button {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.select-button:hover {
    background-color: var(--hover-color);
}

.select-button.bg-danger {
    background-color: #dc3545 !important;
    color: white !important;
}

/* Footer link separator */
hr {
    border-color: var(--border-color) !important;
    opacity: 0.5;
}

/* Pricing table styles */
#pricingTable tbody tr {
    transition: background-color 0.15s ease-in-out;
}

#pricingTable tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

#pricingTable td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    color: var(--text-color) !important;
}

/* Fix model name coloring and alignment */
#pricingTable .model-name {
    color: var(--text-color) !important;
    text-align: left;
}

#pricingTable a {
    color: var(--text-color) !important;
}

#pricingTable a:hover {
    color: var(--accent-color) !important;
}

/* Only allow cyan for cost band indicators */
#pricingTable .cost-band {
    color: var(--accent-color);
}

/* Fix column alignment */
#pricingTable .text-start {
    text-align: left !important;
}

#pricingTable .text-center {
    text-align: center !important;
}

#pricingTable .text-end {
    text-align: right !important;
}

/* Original body styles */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden; /* Only prevent horizontal scrolling */
    overflow-y: auto;   /* Allow vertical scrolling */
}

/* Special handling for account page to allow scrolling */
body.account-page {
    height: auto; /* Allow the body to expand with content */
    overflow-y: auto;
}

/* Make the main container in account page have a minimum height */
body.account-page .container {
    min-height: calc(100vh - 120px); /* Ensure the container takes most of the screen */
    padding-bottom: 60px; /* Add some bottom padding for content at the bottom */
}

/* Make sure tab panes have minimum height */
body.account-page .tab-pane {
    min-height: 400px; /* Set a minimum height for tab content */
}

/* Usage History Page Styles */
.container.usage-history {
    max-width: 1000px;
}

.account-header {
    margin-bottom: 1.5rem;
}

.back-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.back-button:hover {
    background-color: #138496;
    color: white;
}

.card-dark {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.tab-button {
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    margin-right: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.tab-button:hover {
    background-color: var(--hover-color);
}

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

.stat-title {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin-bottom: 0.5rem;
}

.stat-caption {
    font-size: 0.8rem;
    color: var(--secondary-text);
}

.progress-dark {
    background-color: var(--input-bg);
    border-radius: 8px;
    overflow: hidden;
    height: 10px;
}

.progress-bar-dark-primary {
    background-color: var(--accent-color);
}

.progress-bar-dark-info {
    background-color: #0e6d98;
}

.progress-bar-dark-secondary {
    background-color: #495057;
}

.badge-dark-primary {
    background-color: var(--accent-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.badge-dark-info {
    background-color: #0e6d98;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.badge-dark-secondary {
    background-color: #495057;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.list-item-dark {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
}

.action-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.action-button:hover {
    background-color: #138496;
    color: white;
}

.pagination-dark .page-link {
    background-color: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

.pagination-dark .page-item.active .page-link {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Pricing table specific styles to resolve color and alignment inconsistencies */
#pricingTable td {
    color: var(--text-color) !important; /* Force text color for all cells */
    vertical-align: middle !important; /* Consistent vertical alignment */
    padding: 10px 12px !important; /* Consistent padding for all cells */
}

/* Force model names to use text color instead of custom colors */
#pricingTable td:first-child {
    color: var(--text-color) !important; /* Override any custom coloring */
    text-align: left !important; /* Consistent left alignment */
}

/* Target all specific text-* classes inside the first column to override the coloring */
#pricingTable td:first-child .text-info,
#pricingTable td:first-child .text-warning,
#pricingTable td:first-child .text-danger,
#pricingTable td:first-child .text-success,
#pricingTable td:first-child .text-primary,
#pricingTable td:first-child .text-secondary,
#pricingTable td:first-child div span:not(.cost-band-indicator),
#pricingTable td:first-child .fw-medium,
#pricingTable .fw-medium,
#pricingTable div span:not(.cost-band-indicator) {
    color: var(--text-color) !important; /* Force text color */
}

/* Only allow cost band indicators to have colored text */
#pricingTable .cost-band-indicator {
    /* Allow these to have their special colors */
    display: inline-block;
    min-width: 20px;
    text-align: center;
}

/* Cost band color overrides for pricing table */
#pricingTable .cost-band-indicator.text-success {
    color: #28a745 !important; /* Green for free models */
}

#pricingTable .cost-band-indicator.text-info {
    color: #17a2b8 !important; /* Teal for $ and $$ models */
}

#pricingTable .cost-band-indicator.text-warning {
    color: #ffc107 !important; /* Amber for $$$ models */
}

#pricingTable .cost-band-indicator.text-danger {
    color: #dc3545 !important; /* Red for $$$$ models */
}

/* Ensure numeric columns are right-aligned */
#pricingTable td:nth-child(2),
#pricingTable td:nth-child(3),
#pricingTable td:nth-child(4) {
    text-align: right !important; /* Right align numeric values */
}

/* Ensure Multimodal and Cost Band columns are centered */
#pricingTable td:nth-child(5),
#pricingTable td:nth-child(6) {
    text-align: center !important; /* Center these columns */
}

.app-container {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    height: 100vh; /* Fix height to viewport height */
    position: sticky;
    top: 0;
    overflow: hidden; /* Prevent sidebar from causing main page to scroll */
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: var(--hover-color);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    max-height: calc(100vh - 170px); /* Ensure there's space for sidebar-header and sidebar-footer */
    -webkit-overflow-scrolling: touch; /* Enable native iOS scrolling */
    overscroll-behavior: contain; /* Prevent sidebar scroll from affecting main page */
}

.conversation-item {
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 4px;
    margin: 4px 8px;
    transition: background-color 0.2s;
    position: relative;
}

.conversation-item:hover {
    background-color: var(--hover-color);
}

.conversation-item.active {
    background-color: rgba(36, 185, 189, 0.15);
    border-left: 3px solid var(--accent-color);
    font-weight: 500;
}

.conversation-item.active .conversation-title {
    color: var(--accent-color);
}

.conversation-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 24px; /* Make room for edit button */
}

.conversation-date {
    font-size: 12px;
    color: var(--secondary-text);
    margin-top: 4px;
}

.edit-conversation-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 20px;
    height: 20px;
    display: none;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    border: none;
    border-radius: 4px;
    color: var(--secondary-text);
    cursor: pointer;
    padding: 0;
}

.edit-conversation-btn:hover {
    color: var(--accent-color);
    background-color: rgba(36, 185, 189, 0.1);
}

.conversation-item:hover .edit-conversation-btn {
    display: flex;
}

/* Modal styles for rename dialog */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 95%;
    max-width: 400px;
    transition: transform 0.2s ease;
    transform: translateY(20px);
    border: 1px solid var(--border-color);
}

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

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-color);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    border: none;
}

.modal-btn.cancel {
    background-color: var(--sidebar-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.modal-btn.submit {
    background-color: var(--accent-color);
    color: white;
}

/* Loading indicator for conversations list */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--secondary-text);
    font-size: 0.9em;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

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

.loading-text {
    font-size: 14px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background-color: var(--sidebar-bg); /* Ensure same background as sidebar */
    position: sticky;
    bottom: 0;
    z-index: 10; /* Ensure it stays on top of other content */
}

.user-info {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: white;
    font-size: 16px;
}

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

.user-name {
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    color: var(--secondary-text);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-actions {
    margin-top: 8px;
}

.account-link {
    display: inline-flex;
    align-items: center;
    color: var(--accent-color);
    font-size: 12px;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(36, 185, 189, 0.1);
    transition: background-color 0.2s;
}

.account-link:hover {
    background-color: rgba(36, 185, 189, 0.2);
}

.account-link i {
    margin-right: 4px;
}

.footer-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clear-conversations-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    color: var(--secondary-text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    transition: color 0.2s;
}

.clear-conversations-btn:hover {
    color: var(--text-color);
}

.auth-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    margin-top: 10px;
}

/* Google Auth styling */
.google-auth-btn {
    background-color: #4285F4;
    color: white;
    border: none;
    font-weight: 500;
}

.google-auth-btn:hover {
    background-color: #3367D6;
    color: white;
}

.auth-btn:hover {
    background-color: rgba(36, 185, 189, 0.1);
}

#logout-btn {
    border-color: #e53935;
    color: #e53935;
}

#logout-btn:hover {
    background-color: rgba(229, 57, 53, 0.1);
}

/* View Footer Link */
.view-footer-link {
    display: block;
    text-align: center;
    padding: 8px;
    margin-top: 10px;
    color: var(--secondary-text);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.view-footer-link:hover {
    color: var(--accent-color);
}

/* Chat Container Styles */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Use dynamic viewport units so the container tracks the visible area */
    height: 100dvh;
    min-height: 100dvh;
    overflow-y: auto; /* Make the chat container the main scrollable element */
    position: relative; /* For proper positioning of sticky elements */
}

@supports (-webkit-touch-callout: none) {
    .chat-container {
        height: -webkit-fill-available;
        min-height: -webkit-fill-available;
    }
}


.chat-messages {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Allow chat messages to expand naturally, no need for fixed height or overflow */
    /* Add padding at the bottom to ensure last message isn't hidden by fixed input area */
    padding-bottom: calc(120px + 20px); /* Input height + extra padding */
}

/* Welcome Section */
.welcome-container {
    margin: auto;
    max-width: 600px;
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--accent-color);
}

.welcome-heading {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-color);
}

.welcome-text {
    color: var(--secondary-text);
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Welcome section mobile adjustments */
@media (max-width: 576px) {
    .welcome-container {
        padding: 20px 15px;
    }
    
    .welcome-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 12px;
    }
    
    .welcome-heading {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .welcome-text {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

.example-question-btn {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.example-question-btn:hover {
    background-color: rgba(36, 185, 189, 0.1);
}

/* Chat Messages */
.message {
    display: flex;
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

@media (min-width: 1200px) {
    .message {
        max-width: 900px;
    }
}

@media (min-width: 1600px) {
    .message {
        max-width: 1000px;
    }
}

.message-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 16px;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.message-avatar.assistant {
    background-color: #24b9bd;
}

.message-avatar.user {
    background-color: #9c27b0;
}

.message-content {
    flex: 1;
    background-color: var(--input-bg);
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

/* Make sure message-wrapper has positioning context for absolute elements */
.message-wrapper {
    position: relative;
    overflow: visible; /* Ensure toggle buttons aren't clipped */
}

/* Collapsible message styles */
.message-content.collapsible {
    position: relative; /* Needed for positioning the toggle button and gradient */
    overflow: hidden; /* Hide the overflowing content */
    transition: max-height 0.5s ease-out;
    will-change: max-height; /* Optimize for animations */
}

.message-content.collapsible.collapsed {
    max-height: 200px !important; /* Initial height of the bubble - !important to override other styles */
    /* The mask-image provides the fade-out effect at the bottom */
    -webkit-mask-image: linear-gradient(to bottom, black 170px, transparent 200px);
    mask-image: linear-gradient(to bottom, black 170px, transparent 200px);
    overflow: hidden; /* Force hidden overflow in collapsed state */
}

/* Remove the mask when expanded - no internal scrolling on mobile */
.message-content.collapsible.expanded {
    max-height: none !important; /* Allow full height */
    overflow: visible !important; /* No internal scrolling - let bubbles expand naturally */
    -webkit-mask-image: none !important;
    mask-image: none !important;
    /* Add bottom margin to create space for the toggle button */
    margin-bottom: 20px;
}

/* Mobile-specific: ensure no internal scrolling in message bubbles */
@media (max-width: 768px) {
    .message-content.collapsible.expanded {
        overflow: visible !important; /* Force no internal scrolling on mobile */
        height: auto !important; /* Let content determine height naturally */
        max-height: none !important; /* Remove any height constraints */
    }
}

/* Toggle Button Styling (Arrow Icon) */
/* Add RGB versions of color variables for transparency effects */
:root {
    --button-bg-rgb: 37, 37, 38; /* Based on --button-bg: #252526 */
    --border-color-rgb: 51, 51, 51; /* Based on --border-color: #333 */
    --hover-color-rgb: 51, 51, 51; /* Based on --hover-color: #333 */
}

.message-truncate-toggle {
    display: none; /* Hidden by default, shown by JS if message is too long */
    position: absolute;
    bottom: 8px; /* Raise toggle slightly so it isn't cut off */
    right: 4px; /* Position in bottom-right instead of center */
    left: auto; /* Overriding the centered positioning */
    transform: none; /* No need for transform with right positioning */
    background-color: rgba(var(--button-bg-rgb), 0.7); /* Semi-transparent background */
    color: var(--text-color);
    border: 1px solid rgba(var(--border-color-rgb), 0.5); /* Thinner, semi-transparent border */
    border-radius: 50%; /* Circular button */
    width: 32px; /* Slightly smaller */
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 100; /* Higher z-index to ensure it's above other content */
    transition: background-color 0.2s, transform 0.3s, opacity 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25); /* Lighter shadow */
    opacity: 0.85; /* Slightly transparent by default */
}

.message-truncate-toggle:hover,
.message-truncate-toggle:focus,
.message-truncate-toggle:active {
    background-color: rgba(var(--hover-color-rgb), 0.9);
    outline: none; /* Remove focus outline */
    opacity: 1; /* Full opacity on hover */
}

.message-truncate-toggle i {
    font-size: 14px;
    transition: transform 0.3s ease-in-out;
    pointer-events: none; /* Make sure icon doesn't interfere with clicks */
}

/* Removing the transform rotation as we now use different icons 
   for expanded vs collapsed states (up vs down arrow) */
.message-truncate-toggle.expanded i {
    /* Icon change is handled by JavaScript */
}

/* Make sure the toggle button is shown when needed - multiple selectors for different DOM structures */
.message .message-truncate-toggle,
.message-wrapper .message-truncate-toggle {
    display: none; /* Default state */
}

/* Show button when message is collapsed */
.message-content.collapsible.collapsed ~ .message-truncate-toggle,
.message-content.collapsible.collapsed + .message-truncate-toggle,
.message-wrapper .message-content.collapsible.collapsed ~ .message-truncate-toggle,
.message-wrapper .message-content.collapsible.collapsed + .message-truncate-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Keep button visible when expanded */
.message-content.collapsible.expanded ~ .message-truncate-toggle,
.message-content.collapsible.expanded + .message-truncate-toggle,
.message-wrapper .message-content.collapsible.expanded ~ .message-truncate-toggle,
.message-wrapper .message-content.collapsible.expanded + .message-truncate-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 0.95 !important;
     bottom: -12px; /* Reduced gap so icon stays closer to the message */
    right: 4px; /* Maintain right alignment in expanded state */
    background-color: rgba(var(--button-bg-rgb), 0.85); /* Make button more visible */
}

/* Style for the top collapse button */
.message-truncate-toggle-top {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 100;
    background-color: rgba(var(--button-bg-rgb), 0.7);
    border: 1px solid rgba(var(--border-color-rgb), 0.5);
    opacity: 0.85;
}

/* Mobile-specific adjustments */
@media (max-width: 576px) {
    /* Better sized tap targets on mobile - moderately sized for better layout */
    .message-truncate-toggle {
        width: 36px; 
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        bottom: 12px; /* Raise button so it stays visibly attached */
        right: 6px;
    }
    
    /* Appropriately sized icon for better visibility */
    .message-truncate-toggle i {
        font-size: 14px; /* Smaller icon for less intrusiveness */
    }
    
    /* Fix positioning in mobile view which may have different structure */
    .message-bubble .message-truncate-toggle,
    .message-content + .message-truncate-toggle {
        bottom: 12px;
        right: 6px;
    }
    
    /* Mobile styling for top collapse button */
    .message-truncate-toggle-top {
        top: 6px;
        right: 6px;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
    
    /* Better positioning for expanded state - avoid overlapping action buttons */
    .message-content.collapsible.expanded + .message-truncate-toggle,
    .message-content.collapsible.expanded ~ .message-truncate-toggle {
        bottom: -8px;
        right: 6px; /* Consistent right alignment */
    }
    
    /* Ensure message has margin for the toggle button */
    .message-content.collapsible.expanded {
        margin-bottom: 38px; /* Increased to ensure buttons are visible and accessible */
        /* Add padding-top for the top collapse button */
        padding-top: 10px;
    }
    
    /* Ensure metadata is visible on mobile */
    .message-metadata-outside {
        padding-right: 45px; /* Add extra padding to avoid overlap with the toggle button */
    }
    
    /* Make sure the fade works on mobile */
    .message-content.collapsible.collapsed {
        -webkit-mask-image: linear-gradient(to bottom, black 160px, transparent 200px);
        mask-image: linear-gradient(to bottom, black 160px, transparent 200px);
    }
    
    /* Ensure toggle remains visible but with proper z-index */
    .message .message-truncate-toggle,
    .message-wrapper .message-truncate-toggle {
        z-index: 50; /* Lower z-index so action buttons can be above if needed */
    }
    
    /* Fix for interactions with on-screen keyboard */
    .message-content.collapsible {
        transform: translateZ(0); /* Force GPU acceleration */
    }
    
    /* Ensure action buttons don't get obscured */
    .message-actions {
        padding-right: 40px; /* Add padding to avoid overlap with collapse button */
    }
}

/* Legacy styles maintained for backwards compatibility */
.truncated-message {
    max-height: 200px;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to bottom, black 160px, transparent 200px);
    -webkit-mask-image: linear-gradient(to bottom, black 160px, transparent 200px);
}

.show-more-toggle {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background-color: var(--hover-color);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: var(--accent-color);
    user-select: none;
    transition: background-color 0.2s;
}

.show-more-toggle:hover {
    background-color: rgba(36, 185, 189, 0.15);
}

.assistant-message .message-content {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
}

.message-user .message-content {
    background-color: #1e3a8a;
}

/* Message image styling */
.message-image-container {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.message-image {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    object-fit: contain;
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Multi-image grid in messages */
.message-multi-image {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-gap: 10px;
    margin-top: 16px;
    width: 100%;
}

.message-image-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message-thumbnail {
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.message-thumbnail:hover {
    transform: scale(1.05);
}

/* Camera Loading States */
.camera-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: white;
}

.camera-loading-content p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Upload Indicator Styles */
.upload-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 8px 0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.upload-indicator.preparing {
    background-color: rgba(76, 217, 100, 0.1);
    border: 1px solid rgba(76, 217, 100, 0.3);
    color: var(--accent-color);
}

.upload-indicator.waiting {
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.upload-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(76, 217, 100, 0.3);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Button Pressed State Enhancement */
.button-pressed {
    transform: scale(0.95);
    background-color: var(--hover-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Message actions, reasoning, and metadata */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-left: 4px;
}

.message-actions button {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.message-actions button:hover {
    background-color: var(--hover-color);
    color: var(--text-color);
}

.message-actions button.voted {
    color: var(--accent-color);
}

.message-actions button.copied {
    color: var(--accent-color);
}

/* Reasoning styles */
.message-reasoning {
    margin-top: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.2);
}

.reasoning-header {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--secondary-text);
    background-color: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}

.reasoning-header:hover {
    background-color: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
}

.reasoning-toggle {
    font-size: 10px;
    transition: transform 0.2s;
}

.reasoning-content {
    padding: 12px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #a8a8a8;
    white-space: pre-wrap;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.reasoning-expanded {
    border-color: var(--accent-color);
}

.reasoning-expanded .reasoning-header {
    color: var(--accent-color);
}

/* Reasoning container styles */
.reasoning-container {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: 40px; /* Ensure container is always visible */
}

.reasoning-container.reasoning-expanded {
    border-color: var(--accent-color);
}

.reasoning-container.reasoning-expanded .reasoning-header {
    color: var(--accent-color);
}

.reasoning-content {
    display: block;
    max-height: 300px;
    overflow-y: auto;
}

/* Collapsed state - hide content but keep header visible */
.reasoning-container:not(.reasoning-expanded) .reasoning-content {
    display: none;
}

.main-response {
    margin-top: 0;
}

/* Metadata styles */
.message-metadata {
    font-size: 12px;
    color: var(--secondary-text);
    margin-top: 4px;
    padding-left: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: block;
}

/* Make sure metadata is visible outside of collapsed message content */
.message-metadata-outside {
    position: relative;
    z-index: 10; /* Ensure it's above the collapsible content */
    background-color: var(--bg-color); /* Match the background to make it look seamless */
    /* Ensure it's always visible regardless of message collapse state */
    max-height: none !important;
    overflow: visible !important;
    /* No mask image to ensure text is fully visible */
    -webkit-mask-image: none !important;
    mask-image: none !important;
}

/* Document reference indicator */
.document-reference {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(36, 185, 189, 0.15);
    color: var(--accent-color);
    font-size: 11px;
}

.document-reference i {
    font-size: 10px;
}

/* Shared conversation metadata styles */
.message-meta .model-tag {
    display: inline-block;
    background-color: rgba(36, 185, 189, 0.15);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 4px;
}

.message-meta .token-info {
    font-size: 11px;
    color: var(--secondary-text);
    margin-top: 2px;
}

/* Perplexity Citations Styles */
.perplexity-citations {
    margin-top: 12px;
    padding: 8px 12px;
    background-color: rgba(36, 185, 189, 0.05);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    font-size: 13px;
}

.perplexity-citations .citations-header {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.perplexity-citations ul {
    list-style-type: none;
    padding-left: 4px;
}

.perplexity-citations li {
    margin-bottom: 4px;
}

.perplexity-citations a {
    color: #9ecfd1;
    text-decoration: none;
    word-break: break-all;
}

.perplexity-citations a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

.document-reference.has-sources {
    cursor: pointer;
    padding-right: 14px;
    position: relative;
}

.document-reference.has-sources:after {
    content: '▼';
    font-size: 8px;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
}

.document-reference.has-sources.expanded:after {
    transform: translateY(-50%) rotate(180deg);
}

.document-sources {
    background-color: rgba(10, 40, 50, 0.9);
    border: 1px solid rgba(36, 185, 189, 0.3);
    border-radius: 4px;
    color: #f0f0f0;
    font-size: 12px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    width: 100%;
}

.document-sources h4 {
    color: var(--accent-color);
    font-size: 13px;
    margin: 0 0 6px 0;
}

.document-sources ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.document-sources li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 0;
}

.document-sources li:last-child {
    border-bottom: none;
}

.metadata-visible {
    /* Additional styles for enhanced visibility when metadata is present */
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* Input Area */
.chat-input-container {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    position: sticky;
    bottom: 0;
    width: 100%;
    z-index: 900;
}

.model-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: visible;
    padding-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}

.model-preset-container {
    display: flex;
    width: 75%; /* The preset buttons collectively occupy 75% of screen width */
    gap: 8px;
    max-width: 75%;
    min-width: 0; /* Allow container to shrink if needed */
    overflow-x: visible; /* Allow overflow to be visible */
}

.model-preset-btn {
    background-color: var(--button-bg);
    color: var(--secondary-text);
    border: none;
    padding: 6px 8px 6px 10px; /* Reduced padding for better fit */
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    display: flex;
    position: relative; /* Needed for proper positioning of children */
    align-items: center;
    gap: 3px; /* Reduced spacing between elements */
    transition: background-color 0.2s, color 0.2s;
    flex: 1; /* Each button gets equal width within the container */
    justify-content: center; /* Center the content of each button */
    min-height: 36px; /* Ensure consistent height */
    padding-right: 30px; /* Make space for the dropdown selector */
    min-width: 0; /* Allow button to shrink if needed */
    overflow: hidden; /* Prevent content from overflowing */
}

.model-preset-btn:hover {
    background-color: var(--hover-color);
}

.model-preset-btn.active {
    color: var(--text-color);
    border: 1px solid var(--accent-color);
}

.model-preset-btn .model-icon {
    margin-right: 2px;
}

.model-preset-btn .model-name {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Remove max-width to allow flexibility */
    font-size: 12px; /* Slightly smaller font to ensure it fits */
    line-height: 1.1;
}

.model-preset-btn .selector-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    height: 100%;
    width: 24px; /* Fixed width for better consistency */
    padding: 0; /* Remove padding to prevent overflow */
    border-radius: 0 16px 16px 0;
    transition: background-color 0.2s;
    position: absolute; /* Position absolutely */
    right: 0; /* Align to right edge */
    top: 0; /* Align to top edge */
    bottom: 0; /* Extend to bottom edge */
    box-sizing: border-box; /* Include padding in width calculation */
    overflow: hidden; /* Prevent icon from overflowing */
}

.model-preset-btn .selector-icon-container:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.model-preset-btn .selector-icon {
    font-size: 10px;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s;
}

.model-preset-btn .selector-icon-container:hover .selector-icon {
    opacity: 1;
}

.model-preset-btn.free-preset {
    color: white;
    background-color: #254344; /* Updated from var(--accent-color) (#24b9bd) */
}

/* Locked premium features */
.premium-locked {
    position: relative;
    cursor: pointer;
}

/* Style for the button overlay */
.button-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: bold;
    color: var(--text-color);
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

/* Shared disabled styles */
.model-preset-btn.disabled {
    cursor: pointer; /* Keep cursor as pointer since buttons should be clickable */
    position: relative; /* Ensure position for overlay */
    transition: opacity 0.3s ease;
}

/* Show the overlay when disabled */
.model-preset-btn.disabled .button-overlay {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer; /* Make the overlay clickable */
    z-index: 10; /* Ensure overlay is on top */
    background-color: rgba(0, 0, 0, 0.5); /* Darker background for better visibility */
}

/* Specific overlay content for login required */
.model-preset-btn.disabled-login .button-overlay::before {
    content: "\f023"; /* Lock icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.2em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Text shadow for better visibility */
}

/* Specific overlay content for payment required */
.model-preset-btn.disabled-payment .button-overlay::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f023";  /* Lock/padlock icon */
    font-size: 1.2em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Text shadow for better visibility */
}

/* Position padlock icon where price indicator would go */
.model-preset-btn.premium-locked::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 32px; /* Position where price would normally be, to the left of dropdown */
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    z-index: 5;
    pointer-events: none;
}

.upload-documents-btn.premium-locked::after {
    top: 30%;
    right: 30%;
    font-size: 14px;
    transform: translate(50%, 50%);
}

/* Style for disabled upload buttons */
.upload-documents-btn.disabled {
    cursor: pointer;
    position: relative;
    opacity: 0.95;
    transition: opacity 0.3s ease;
    box-shadow: none;
}

/* Specific overlay content for login required */
.upload-documents-btn.disabled-login .button-overlay::before {
    content: "\f023"; /* Lock icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.2em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Specific overlay content for payment required */
.upload-documents-btn.disabled-payment .button-overlay::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f3d1"; /* Credit card icon */
    font-size: 1.2em;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Show the overlay for upload buttons when disabled */
.upload-documents-btn.disabled .button-overlay {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.5);
}

.premium-locked:hover {
    opacity: 0.8;
}

/* Tooltip for locked features */
.premium-locked .locked-tooltip {
    display: none;
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    z-index: 100;
}

.premium-locked:hover .locked-tooltip {
    display: block;
}

/* Enhance tooltip visibility on hover for better UX */
.model-preset-btn.disabled:hover,
.upload-documents-btn.disabled:hover {
    transition: opacity 0.2s ease;
}

/* Dark theme dropdown menu styling */
.dropdown-menu {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
    border-radius: 8px !important;
    min-width: 180px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

.dropdown-item {
    color: var(--text-color) !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    transition: all 0.2s ease !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--hover-color) !important;
    color: var(--text-color) !important;
}

.dropdown-item:active {
    background-color: var(--accent-color) !important;
    color: white !important;
}

/* Top navigation dropdown toggle styling */
.nav-link.dropdown-toggle {
    color: var(--text-color) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

.nav-link.dropdown-toggle:hover {
    background-color: var(--hover-color) !important;
}

.nav-link.dropdown-toggle.active {
    background-color: var(--accent-color) !important;
    color: white !important;
}
}

.model-preset-btn.disabled:hover .button-overlay,
.upload-documents-btn.disabled:hover .button-overlay {
    background-color: rgba(0, 0, 0, 0.7); /* Darker background for better visibility */
    color: white;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3); /* Add subtle glow effect */
}

/* Login prompt in sidebar */
.login-prompt {
    padding: 16px;
    text-align: center;
    color: var(--secondary-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.login-prompt p {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.login-prompt .auth-btn {
    width: 90%;
    margin-top: 12px;
    padding: 10px;
    font-size: 14px;
}

/* Shared conversation info in sidebar */
.shared-conversation-info {
    padding: 16px;
    text-align: center;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.shared-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 500;
}

.shared-indicator i {
    font-size: 16px;
}

.shared-conversation-info .conversation-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    padding: 12px 8px;
    background: var(--button-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    word-break: break-word;
    line-height: 1.3;
}

.guest-action {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guest-action p {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
    color: var(--secondary-text);
}

.guest-action .auth-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
}

/* Document Upload Button */
.upload-documents-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--button-bg);
    color: var(--secondary-text);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.upload-documents-btn:hover {
    background-color: var(--hover-color);
    color: var(--text-color);
}

/* Reset Presets Button - Uses same styling as upload button */
.reset-presets-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--button-bg);
    color: var(--secondary-text);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.reset-presets-btn:hover {
    background-color: var(--hover-color);
    color: var(--text-color);
}

/* Document Upload Modal */
.document-upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.document-upload-content {
    width: 90%;
    max-width: 600px;
    background-color: var(--bg-color);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.document-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.document-upload-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-color);
}

.close-upload-modal {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    cursor: pointer;
}

.document-upload-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.upload-dropzone:hover {
    border-color: var(--accent-color);
    background-color: var(--hover-color);
}

.upload-dropzone input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 36px;
    color: var(--secondary-text);
    margin-bottom: 10px;
}

.upload-file-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 15px;
}

.upload-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: var(--hover-color);
    margin-bottom: 8px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    font-size: 18px;
    color: var(--secondary-text);
}

.file-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file {
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
}

.upload-status {
    margin-top: 10px;
    font-size: 14px;
    color: var(--secondary-text);
}

.document-upload-footer {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

.upload-files-btn {
    padding: 8px 16px;
    border-radius: 6px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.upload-files-btn:hover {
    background-color: #1c9599;
}

.upload-progress {
    height: 5px;
    width: 100%;
    background-color: var(--border-color);
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background-color: var(--accent-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Model Selector */
.model-selector {
    display: none;
    position: fixed;
    width: 300px;
    max-height: 400px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    overflow: hidden;
    /* Position will be set dynamically via JavaScript */
}

.selector-header {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: center;
}

.selector-header input {
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--text-color);
    font-size: 14px;
    outline: none;
}

.close-selector {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-selector:hover {
    background-color: var(--hover-color);
    color: var(--text-color);
}

.model-list-container {
    max-height: 350px;
    overflow-y: auto;
}

.model-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.model-list li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.model-list li.disabled-model {
    opacity: 0.5;
}

.model-list li:hover {
    background-color: var(--hover-color);
}

.selector-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

/* For desktop version - matches mobile minimalist style */
.reset-to-default-btn {
    background-color: var(--button-bg);
    color: rgba(36, 185, 189, 0.9); /* Subtle accent color */
    border: 1px solid rgba(36, 185, 189, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.reset-to-default-btn:hover {
    background-color: rgba(36, 185, 189, 0.05);
    border-color: rgba(36, 185, 189, 0.3);
}

.reset-to-default-btn:active {
    transform: scale(0.98);
}

.reset-to-default-btn i {
    font-size: 12px;
}

.model-list li .model-provider {
    font-size: 12px;
    color: var(--secondary-text);
    margin-left: auto;
}

.model-list li .free-tag {
    background-color: #254344; /* Updated from var(--accent-color) (#24b9bd) */
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    margin-right: 6px;
}

.input-group {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px 2px 16px; /* Reduced bottom padding */
    background-color: var(--input-bg);
    margin-bottom: 4px; /* Reduced margin */
    position: relative;
}

#message-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-color);
    resize: none;
    min-height: 80px; /* Starting height */
    max-height: 40vh; /* Limited via JavaScript as well */
    outline: none;
    font-size: 15px;
    line-height: 1.5;
    padding: 8px 0 4px 0; /* Reduced padding */
    overflow-y: auto; /* Add scrollbar when content exceeds max-height */
}

.send-btn {
    background-color: transparent;
    color: var(--accent-color);
    border: none;
    cursor: pointer;
    margin-left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-btn:hover {
    background-color: rgba(36, 185, 189, 0.1);
}

/* The standalone disclaimer is removed as it's now part of the footer */

/* Image Upload and Camera UI */
/* New container for message action buttons */
.message-actions-container {
    width: 100%;
    border-top: 1px solid var(--border-color-light);
    padding: 4px 0 2px 0; /* Reduced padding */
    display: flex;
    justify-content: flex-end;
    min-height: 36px; /* Reduced minimum height */
    background-color: var(--input-bg); /* Match with input background */
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 4px; /* Reduced gap between buttons */
}

/* Mobile-specific adjustments for message action buttons */
@media screen and (max-width: 576px) {
    .message-actions {
        gap: 10px; /* Moderate space between buttons for tapping (reduced from 16px) */
        padding-right: 6px; /* Reduced right padding */
    }
    
    /* Adjust spacing for the message actions container on mobile */
    .message-actions-container {
        padding: 6px 8px 4px 8px; /* Reduced padding for more compact layout */
        background-color: var(--input-bg); /* Match input background */
        min-height: 32px; /* Even smaller minimum height on mobile */
    }
    
    /* Position the send button with better spacing */
    .message-actions .send-btn {
        margin-left: 4px; /* Reduced space from other buttons */
    }
    
    /* Group the document upload and camera buttons */
    .message-actions #file-upload-button,
    .message-actions #camera-button {
        margin-right: 2px; /* Reduced spacing between these two */
    }
    
    /* Ensure text area gets more space on mobile */
    #message-input {
        height: 100px; /* Ensure height is maintained on mobile */
    }
}

#file-upload-button, #camera-button {
    background-color: transparent;
    color: var(--secondary-text);
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    position: relative;
}

#file-upload-button:hover, #camera-button:hover {
    background-color: rgba(36, 185, 189, 0.1);
    color: var(--accent-color);
}

#file-upload-button.loading, #camera-button.loading {
    pointer-events: none;
    animation: pulse 1.5s infinite;
}

/* Button pressed states for immediate feedback */
#camera-button.button-pressed,
#file-upload-button.button-pressed {
    transform: translateY(1px);
    background-color: rgba(36, 185, 189, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Camera loading overlay and spinner */
.camera-loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 15px;
}

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

/* Upload indicator */
#upload-indicator {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

/* Upload indicator states */
#upload-indicator.preparing {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
}

#upload-indicator.waiting {
    background-color: rgba(108, 117, 125, 0.1);
    color: #6c757d;
    border-color: rgba(108, 117, 125, 0.3);
}

#upload-indicator.processing {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--accent-color);
    border-color: rgba(6, 182, 212, 0.3);
}

/* Upload loading spinner */
.upload-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 1s ease-in-out infinite;
}

#upload-indicator i.fa-spinner {
    animation: spin 1.5s linear infinite;
}

/* PDF indicator styling - using muted green to match UI */
.pdf-indicator {
    background-color: rgba(76, 217, 100, 0.1) !important;
    border: 1px solid rgba(76, 217, 100, 0.3) !important;
    color: #4cd964 !important; /* Muted green to match the color scheme */
}

.pdf-indicator i.fa-file-pdf {
    color: #4cd964; /* Muted green to match the color scheme */
}

/* PDF upload indicator styling - updated to green color scheme */
.upload-indicator.pdf-upload {
    background-color: rgba(76, 217, 100, 0.1) !important;
    border: 1px solid rgba(76, 217, 100, 0.3) !important;
    color: #4cd964 !important; /* Muted green to match the color scheme */
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.upload-indicator.pdf-upload.success {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: #10b981 !important;
}

.upload-indicator.pdf-upload.error {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #ef4444 !important;
}

/* Guest sign-in prompt styling */
.guest-signin-prompt {
    margin: -100px 20px 20px 20px;
    padding: 0;
    background: transparent;
}

.signin-prompt-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.signin-prompt-content i {
    font-size: 24px;
    color: var(--accent-color);
    margin-bottom: 12px;
    display: block;
}

.signin-prompt-content p {
    color: var(--text-color);
    font-size: 16px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-color);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.signin-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    color: white;
    text-decoration: none;
}

.signin-btn i {
    font-size: 16px;
    margin: 0;
}

/* Document preview area styling */
#document-preview-area {
    background-color: var(--input-bg);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 10px;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: fade-in 0.3s ease-in-out;
    position: relative;
    min-height: 95px;
}

#document-preview-area.multi-document {
    justify-content: flex-start;
    padding: 20px 12px 12px;
}

.document-counter {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    z-index: 2;
}

.document-preview-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 5px;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.document-preview-container.image-document {
    border: 1px solid rgba(0, 150, 200, 0.5);
}

.document-preview-container.pdf-document {
    border: 1px solid rgba(76, 217, 100, 0.5);
    background-color: rgba(76, 217, 100, 0.1);
}

.document-preview-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.2s;
}

.document-preview-container:hover .document-preview-thumbnail {
    transform: scale(1.05);
}

.document-preview-container .document-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: #e53e3e;
}

.document-preview-container .document-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px;
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* PDF filename styling */
.pdf-preview-thumbnail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
}

.pdf-preview-thumbnail i {
    font-size: 32px;
    color: #4cd964; /* Muted green to match our color scheme */
    margin-bottom: 5px;
}

.pdf-filename {
    font-size: 11px;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 6px;
    border-radius: 3px;
    max-width: 95%;
    word-wrap: break-word;
    display: block;
    text-align: center;
    margin-top: 4px;
}

.remove-document-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    z-index: 2;
}

.remove-document-btn:hover {
    background: rgba(239, 68, 68, 0.9);
}

/* Improved Responsive Attachment Previews */

/* 1. Main Container for All Attachment Previews */
.attachment-previews-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

/* 2. Image Thumbnail Styling */
.attachment-thumbnail {
    position: relative;
    height: 75px;
    width: 75px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #333;
}

.image-preview {
    position: relative;
    height: 75px;
    width: 75px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #333;
}

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

.remove-image {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #555;
    color: white;
    border: 2px solid var(--bg-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* 3. PDF Preview Styling */
.pdf-preview {
    display: flex;
    align-items: center;
    background-color: var(--input-bg);
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 100%;
    border: 1px solid var(--border-color);
}

.pdf-icon {
    font-size: 24px;
    margin-right: 8px;
    color: var(--accent-color);
}

.pdf-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    color: var(--text-color);
}

/* 4. Remove Button Styling (for both types) */
.remove-attachment-btn, .remove-pdf {
    background-color: #555;
    color: white;
    border: 2px solid var(--bg-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.remove-attachment-btn:hover, .remove-pdf:hover {
    background-color: #e53e3e;
    transform: scale(1.1);
}

/* Specific positioning for each button type */
.remove-attachment-btn {
    position: absolute;
    top: -5px;
    right: -5px;
}

.remove-pdf {
    margin-left: 10px;
}

/* PDF Viewer Modal Styling */
#pdf-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

#pdf-viewer-modal .modal-content {
    background-color: var(--bg-color);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#pdf-viewer-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

#pdf-viewer-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-color);
}

#pdf-viewer-modal .close-button {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
}

#pdf-viewer-modal .modal-body {
    padding: 15px;
    overflow: auto;
    flex-grow: 1;
}

#pdf-iframe {
    border: none;
    width: 100%;
    height: 70vh;
    background-color: white;
}

.remove-file-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

/* PDF Viewer Modal Styling - used for PDF attachment display */
#pdf-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

#pdf-viewer-modal .modal-content {
    background-color: var(--bg-color);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#pdf-viewer-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

#pdf-viewer-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-color);
}

#pdf-viewer-modal .close-button {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
}

#pdf-viewer-modal .modal-body {
    padding: 15px;
    overflow: auto;
    flex-grow: 1;
}

#pdf-iframe {
    border: none;
    width: 100%;
    height: 70vh;
    background-color: white;
}

.remove-file-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

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

/* Image preview area */
.image-preview-container {
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.image-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.image-preview {
    max-width: 150px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-preview-remove {
    background-color: transparent;
    color: var(--secondary-text);
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.image-preview-remove:hover {
    color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.1);
}

/* Removed legacy image-preview-area styles in favor of unified document preview */
/* These styles have been consolidated into the document-preview section */

.more-images-indicator {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 8px;
}

.image-preview-thumbnail {
    max-width: 100px;
    max-height: 100px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.image-preview-thumbnail:hover {
    transform: scale(1.05);
}

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

/* Removed legacy #image-preview styles in favor of unified document preview */
/* These styles have been consolidated with the document-item styling */

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.remove-image-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

/* Legacy remove-image-button style removed in favor of unified document controls */

.clear-all-documents-btn, .clear-all-images-btn {
    /* Unified document button style - muted green color scheme */
    background-color: rgba(76, 217, 100, 0.2);
    color: #4cd964;
    border: 1px solid rgba(76, 217, 100, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s ease;
}

.clear-all-documents-btn:hover, .clear-all-images-btn:hover {
    background-color: rgba(76, 217, 100, 0.3);
    transform: translateY(-1px);
}

/* Legacy button hover styles removed */

/* Button active state */
.document-control-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Camera Modal */
#camera-modal {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fade-in 0.3s ease-out;
    padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 10px) env(safe-area-inset-left, 10px);
}

.camera-modal-content {
    background-color: var(--bg-color);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent-color);
    animation: scale-in 0.3s ease-out;
}

@keyframes scale-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.camera-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    position: relative;
    z-index: 1101;
    padding-top: max(env(safe-area-inset-top), 15px);
    min-height: 50px;
}

#close-camera-button {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--accent-color);
    color: white;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1200;
}

#close-camera-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: scale(1.1);
}

#camera-stream {
    width: 100%;
    height: auto;
    max-height: 60vh;
    border-radius: 8px;
    background-color: #000;
    object-fit: contain; /* Ensure consistent video scaling behavior */
}

/* Camera Controls Row - Portrait Mode (default) */
.camera-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 10px;
    border-top: 1px solid var(--border-color);
}

/* Camera Controls Sidebar - Portrait Mode (default layout as column) */
.camera-controls-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 200px;
}

.zoom-control label {
    color: var(--accent-color);
    font-size: 14px;
}

#zoom-slider {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    appearance: none;
}

#zoom-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
}

#zoom-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#zoom-value {
    font-size: 12px;
    color: var(--secondary-text);
    min-width: 35px;
}

.btn.btn-control {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn.btn-control:hover {
    background: rgba(36, 185, 189, 0.2);
    transform: scale(1.1);
}

.btn.btn-control.active {
    background: var(--accent-color);
    color: white;
}

.camera-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.btn.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn.btn-primary:hover {
    background-color: #1d9a9d;
}

.btn.btn-secondary {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn.btn-secondary:hover {
    background-color: var(--hover-color);
}

/* Loading indicator styles */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease infinite;
}

/* Remove custom scrollbars for better mobile behavior */

/* Dark scrollbars on desktop */
@media (min-width: 768px) {
    body, .sidebar, .chat-messages {
        scrollbar-width: thin;
        scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    }

    body::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .chat-messages::-webkit-scrollbar {
        width: 8px;
    }

    body::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track, .chat-messages::-webkit-scrollbar-track {
        background: var(--scrollbar-track);
    }

    body::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .chat-messages::-webkit-scrollbar-thumb {
        background-color: var(--scrollbar-thumb);
        border-radius: 4px;
        border: 2px solid var(--scrollbar-track);
    }
}

/* Typing indicator animation */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 8px 0;
}

.typing-indicator span {
    display: block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: var(--accent-color);
    border-radius: 50%;
    opacity: 0.6;
    animation: typing-animation 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-animation {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Code block styling */
pre {
    background-color: #1e1e1e;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
    white-space: pre;
    word-wrap: normal;
    max-width: 100%;
}

code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.message-content code {
    background-color: #2a2a2a;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Mobile-specific code block styles */
@media (max-width: 576px) {
    .message-content {
        font-size: 14px; /* Slightly smaller font for better fit on mobile */
    }
    
    .message-content pre,
    .message-content code {
        overflow-x: auto;
        white-space: pre;
        word-wrap: normal;
        max-width: 100%;
    }
}

/* System Message styling */
.system-message {
    text-align: center;
    color: var(--secondary-text);
    background-color: rgba(0, 0, 0, 0.1);
    padding: 10px 16px;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 80%;
    font-style: italic;
}

/* Error message styling */
.error {
    color: #ff5555;
}

/* Button Loading and Feedback States */
.model-preset-btn.loading {
    opacity: 0.7;
    position: relative;
}

.model-preset-btn.loading::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    right: 10px;
    margin-top: -7px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: white;
    border-radius: 50%;
    animation: button-spinner 0.6s linear infinite;
}

.model-preset-btn.save-success {
    /* Brief flash of green or checkmark */
    border-color: #4CAF50;
}

.model-preset-btn.save-error {
    /* Brief flash of red */
    border-color: #F44336;
}

@keyframes button-spinner {
    to {transform: rotate(360deg);}
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .model-buttons {
        flex-wrap: nowrap;
        overflow-x: visible;
        width: 100%;
        padding-right: 12px; /* Add some padding for safety */
        box-sizing: border-box;
    }
    
    .model-preset-container {
        width: 75%; /* Maintain 75% width on smaller screens */
        max-width: 75%;
        flex-wrap: nowrap;
        overflow-x: visible;
    }
    
    .model-preset-btn {
        min-width: 0; /* Remove fixed min-width to allow better shrinking */
        max-width: 100%; /* Ensure buttons don't exceed their container */
    }
    
    .model-preset-btn .model-name {
        font-size: 11px; /* Even smaller font for mobile */
        max-width: calc(100% - 28px); /* Allow text to truncate if needed */
    }
    
    /* Better handle the send button and actions to prevent overflow */
    .input-group {
        display: flex;
        flex-wrap: nowrap; /* Prevent wrapping */
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure text area gets priority in space allocation */
    #message-input {
        flex: 1;
        min-width: 0; /* Allow textarea to shrink if needed */
    }
}

/* Sidebar toggle button (only visible on mobile) */
.sidebar-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
}

.header-left {
    display: flex;
    align-items: center;
}

/* Sidebar backdrop for mobile overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1090; /* Just below sidebar but above other elements */
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ========== NEW MOBILE UI STYLES ========== */

/* Hide desktop model buttons on mobile */
@media (max-width: 576px) {
    .desktop-only {
        display: none !important;
    }
}

/* Hide mobile elements on desktop */
@media (min-width: 577px) {
    .mobile-model-buttons,
    .mobile-model-panel,
    .mobile-model-selection,
    .mobile-panel-backdrop {
        display: none !important;
    }
}

/* Mobile Model Notification */
.mobile-model-notification {
    display: none;
    position: fixed;
    bottom: 80px; /* Position above the model buttons */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(50, 50, 50, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
    z-index: 1001; /* Above other elements */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.mobile-model-notification.show {
    display: block;
    opacity: 1;
}

/* Mobile Send Button Enhancements */
@media screen and (max-width: 576px) {
    /* Highlighted state for send button on mobile */
    #send-button.mobile-highlight {
        background-color: #24b9bd;
        box-shadow: 0 0 8px rgba(36, 185, 189, 0.5);
        transform: scale(1.05);
    }
    
    /* Active touch state */
    #send-button.active-touch {
        background-color: #1a8a8e;
        transform: scale(0.95);
    }
    
    /* Make the button slightly larger on mobile for easier tapping */
    .chat-input-container #send-button {
        width: 42px;
        height: 42px;
        transition: all 0.2s ease;
    }
    
    /* Ensure the textarea has enough vertical padding to avoid getting hidden behind keyboard */
    .chat-input-container .user-input {
        padding-bottom: 12px;
    }
}

/* Mobile Numbered Buttons (1-6) */
.mobile-model-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 4px;
    width: 100%;
}

/* Refined mobile preset buttons - Minimalist approach */
.mobile-preset-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(30, 30, 30, 0.8); /* Darker background */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    line-height: 14px;
    padding: 0;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

/* Make the icon slightly larger for better visibility */
.mobile-preset-btn i {
    font-size: 16px;
}

/* Styling for the settings icon in preset buttons */
.preset-settings-icon {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: rgba(15, 15, 15, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    font-size: 10px;
    color: #24b9bd; /* Accent color */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.preset-settings-icon i {
    font-size: 9px !important;
}

/* Color scheme for the buttons - applying colors to icons */
.mobile-preset-btn[data-preset-id="1"] > i {
    color: #5D8BF4; /* Blue */
}

.mobile-preset-btn[data-preset-id="2"] > i {
    color: #9D65D0; /* Purple */
}

.mobile-preset-btn[data-preset-id="3"] > i {
    color: #FF8C61; /* Orange */
}

.mobile-preset-btn[data-preset-id="4"] > i {
    color: #24b9bd; /* Accent color - cyan for multimodal */
}

.mobile-preset-btn[data-preset-id="5"] > i {
    color: #FC5C9C; /* Pink for search */
}

.mobile-preset-btn[data-preset-id="6"] > i {
    color: #28a745; /* Green */
}

/* Subtle ripple effect */
.mobile-preset-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: currentColor;
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.mobile-preset-btn:active::after {
    animation: subtle-ripple 0.4s ease-out;
}

.mobile-preset-btn:active {
    transform: scale(0.97);
}

/* Active state - elegant with subtle elevation and glow */
.mobile-preset-btn.active {
    background-color: rgba(15, 15, 15, 0.95); /* Darker background when active */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Active state - color-specific glows */
.mobile-preset-btn.active[data-preset-id="1"] {
    box-shadow: 0 0 6px rgba(93, 139, 244, 0.4);
}

.mobile-preset-btn.active[data-preset-id="2"] {
    box-shadow: 0 0 6px rgba(157, 101, 208, 0.4);
}

.mobile-preset-btn.active[data-preset-id="3"] {
    box-shadow: 0 0 6px rgba(255, 140, 97, 0.4);
}

.mobile-preset-btn.active[data-preset-id="4"] {
    box-shadow: 0 0 6px rgba(36, 185, 189, 0.4);
}

.mobile-preset-btn.active[data-preset-id="5"] {
    box-shadow: 0 0 6px rgba(252, 92, 156, 0.4);
}

.mobile-preset-btn.active[data-preset-id="6"] {
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.4);
}

/* Make icons slightly brighter when active */
.mobile-preset-btn.active > i {
    filter: brightness(1.2);
}

/* Settings icon hover effect */
.preset-settings-icon:hover {
    transform: scale(1.1);
    background-color: rgba(10, 10, 10, 1);
}

/* Bottom indicator for active state - subtle ring */
.mobile-preset-btn.active::before {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: currentColor;
}

/* More subtle ripple animation */
@keyframes subtle-ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.1;
    }
    20% {
        transform: scale(20, 20);
        opacity: 0.1;
    }
    100% {
        opacity: 0;
        transform: scale(35, 35);
    }
}

/* Free preset with consistent styling */
.mobile-preset-btn.free-preset i {
    color: #28a745; /* Green */
}

.mobile-preset-btn.free-preset.active {
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.4);
}

/* Refined panel toggle button - matches mobile preset button style */
.mobile-model-panel-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(30, 30, 30, 0.8); /* Darker background */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    margin-left: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
}

.mobile-model-panel-toggle i {
    color: #24b9bd; /* Accent color - cyan */
}

.mobile-model-panel-toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: currentColor;
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.mobile-model-panel-toggle:active::after {
    animation: subtle-ripple 0.4s ease-out;
}

.mobile-model-panel-toggle:active {
    transform: scale(0.97);
    background-color: rgba(36, 185, 189, 0.12);
}

/* Mobile Bottom Sheet Panels */
.mobile-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-panel-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

.mobile-model-panel,
.mobile-model-selection {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* Higher than other elements */
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 80vh; /* Limit to 80% of viewport height */
    min-height: 40vh; /* Ensure minimum height for content */
    overflow: hidden; /* Hide overflow on container */
}

.mobile-model-panel.visible,
.mobile-model-selection.visible {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-weight: bold;
    font-size: 16px;
}

.panel-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0;
}

.panel-close-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    opacity: 0.7;
    padding: 8px;
}

.panel-content {
    padding: 8px 0;
    overflow-y: auto;
    flex: 1; /* Expand to fill available space */
    min-height: 0; /* Allow shrinking for flex */
}

/* Refined panel preset buttons - matches the minimalist aesthetic */
.mobile-panel-preset-btn {
    display: flex !important; /* Force display */
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
    text-align: left;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    visibility: visible !important; /* Force visibility */
    opacity: 1 !important; /* Force opacity */
}

/* Add subtle left border for preset identification and colored icons */
.mobile-panel-preset-btn[data-preset-id="1"] {
    border-left: 3px solid rgba(93, 139, 244, 0.3); /* Blue */
}
.mobile-panel-preset-btn[data-preset-id="1"] .model-icon {
    color: #5D8BF4; /* Blue */
}

.mobile-panel-preset-btn[data-preset-id="2"] {
    border-left: 3px solid rgba(157, 101, 208, 0.3); /* Purple */
}
.mobile-panel-preset-btn[data-preset-id="2"] .model-icon {
    color: #9D65D0; /* Purple */
}

.mobile-panel-preset-btn[data-preset-id="3"] {
    border-left: 3px solid rgba(255, 140, 97, 0.3); /* Orange */
}
.mobile-panel-preset-btn[data-preset-id="3"] .model-icon {
    color: #FF8C61; /* Orange */
}

.mobile-panel-preset-btn[data-preset-id="4"] {
    border-left: 3px solid rgba(36, 185, 189, 0.3); /* Cyan */
}
.mobile-panel-preset-btn[data-preset-id="4"] .model-icon {
    color: #24b9bd; /* Cyan */
}

.mobile-panel-preset-btn[data-preset-id="5"] {
    border-left: 3px solid rgba(252, 92, 156, 0.3); /* Pink */
}
.mobile-panel-preset-btn[data-preset-id="5"] .model-icon {
    color: #FC5C9C; /* Pink */
}

.mobile-panel-preset-btn[data-preset-id="6"] {
    border-left: 3px solid rgba(40, 167, 69, 0.3); /* Green */
}
.mobile-panel-preset-btn[data-preset-id="6"] .model-icon {
    color: #28a745; /* Green */
}

/* Subtle ripple effect for panel buttons */
.mobile-panel-preset-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(0, 0, 0, 0.05);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.mobile-panel-preset-btn:active::after {
    animation: subtle-list-ripple 0.6s ease-out;
}

.mobile-panel-preset-btn:active {
    background-color: var(--hover-color);
}

/* More subtle ripple animation for list items */
@keyframes subtle-list-ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.05;
    }
    20% {
        transform: scale(40, 40);
        opacity: 0.05;
    }
    100% {
        opacity: 0;
        transform: scale(50, 50);
    }
}

.preset-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preset-info .model-icon {
    width: 20px;
    text-align: center;
}

.preset-action {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--secondary-text-color);
    font-size: 14px;
}

/* Styling for cost band indicators in preset panel */
.preset-cost-band, .preset-free-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 6px;
}

.preset-free-indicator {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

/* Color styles for cost bands - matching desktop */
.preset-cost-band.cost-band-1 {
    color: #24b9bd;
}

.preset-cost-band.cost-band-2 {
    color: #24b9bd;
}

.preset-cost-band.cost-band-3-warn {
    color: #ff9800;
}

.preset-cost-band.cost-band-4-danger {
    color: #e53935;
}

/* Selected model name styling */
.selected-model-name {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-model-name-text {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile Model Selection Panel */
.selection-search {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

/* Refined search input - subtle and minimalist */
#mobile-model-search {
    width: 100%;
    padding: 12px 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

#mobile-model-search:focus {
    outline: none;
    border-color: rgba(36, 185, 189, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.mobile-model-list-container {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
    position: relative;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* Loading spinner for mobile models */
.mobile-models-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 5;
}

.mobile-models-loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3B82F6;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 10px;
}

.loading-text {
    font-size: 14px;
    color: #4B5563;
}

.empty-models-message {
    text-align: center;
    padding: 20px;
    color: #6B7280;
    font-size: 14px;
}

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

.mobile-model-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* Refined model list items - subtle and elegant */
.mobile-model-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

/* Subtle ripple effect for list items */
.mobile-model-list li::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(0, 0, 0, 0.05);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.mobile-model-list li:active::after {
    animation: subtle-list-ripple 0.6s ease-out;
}

.mobile-model-list li.disabled-model {
    opacity: 0.5;
}

.mobile-model-list li:active {
    background-color: var(--hover-color);
}

.mobile-model-list li.active {
    background-color: rgba(36, 185, 189, 0.05); /* Very subtle accent color background */
    border-left: 3px solid #24b9bd; /* Left border indicator */
    padding-left: 13px; /* Adjust padding to account for border */
}

.mobile-model-list .model-info {
    flex: 1;
}

.mobile-model-list .model-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.mobile-model-list .model-description {
    font-size: 12px;
    color: var(--secondary-text-color);
}

.mobile-model-list .model-cost {
    font-size: 12px;
    color: var(--secondary-text-color);
    display: flex;
    align-items: center;
}

/* Free model indicator */
.mobile-model-list .model-cost.free-model {
    color: #28a745;
}

/* Cost band indicators in mobile model list */
.mobile-model-list .cost-band-indicator {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    margin-left: 0;
}

/* Mobile cost band styles - matching desktop */
.mobile-model-list .cost-band-1 {
    color: #24b9bd;
}

.mobile-model-list .cost-band-2 {
    color: #24b9bd;
}

.mobile-model-list .cost-band-3-warn {
    color: #ff9800;
}

.mobile-model-list .cost-band-4-danger {
    color: #e53935;
}

/* Loading placeholder for mobile model list */
.loading-placeholder {
    opacity: .6;
    font-style: italic;
    pointer-events: none;  /* ensure it's not clickable */
}

.panel-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.panel-footer button {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* Enhanced mobile touchable elements */
@media (max-width: 576px) {
    button, 
    .send-btn,
    .action-btn {
        min-height: 42px;
        touch-action: manipulation;
    }
    
    button:active,
    .send-btn:active,
    .action-btn:active {
        opacity: 0.8;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
}

@media (max-width: 576px) {
    .app-container {
        flex-direction: column;
    }
    
    /* Show the sidebar toggle button on mobile and keep it fixed */
    .sidebar-toggle-btn {
        display: block;
        position: fixed;
        top: 60px; /* Place below the global navigation bar */
        left: 8px;
        z-index: 1050; /* Above chat content but below sidebar */
    }
    
    /* Make the sidebar a slide-in overlay on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px; /* Start off-screen */
        width: 280px;
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height if supported */
        z-index: 1100; /* Higher than fixed input container */
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    }
    
    /* When the sidebar is active, slide it in */
    .sidebar.active {
        left: 0;
    }
    
    /* Show backdrop when sidebar is active */
    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }
    
    .conversation-list {
        max-height: calc(100vh - 170px); /* Adjust for sidebar header and footer */
        max-height: calc(100dvh - 170px); /* Use dynamic viewport height if supported */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Chat container layout */
    .chat-container {
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height if supported */
        width: 100%;
        max-width: 100vw;
        overflow: hidden; /* Remove overflow from container */
        display: flex;
        flex-direction: column;
        position: relative;
    }
    
    .chat-container {
        padding-top: 50px; /* Add padding to the top to account for the fixed header */
    }
    
    /* Mobile fixed navigation */
    .top-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
    }
    
    /* Chat messages */
    .chat-messages {
        flex: 1;
        padding: 20px;
        padding-bottom: 700px; /* Increased padding to ensure last message and action buttons are fully visible */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        height: 0; /* Allow flex to control height */
        min-height: 0; /* Allow flex shrinking */
    }

    /* Apply same bottom padding to all mobile views */
    .balance-card,
    .tab-content,
    .account-container,
    .conversation-list,
    .sidebar-content,
    .modal-body {
        padding-bottom: 700px; /* Increased padding for better accessibility of bottom elements */
    }

    /* Ensure action buttons (copy/share) have extra space below them */
    .message-actions,
    .message-metadata {
        margin-bottom: 20px; /* Additional space below action buttons */
    }
    
    /* Fixed input area at the bottom for mobile */
    .chat-input-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0;
        width: 100%;
        padding: 12px 8px;
        background-color: var(--bg-color);
        z-index: 999;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        max-height: 50vh; /* Prevent input from taking too much screen space */
        overflow: visible; /* Remove internal scrolling - let content expand naturally */
    }
    
    /* Class added when keyboard is visible */
    .chat-input-container.keyboard-visible {
        bottom: 0;
    }
    
    /* Adjust input container when keyboard is visible */
    .chat-input-container.keyboard-visible .input-group {
        margin-bottom: 0;
    }
    
    /* Ensure message input doesn't push buttons off screen when keyboard is visible */
    .chat-input-container.keyboard-visible #message-input {
        min-height: 40px;
        max-height: calc(100vh - 240px); /* Adjusted max height when keyboard is visible */
        height: auto; /* Allow height to adjust based on content */
    }
    
    /* Make the border between text area and button container more subtle */
    .chat-input-container .message-actions-container {
        border-top-color: rgba(128, 128, 128, 0.2);
    }
    
    .app-title h1 {
        font-size: 0.9rem; /* Smaller title on mobile screens */
    }
    
    /* Hide logo when chat is active on mobile */
    body.mobile-chat-active .logo {
        display: none !important;
    }
    
    .header-account-link {
        padding: 4px 6px; /* Smaller padding on mobile screens */
    }
    
    .header-account-link .account-link-text {
        display: none; /* Hide text on small screens, show only icon */
    }
    
    .model-preset-container {
        width: 75%; /* Maintain 75% of screen width */
        max-width: 75%;
    }
    
    /* Mobile optimizations for touch inputs */
    #message-input {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }
    
    /* Make buttons slightly larger for easier touch targets */
    .message-actions button,
    #sidebar-toggle {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }
    
    /* Adjust spacing for message actions */
    .message-actions {
        gap: 8px;
        display: flex;
        align-items: center;
        flex-shrink: 0; /* Prevent the action buttons from shrinking */
    }
    
    .model-buttons {
        gap: 4px; /* Reduce gap on very small screens */
    }
    
    .model-preset-container {
        gap: 4px; /* Reduce gap on very small screens */
    }
    
    /* Mobile-specific preset button adaptations */
    .model-preset-btn {
        padding: 8px !important; /* Full button padding */
        min-height: 42px; /* Larger touch target */
        position: relative; /* Ensure positioning context */
    }
    
    /* Hide the dropdown section on mobile - we'll use long press instead */
    .model-preset-btn .selector-icon-container {
        opacity: 0.3; /* Make less prominent but still visible as an indicator */
        width: 16px; /* Smaller width on mobile */
        position: absolute; 
        right: 4px;
        pointer-events: none !important; /* Disable direct interactions - long press will be used instead */
    }
    
    /* Add visual feedback for touch interactions */
    .model-preset-btn:active {
        background-color: var(--hover-color);
        transition: background-color 0.1s; /* Faster transition for touch feedback */
    }
    
    /* Make the dropdown cover the full screen on mobile */
    #model-selector {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-height: 80vh !important;
        z-index: 1000 !important;
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Adjust input group and send button to prevent overflow */
    .input-group {
        padding-right: 4px;
        align-items: center; /* Better vertical alignment */
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
        min-width: 36px; /* Ensure minimum width */
    }
    
    /* Textarea uses full width since buttons are below */
    #message-input {
        width: 100%; 
        padding-right: 10px;
    }
}

/* === Cost Band Indicators === */
.cost-band-indicator {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.8em;
    vertical-align: middle;
    padding: 1px 4px; /* Subtle background */
    border-radius: 3px;
    font-weight: 600; /* Make symbols slightly bolder */
    line-height: 1; /* Ensure consistent height */
}

/* Specific band styles */
.cost-band-free {
    /* Optional: Style for free models if desired */
    color: #24b9bd;
}

.cost-band-1 {
    color: #24b9bd;
}

.cost-band-2 {
    color: #24b9bd;
}

.cost-band-3-warn {
    color: #ff9800;
}

.cost-band-4-danger {
    color: #e53935;
}

/* Footer Legal Links */
.footer-legal-links {
    text-align: center;
    padding: 25px 15px; 
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: var(--bg-color);
    /* No fixed/sticky positioning - it will be at the end of the scrollable content */
}

/* Compressed footer for mobile devices */
@media (max-width: 576px) {
    .footer-legal-links {
        padding: 0 10px; /* Remove vertical padding, keep horizontal */
        margin-top: 5px;
        margin-bottom: 0;
        font-size: 10px;
        line-height: 1.2;
        position: relative; /* Ensure it's in the normal content flow */
        z-index: 500; /* Well below the input container */
    }
}

.footer-legal-links a {
    color: var(--secondary-text);
    text-decoration: none;
    margin: 0 6px; /* Reduced from 8px to 6px */
    transition: color 0.2s;
}

.footer-legal-links a:hover {
    color: var(--accent-color);
}

.footer-legal-links .copyright {
    margin-left: 6px; /* Reduced from 8px to 6px */
    font-size: 11px;
}

/* Compact footer links for mobile */
@media (max-width: 576px) {
    .footer-legal-links a {
        margin: 0 3px;
    }
    
    .footer-legal-links a:after {
        content: "•";
        display: inline-block;
        margin-left: 6px;
        opacity: 0.5;
    }
    
    .footer-legal-links a:last-of-type:after {
        content: "";
        margin-left: 0;
    }
    
    .footer-legal-links .copyright {
        margin-left: 3px;
        font-size: 9px;
    }
}

.footer-legal-links .disclaimer-text {
    margin: 0 8px; /* Reduced from 12px to 8px */
    font-size: 11px;
    font-style: italic;
}

/* Compact disclaimer for mobile */
@media (max-width: 576px) {
    .footer-legal-links .disclaimer-text {
        margin: 0 4px;
        font-size: 9px;
        display: inline-block;
    }
}

/* Policy Pages Styles */
.policy-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow-y: auto;
    line-height: 1.6;
}

.policy-container h1 {
    color: var(--accent-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.policy-container h2 {
    color: var(--text-color);
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.policy-container p {
    margin-bottom: 15px;
}

.policy-container ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.policy-container li {
    margin-bottom: 5px;
}

.policy-container a {
    color: var(--accent-color);
    text-decoration: none;
}

.policy-container a:hover {
    text-decoration: underline;
}

.policy-container .return-link {
    display: inline-block;
    margin-top: 30px;
    color: var(--accent-color);
    font-weight: bold;
}

/* Shared conversation styles */
.shared-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.shared-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.shared-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.shared-date {
    margin-left: 1rem;
}

.shared-chat {
    height: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.shared-footer {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.navbar-shared-indicator {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.navbar-shared-indicator i {
    margin-right: 0.5rem;
}

/* Mobile Preset Number Styles - Color-coded system */
.preset-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: white;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Color scheme for each preset number */
[data-preset-id="1"] .preset-number {
    background-color: #5D8BF4; /* Blue */
}

[data-preset-id="2"] .preset-number {
    background-color: #9D65D0; /* Purple */
}

[data-preset-id="3"] .preset-number {
    background-color: #FF8C61; /* Orange */
}

[data-preset-id="4"] .preset-number {
    background-color: #24b9bd; /* Accent color - cyan */
}

[data-preset-id="5"] .preset-number {
    background-color: #FC5C9C; /* Pink */
}

[data-preset-id="6"] .preset-number {
    background-color: #28a745; /* Green */
}

/* Reset All to Default button */
.reset-all-container {
    padding: 16px;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

/* Refined minimalist reset buttons */
.reset-to-default-btn,
.reset-all-to-default-btn {
    background-color: var(--button-bg);
    color: rgba(36, 185, 189, 0.9); /* Subtle accent color */
    border: 1px solid rgba(36, 185, 189, 0.2);
    border-radius: 4px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Subtle ripple effect for reset buttons */
.reset-to-default-btn::after,
.reset-all-to-default-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(36, 185, 189, 0.1);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.reset-to-default-btn:active::after,
.reset-all-to-default-btn:active::after {
    animation: subtle-ripple 0.4s ease-out;
}

.reset-all-to-default-btn:active,
.reset-to-default-btn:active {
    background-color: rgba(36, 185, 189, 0.05);
    transform: scale(0.98);
}

/* Hover state for reset buttons */
.reset-all-to-default-btn:hover,
.reset-to-default-btn:hover {
    background-color: rgba(36, 185, 189, 0.05);
    border-color: rgba(36, 185, 189, 0.3);
}

/* === iOS Safari Compatibility Fixes === */
/* iOS-specific safe area and keyboard handling */
@supports (-webkit-touch-callout: none) {
    /* iOS-only styles using CSS feature detection */
    
    /* Safe area support for iPhone notches and home indicators */
    @media (max-width: 576px) {
        body {
            padding-top: calc(60px + env(safe-area-inset-top, 0px));
        }
        
        .top-nav {
            padding-top: calc(8px + env(safe-area-inset-top, 0px));
        }
        
        .chat-input-container {
            padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        }
        
        .chat-messages {
            padding-bottom: calc(700px + env(safe-area-inset-bottom, 0px));
            /* Force proper scrolling on iOS */
            overflow-y: scroll !important;
            -webkit-overflow-scrolling: touch !important;
            transform: translateZ(0); /* Force hardware acceleration */
        }
        
        /* Fix message bubble sizing on iOS */
        .message-content {
            max-width: none !important;
            width: auto !important;
            min-height: auto !important;
            overflow: visible !important;
        }
        
        /* Fix message wrapper sizing */
        .message {
            width: 100% !important;
            max-width: none !important;
            min-height: auto !important;
        }
        
        /* Ensure proper text wrapping in bubbles */
        .message-content p {
            word-wrap: break-word !important;
            overflow-wrap: break-word !important;
            white-space: pre-wrap !important;
        }
        
        /* Fix input container positioning on iOS when keyboard appears */
        body.keyboard-visible .chat-messages {
            padding-bottom: calc(200px + env(safe-area-inset-bottom, 0px));
        }
        
        body.keyboard-visible .chat-input-container {
            position: fixed;
            bottom: env(safe-area-inset-bottom, 0px);
            left: 0;
            right: 0;
            z-index: 1001;
        }
        
        /* Ensure modal positioning works with safe areas */
        .modal-content {
            margin-top: env(safe-area-inset-top, 0px);
            margin-bottom: env(safe-area-inset-bottom, 0px);
        }
        
        /* Fix sidebar positioning with safe areas */
        .sidebar {
            padding-top: env(safe-area-inset-top, 0px);
            padding-bottom: env(safe-area-inset-bottom, 0px);
        }
    }
    
    /* Prevent zoom on input focus - iOS Safari requirement */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* Improve touch targets for iOS */
    button, .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove iOS tap highlights */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Prevent rubber band scrolling on body */
    body.ios-device {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* Dynamic viewport height support */
    .app-container.ios-device {
        height: 100vh;
        height: 100dvh;
    }
    
    /* Enhanced scrolling for chat container on iOS */
    .chat-container {
        scroll-behavior: smooth;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== CREDIT VALIDATION AND PADLOCK STYLES ===== */

/* Locked model button styling */
.model-preset-btn.model-locked {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: auto; /* Allow clicks to show message */
}

.model-preset-btn.model-locked:hover {
    transform: none; /* Disable hover animations for locked buttons */
    box-shadow: none;
}

/* Desktop padlock indicator */
.padlock-indicator.desktop-padlock {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px;
    padding: 2px 4px;
    min-width: 20px;
    min-height: 20px;
    cursor: help;
}

/* Mobile padlock overlay */
.padlock-overlay.mobile-padlock {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    backdrop-filter: blur(2px);
    z-index: 10;
}

.mobile-padlock .padlock-icon {
    font-size: 24px;
    margin-bottom: 4px;
    color: #ff6b6b;
}

.mobile-padlock .padlock-text {
    font-size: 10px;
    color: #ffffff;
    text-align: center;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Credit message popup */
.credit-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease-out;
    display: none;
}

.credit-message-content {
    padding: 20px;
    color: white;
    position: relative;
}

.credit-message-content p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

.credit-message-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
}

.credit-message-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.credit-message-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

/* Animation for credit message */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile responsive adjustments for credit message */
@media (max-width: 768px) {
    .credit-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .mobile-padlock .padlock-icon {
        font-size: 20px;
    }
    
    .mobile-padlock .padlock-text {
        font-size: 9px;
    }
}

/* Ensure padlock indicators work with existing button styles */
.model-preset-btn {
    position: relative;
    overflow: visible; /* Allow padlock to show outside button bounds if needed */
}

/* Special styling for locked free models (shouldn't happen, but just in case) */
.model-preset-btn.model-locked .cost-band-free {
    opacity: 0.5;
}

/* Ensure desktop padlock doesn't interfere with button layout */
.desktop-padlock {
    flex-shrink: 0;
}

/* Loading state for when credit balance is being checked */
.credit-checking .model-preset-btn {
    opacity: 0.7;
    pointer-events: none;
}

.credit-checking .model-preset-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Rate limit styling for models */
.rate-limit-tag {
    background-color: #f59e0b;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    margin-right: 8px;
    cursor: help;
}

.rate-limited-model {
    opacity: 0.7;
    position: relative;
}

.rate-limited-model::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(245, 158, 11, 0.1) 50%, transparent 60%);
    pointer-events: none;
}

/* Medium screen tweaks for preset buttons */
@media (max-width: 1024px) {
    .model-preset-container {
        gap: 4px;
    }

    .model-preset-btn .model-name {
        font-size: 9px;
    }

    .model-preset-btn .cost-band-indicator {
        font-size: 0.4em;
        margin-left: 3px;
    }

    .model-preset-btn .selector-icon-container {
        width: 20px;
    }
}

/* Search Buttons Styles */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.search-buttons-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.search-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--button-bg);
    color: var(--secondary-text);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 14px;
}

.search-btn:hover {
    background-color: var(--hover-color);
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.search-btn:active {
    transform: scale(0.95);
}

/* Visual indicator for active/pressed state */
.search-btn.active,
.search-btn[aria-pressed="true"] {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

/* DuckDuckGo button - standard style */
.duckduckgo-btn {
    background-color: var(--button-bg);
}

.duckduckgo-btn.active,
.duckduckgo-btn[aria-pressed="true"] {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.duckduckgo-btn:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: white;
}

/* Exa search button - premium style with sparkle effect */
.exa-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    overflow: hidden;
}

.exa-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    border-color: #5a67d8;
    color: white;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

.exa-btn.active,
.exa-btn[aria-pressed="true"] {
    background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
    border-color: #4c51bf;
    color: white;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

/* Disabled state for search buttons */
.search-btn.disabled {
    opacity: 0.6;
    pointer-events: auto;
    position: relative;
}

.search-btn.premium-locked::after {
    content: '\f023';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    pointer-events: none;
}

.search-btn.disabled .sparkle-effect {
    display: none;
}

/* Sparkle effect for premium button */
.sparkle-effect {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    opacity: 0.8;
    animation: sparkle 2s ease-in-out infinite;
}

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

/* Credit message popup */
.credit-message {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 300px;
}

.credit-message-content {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

.credit-message-content p {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 14px;
}

.credit-message-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 8px;
}

.credit-message-btn:hover {
    background: var(--accent-hover-color);
}

.credit-message-close {
    position: absolute;
    top: 5px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
}

.credit-message-close:hover {
    opacity: 1;
}

/* Focus styles for accessibility */
.search-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .search-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .search-buttons-wrapper {
        gap: 3px;
        margin-right: 6px;
    }
    
    .sparkle-effect {
        font-size: 6px;
    }
}

/* Global top navigation bar */
.top-nav {
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.top-nav .nav-tabs {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--sidebar-bg);
    margin-bottom: 0;
    padding: 0 1rem;
}

.top-nav .nav-link {
    color: var(--secondary-text);
    border: none;
    border-radius: 0;
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    background: transparent;
    transition: all 0.2s ease;
}

.top-nav .nav-link:hover {
    color: var(--text-color);
    background-color: var(--hover-color);
    border-color: transparent;
}

.top-nav .nav-link.active {
    color: var(--accent-color);
    background-color: var(--card-bg);
    border-color: var(--border-color) var(--border-color) var(--card-bg);
    border-bottom: 2px solid var(--accent-color);
}

/* Mobile responsive adjustments for navbar */
@media (max-width: 768px) {
    .top-nav .nav-tabs {
        flex-wrap: wrap;
        padding: 0 0.5rem;
    }
    
    .top-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .top-nav .nav-item.ms-auto {
        margin-left: 0 !important;
        flex: 1;
    }
    
    .top-nav .nav-item.ms-auto .nav-link {
        text-align: center;
    }
}

/* Additional top navigation styling */
.top-nav {
    padding: 0;
    margin-bottom: 0;
}

.top-nav .nav-tabs {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--sidebar-bg);
    margin-bottom: 0;
    padding: 0 1rem;
}

.top-nav .nav-link {
    color: var(--secondary-text);
    border: none;
    border-radius: 0;
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    background: transparent;
    transition: all 0.2s ease;
}

.top-nav .nav-link:hover {
    color: var(--text-color);
    background-color: var(--hover-color);
    border-color: transparent;
}

.top-nav .nav-link.active {
    color: var(--accent-color);
    background-color: var(--card-bg);
    border-color: var(--border-color) var(--border-color) var(--card-bg);
    border-bottom: 2px solid var(--accent-color);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .top-nav .nav-tabs {
        flex-wrap: wrap;
        padding: 0 0.5rem;
    }
    
    .top-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .top-nav .nav-item.ms-auto {
        margin-left: 0 !important;
        flex: 1;
    }
    
    .top-nav .nav-item.ms-auto .nav-link {
        text-align: center;
    }
}

/* Hide navbar and remove body padding during Bot Arena fullscreen mode */
body.bot-arena-fullscreen .top-nav {
    display: none;
}

/* Remove body top padding during fullscreen to allow full content display */
body:fullscreen,
body:-webkit-full-screen,
body:-moz-full-screen {
    padding-top: 0;
}
:root { --fallback-vh: 1vh; }

@media (max-width: 576px) {
  /* Use dvh when supported; 100vh remains for older engines */
  #chat-container, .chat-container {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;

    /* Keep container from fighting JS; allow messages to scroll, not the container */
    max-height: none;

    /* Avoid layout shifts during keyboard transitions */
    overflow: hidden;
    position: relative;
  }

  .chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Provide space for the input; --input-height can be added later if the app sets it */
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }

  .chat-input-container {
    /* Keep existing behavior; do NOT switch to fixed unless it already is fixed.
       We only ensure GPU layer to minimize reflow during keyboard transitions. */
    transform: translateZ(0);
    will-change: transform;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Top-level fallback for browsers that don’t support dvh */
@supports not (height: 100dvh) {
  @media (max-width: 576px) {
    #chat-container, .chat-container {
      height: calc(var(--fallback-vh, 1vh) * 100);
      min-height: calc(var(--fallback-vh, 1vh) * 100);
    }
  }
}

/* Optional iOS Safari fill-available fallback (must be top-level) */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 576px) {
    #chat-container, .chat-container {
      height: -webkit-fill-available;
      min-height: -webkit-fill-available;
    }
  }
}
