@import url('https://fonts.googleapis.com/css2?family=Jost:wght@300;400;500;600;700&display=swap');


/* CSS Variables for Theme Colors */
:root {
    --theme-primary: #ff4444;
    --theme-secondary: #ff6666;
    --theme-dark: #cc0000;
    --theme-light: #ff8888;
    --theme-shadow: rgba(255, 68, 68, 0.3);
    --theme-shadow-light: rgba(255, 68, 68, 0.2);
    --theme-shadow-strong: rgba(255, 68, 68, 0.6);
    
    /* Smooth transitions for theme changes */
    transition: all 0.3s ease;
}

/* Apply transitions to all elements that use theme colors */
*[class*="theme"], 
.page-title,
.document-selector label,
.upload-section button,
.modal-content,
.modal-header h2,
.setting-group label,
.input-area,
#question-input,
button,
.message.assistant,
.message.typing {
    transition: all 0.3s ease;
}

/* Smooth scrolling for entire page and elements */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}


body {
    font-family: 'Jost', sans-serif;
    background: rgb(4, 4, 4) !important;
    height: 100vh;
    padding: 15px;
    color: #ffffff;
    overflow: hidden;
}

/* Main Title */
.main-title {
    position: fixed;
    top: 20px;
    left: 70px; /* Start position when sidebar is collapsed */
    color: var(--theme-primary);
    font-size: 24px;
    font-weight: 700;
    z-index: 1000;
    text-shadow: 0 0 15px var(--theme-shadow);
    transition: left 0.3s ease; /* Smooth transition when sidebar moves */
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Title Logo */
.title-logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    transition: filter 0.3s ease;
}

.title-logo:hover {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.5));
}

.container {
    max-width: 900px;
    margin: 80px auto 20px auto;
    background: rgba(20, 20, 20, 0.9);
    border-radius: 15px;
    border: 1px solid #333;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    overflow: hidden;
    height: calc(100vh - 130px);
    max-height: calc(100vh - 130px);
    display: flex;
    flex-direction: column;
    position: relative;
}

.document-section {
    padding: 20px;
    border-bottom: 1px solid #333;
    background: rgba(15, 15, 15, 0.8);
}

.document-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.document-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.document-selector label {
    color: var(--theme-primary);
    font-weight: 500;
    font-size: 14px;
}

.document-selector select {
    background: rgba(40, 40, 40, 0.9);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 14px;
    min-width: 200px;
}

.document-selector select:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 2px var(--theme-shadow-light);
}

.upload-section button {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-dark));
    border: none;
    border-radius: 0;
    padding: 8px 16px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-section button:hover {
    background: linear-gradient(135deg, var(--theme-secondary), var(--theme-primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--theme-shadow);
}

/* Upload Status Styles (kept for functionality) */
.upload-status {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.upload-status.uploading {
    background: rgba(255, 165, 0, 0.2);
    border: 1px solid #ffa500;
    color: #ffa500;
}

.upload-status.success {
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid #00ff00;
    color: #00ff00;
}

.upload-status.error {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff0000;
    color: #ff0000;
}

/* Settings Button and Document Selector */
.settings-button-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
}

.document-selector-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-selector-top label {
    color: var(--theme-primary);
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
}

.document-selector-top select {
    background: rgba(40, 40, 40, 0.9);
    border: 1px solid #555;
    border-radius: 6px;
    padding: 6px 10px;
    color: #ffffff;
    font-size: 13px;
    min-width: 180px;
    max-width: 200px;
}

.document-selector-top select:focus {
    border-color: var(--theme-primary);
    outline: none;
    box-shadow: 0 0 5px var(--theme-shadow);
}

#settings-btn {
    background: linear-gradient(135deg, #333333, #555555);
    border: 1px solid #666;
    border-radius: 0;
    padding: 10px 15px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#settings-btn:hover {
    background: linear-gradient(135deg, #555555, #777777);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    margin: 2% auto;
    border: 1px solid var(--theme-primary);
    border-radius: 8px;
    width: 95%;
    max-width: 1200px;
    max-height: 95vh;
    box-shadow: 0 20px 50px var(--theme-shadow);
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #333;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.modal-header h2 {
    color: var(--theme-primary);
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.modal-footer {
    padding: 25px 30px;
    border-top: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-shrink: 0;
}

.modal-footer button {
    flex: 1;
    max-width: 200px;
}

.close {
    color: #999;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: var(--theme-primary);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    max-height: calc(95vh - 140px);
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-primary) rgba(0, 0, 0, 0.3);
}

/* Custom scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--theme-primary), var(--theme-dark));
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--theme-secondary), var(--theme-primary));
    box-shadow: 0 0 5px var(--theme-shadow);
}

.modal-body-content {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    min-height: fit-content;
    align-items: start;
}

@media (max-width: 1100px) {
    .modal-body-content {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .modal-body-content {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
}

/* Settings section headers */
.setting-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    height: fit-content;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.setting-section:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.setting-section-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--theme-primary);
    position: relative;
    flex-shrink: 0;
}

.setting-section-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--theme-secondary);
    transition: width 0.3s ease;
}

.setting-section:hover .setting-section-header::after {
    width: 60px;
}

.setting-section-header h3 {
    color: var(--theme-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.5px;
}

.setting-group {
    margin-bottom: 20px;
    transition: all 0.3s ease;
    flex-grow: 1;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group:hover {
    transform: translateX(3px);
}

/* Section content wrapper */
.setting-section-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}

/* Uniform section heights and improved grid distribution */
.setting-section {
    min-height: 220px;
    max-height: 400px;
}

/* Special sizing for sections with more content */
.setting-section:has(.theme-color-container),
.setting-section:has(.background-options) {
    min-height: 260px;
}

.setting-section:has(.accessibility-options) {
    min-height: 240px;
}

/* Grid item sizing for consistent appearance */
.modal-body-content {
    grid-auto-rows: minmax(200px, auto);
}

/* Improved visual hierarchy for section icons */
.setting-section-header h3 {
    font-size: 16px !important;
    letter-spacing: 0.5px;
}

/* Enhanced spacing for better visual balance */
.setting-group label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
    font-weight: 500;
}

.setting-group label {
    display: block;
    color: var(--theme-primary);
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 16px;
}

.setting-group select {
    background: rgba(40, 40, 40, 0.9);
    border: 1px solid #555;
    border-radius: 0;
    padding: 10px 15px;
    color: #ffffff;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 2px var(--theme-shadow-light);
}

.background-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e0e0e0 !important;
    font-weight: normal !important;
    cursor: pointer;
    padding: 8px;
    border-radius: 0;
    transition: background-color 0.3s ease;
}

.radio-option:hover {
    background-color: var(--theme-shadow-light);
}

.radio-option input[type="radio"] {
    accent-color: var(--theme-primary);
    margin: 0;
}

#color-picker-container {
    margin-top: 10px;
    padding: 15px;
    background: rgba(30, 30, 30, 0.8);
    border-radius: 0;
    border: 1px solid #444;
}

#color-picker-container label {
    color: #ccc !important;
    font-size: 14px !important;
    margin-bottom: 8px !important;
}

#background-color {
    width: 100%;
    height: 50px;
    border: 1px solid #555;
    border-radius: 0;
    cursor: pointer;
    background: transparent;
}

/* Theme Color Picker Styles */
.theme-color-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#theme-color {
    width: 100%;
    height: 50px;
    border: 1px solid #555;
    border-radius: 0;
    cursor: pointer;
    background: transparent;
}

.theme-presets {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-preset {
    width: 40px;
    height: 40px;
    border: 2px solid #555;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

/* Individual theme color tiles */
.theme-preset.red-theme {
    background: #ff4444 !important;
}

.theme-preset.blue-theme {
    background: #4444ff !important;
}

.theme-preset.green-theme {
    background: #44ff44 !important;
}

.theme-preset.purple-theme {
    background: #ff44ff !important;
}

.theme-preset.orange-theme {
    background: #ffaa44 !important;
}

.theme-preset.cyan-theme {
    background: #44ffff !important;
}

.theme-preset:hover {
    transform: scale(1.1);
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.theme-preset.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6), 
                0 0 20px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* Additional settings enhancements */
.setting-section h3 {
    position: relative;
    overflow: hidden;
}

.setting-section h3::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 68, 68, 0.1), transparent);
    transition: left 0.6s ease;
}

.setting-section:hover h3::before {
    left: 100%;
}

/* Settings compact mode for smaller content */
.setting-section.compact {
    padding: 20px;
}

.setting-section.compact .setting-group {
    margin-bottom: 20px;
}

.setting-section.compact .setting-section-header {
    margin-bottom: 20px;
}

/* Visual indicator for unsaved changes */
.setting-section.modified {
    border-color: var(--theme-secondary);
    box-shadow: 0 0 10px var(--theme-shadow-light);
}

.setting-section.modified .setting-section-header h3::after {
    content: ' *';
    color: var(--theme-secondary);
    font-weight: 400;
}

/* Improved setting groups with icons/indicators */
.setting-group.important {
    border-left: 3px solid var(--theme-primary);
    padding-left: 15px;
    background: rgba(255, 68, 68, 0.05);
    border-radius: 0 8px 8px 0;
}

/* Chat History Sidebar */
.chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%);
    border-right: 2px solid var(--theme-primary);
    transform: translateX(0);
    transition: transform 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
}

.chat-sidebar.collapsed {
    transform: translateX(-250px);
}

/* Hide interactive elements when sidebar is collapsed */
.chat-sidebar.collapsed .new-chat-section,
.chat-sidebar.collapsed .sidebar-auth-section,
.chat-sidebar.collapsed .chat-sessions {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
}

.sidebar-header h3 {
    color: var(--theme-primary);
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#sidebar-toggle {
    background: none;
    border: none;
    border-radius: 0;
    width: auto;
    height: auto;
    color: var(--theme-primary);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

#sidebar-toggle:hover {
    background: none;
    color: var(--theme-secondary);
    transform: scale(1.2);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--theme-primary) rgba(0, 0, 0, 0.3); /* Firefox */
}

/* Dark theme scrollbar for sidebar content */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--theme-primary);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--theme-secondary);
}

/* Hide scrollbar when sidebar is collapsed */
.chat-sidebar.collapsed .sidebar-content::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.chat-sidebar.collapsed .sidebar-content {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer and Edge */
}

.new-chat-section {
    padding: 15px;
    border-bottom: 1px solid #333;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-dark));
    border: none;
    border-radius: 0;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: normal;
    height: auto;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, var(--theme-secondary), var(--theme-primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--theme-shadow);
}

.new-chat-btn:disabled {
    background: linear-gradient(135deg, #444444, #333333);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.new-chat-btn:disabled:hover {
    background: linear-gradient(135deg, #444444, #333333);
    transform: none;
    box-shadow: none;
}

.chat-sessions {
    padding: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-session-item {
    padding: 15px;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
}

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

.chat-session-item.active {
    background: var(--theme-shadow-light);
    border-left: 3px solid var(--theme-primary);
}

.session-title {
    color: #e0e0e0;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.session-preview {
    color: #999;
    font-size: 12px;
    margin-bottom: 5px;
    word-wrap: break-word;
    line-height: 1.3;
}

.session-date {
    color: #666;
    font-size: 11px;
}

/* Session action buttons container */
.session-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-session-item:hover .session-actions {
    opacity: 1;
}

.rename-session,
.delete-session {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    transition: all 0.3s ease;
    height: auto;
    width: auto;
    text-transform: none;
    letter-spacing: normal;
}

.rename-session:hover {
    background: rgba(0, 123, 255, 0.2);
    color: #4dabf7;
}

.delete-session:hover {
    background: rgba(255, 0, 0, 0.2);
    color: #ff6666;
}

/* Make session title clickable for renaming */
.session-title {
    cursor: pointer;
    transition: color 0.3s ease;
    padding-right: 60px; /* Make room for action buttons */
}

/* Sidebar Authentication Section */
.sidebar-auth-section {
    padding: 15px;
    border-top: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    margin-top: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--theme-light);
    font-size: 12px;
}

.user-details {
    display: flex;
    align-items: center;
}

.user-details span {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-actions {
    display: flex;
    gap: 4px;
}

.profile-btn-sidebar {
    flex: 1;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--theme-secondary);
    color: var(--theme-secondary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    border-radius: 0;
}

.profile-btn-sidebar:hover {
    background: var(--theme-secondary);
    color: white;
    transform: none;
}

.documents-btn-sidebar {
    flex: 1;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #44ff44;
    color: #44ff44;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    border-radius: 0;
}

.faq-btn-sidebar {
    flex: 1;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #ca44ff;
    color: #ca44ff;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    border-radius: 0;
}

.faq-btn-sidebar:hover {
    background: #ca44ff;
    color: white;
    transform: none;
}

.documents-btn-sidebar:hover {
    background: #44ff44;
    color: white;
    transform: none;
}

.logout-btn-sidebar {
    flex: 1;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    height: auto;
    min-height: auto;
    border-radius: 0;
}

.logout-btn-sidebar:hover {
    background: var(--theme-primary);
    color: white;
    transform: none;
}

.auth-buttons-sidebar {
    display: flex;
    gap: 8px;
}

.auth-btn-sidebar {
    flex: 1;
    padding: 8px 12px;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--theme-primary);
    color: var(--theme-primary);
    background: transparent;
    text-align: center;
    border-radius: 0;
}

.auth-btn-sidebar:hover {
    background: rgba(255, 68, 68, 0.1);
}

.auth-btn-sidebar.primary {
    background: var(--theme-primary);
    color: white;
}

.auth-btn-sidebar.primary:hover {
    background: var(--theme-dark);
}

/* Main Content Adjustments */
.main-content {
    transition: margin-left 0.3s ease;
    margin-left: 0;
    min-height: 100vh;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 280px;
    }
    
    .chat-sidebar.collapsed {
        transform: translateX(-230px);
    }
    
    .main-content {
        margin-left: 30px;
    }
    
    /* Better mobile chat experience */
    .main-title {
        font-size: 16px;
        padding: 8px 15px;
        top: 10px;
        left: 10px;
        gap: 8px;
    }
    
    .title-logo {
        height: 24px;
    }
    
    .settings-button-container {
        padding: 10px 15px;
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .document-selector-top {
        margin-bottom: 10px;
    }
    
    .document-selector-top select {
        font-size: 14px;
        padding: 8px;
    }
    
    #settings-btn {
        padding: 10px;
        font-size: 14px;
    }
}

/* Mobile phone specific optimizations */
@media (max-width: 480px) {
    .chat-sidebar {
        width: 260px;
    }
    
    .chat-sidebar.collapsed {
        transform: translateX(-210px);
    }
    
    .main-content {
        margin-left: 25px;
    }
    
    .main-title {
        font-size: 14px;
        padding: 6px 12px;
        gap: 6px;
    }
    
    .title-logo {
        height: 20px;
    }
    
    .settings-button-container {
        padding: 8px 12px;
    }
    
    /* Improve modal responsiveness on small screens */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px auto;
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body-content {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
    
    .setting-section {
        padding: 15px;
        min-height: 150px;
    }
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid #333;
}

.modal-footer button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-footer button:first-child {
    background: linear-gradient(135deg, #666666, #888888);
    color: white;
}

.modal-footer button:first-child:hover {
    background: linear-gradient(135deg, #888888, #aaaaaa);
    transform: translateY(-1px);
}

.modal-footer button:last-child {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-dark));
    color: white;
}

.modal-footer button:last-child:hover {
    background: linear-gradient(135deg, var(--theme-secondary), var(--theme-primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--theme-shadow);
}

.container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff0000, #ff4444, #ff0000);
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite alternate;
}

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

.chat-container {
    padding: 0;
    position: relative;
    background: #000000;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 10px 30px 0px 30px;
    background: #0a0a0a;
    border: none;
    margin: 0;
    position: relative;
    height: 0;
    min-height: 0;
    scroll-behavior: smooth;
    z-index: 1;
    
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--theme-primary) rgba(0, 0, 0, 0.3);
}

.chat-messages::after {
    content: '';
    display: table;
    clear: both;
}

/* Webkit scrollbar styling for Chrome, Safari, Edge */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--theme-primary), var(--theme-dark));
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--theme-secondary), var(--theme-primary));
    box-shadow: 0 0 5px var(--theme-shadow);
}

.chat-messages::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.3);
}

/* Fade effect at top of conversation */
.chat-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, #0a0a0a 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #000000;
    border-left: 1px solid #333;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ff0000;
    border-radius: 0;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ff4444;
}

.message {
    margin-bottom: 15px;
    padding: 12px 18px;
    border-radius: 0;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.4;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
    animation: messageAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
}

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

.message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #ff0000;
}

.message.user {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: #ffffff;
    margin-left: auto;
    margin-right: 0;
    text-align: right;
    border-color: #ff4444;
    font-weight: 500;
    max-width: 80%;
    width: max-content;
    display: block;
    float: right;
    clear: both;
}

.message.user::before {
    background: #ff4444;
    left: auto;
    right: 0;
}

.message.assistant {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #e0e0e0;
    border-color: var(--theme-primary);
    font-weight: 400;
    max-width: 90%;
    float: left;
    clear: both;
}

.message.system {
    background: linear-gradient(135deg, #1a1a0a 0%, #2a2a1a 100%);
    color: #ffaa00;
    border-color: #ff8800;
    font-weight: 400;
    max-width: 90%;
    font-style: italic;
    text-align: center;
    float: none;
    clear: both;
    margin-left: auto;
    margin-right: auto;
}

.message.typing {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border: 2px solid var(--theme-primary);
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0%, 100% { 
        border-color: var(--theme-primary);
        box-shadow: 0 0 10px var(--theme-shadow);
    }
    50% { 
        border-color: var(--theme-secondary);
        box-shadow: 0 0 20px var(--theme-shadow-strong);
    }
}

.input-area {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    background: #000000;
    border-top: 2px solid var(--theme-primary);
    align-items: center;
    flex-shrink: 0;
}

#question-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #333;
    border-radius: 0;
    font-size: 15px;
    background: #0a0a0a;
    color: #ffffff;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Jost', sans-serif;
    letter-spacing: 0.5px;
    font-weight: 400;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
}

#question-input:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 15px var(--theme-shadow);
    background: #111111;
}

#question-input:disabled {
    background: #1a1a1a;
    color: #666;
    cursor: not-allowed;
}

#question-input::placeholder {
    color: #666;
    font-weight: 300;
}

button {
    padding: 14px 25px;
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: 'Jost', sans-serif;
    height: 48px;
    white-space: nowrap;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--theme-secondary) 0%, var(--theme-primary) 100%);
    box-shadow: 0 0 20px var(--theme-shadow);
    transform: translateY(-1px);
}

button:disabled {
    background: #333;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    background: #0a0a0a;
    border: none;
    border-radius: 0;
    margin: 0 25px 5px;
    animation: slideIn 0.3s ease;
    border-left: 3px solid #ff0000;
    flex-shrink: 0;
}

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

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

.typing-dots span {
    width: 10px;
    height: 10px;
    border-radius: 0;
    background: #ff0000;
    animation: typingDots 1.4s infinite ease-in-out;
    transform: skewX(-15deg);
}

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

@keyframes typingDots {
    0%, 80%, 100% {
        transform: skewX(-15deg) scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: skewX(-15deg) scale(1);
        opacity: 1;
    }
}

.typing-text {
    color: #ff4444;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sources {
    margin-top: 12px;
    margin-bottom: 15px;
    padding: 16px;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    border-left: 3px solid #ff0000;
    animation: fadeIn 0.4s ease;
    position: relative;
    z-index: 10;
    max-width: 100%;
    word-wrap: break-word;
    clear: both;
    display: block;
}

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

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

.sources h4 {
    margin: 0;
    color: #ff4444;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.source-count {
    color: #888;
    font-weight: normal;
    font-size: 11px;
}

.sources-collapse {
    background: #333;
    color: #fff;
    border: none;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.sources-collapse:hover {
    background: #555;
    transform: scale(1.05);
}

.sources-collapse:before {
    content: '';
    display: inline-block;
    margin-right: 4px;
    width: 0;
    height: 0;
    border-style: solid;
    transition: transform 0.2s ease;
}

/* Show arrow pointing down when collapsed (Show state) */
.sources-collapse:before {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #fff;
}

/* Rotate arrow when expanded (Hide state) */
.sources.expanded .sources-collapse:before {
    transform: rotate(180deg);
}

.sources-content {
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.source {
    padding: 12px 80px 12px 12px; /* Extra padding on right for button */
    margin: 6px 0;
    background: #1a1a1a;
    border-radius: 6px;
    font-size: 12px;
    color: #cccccc;
    border-left: 2px solid #ff0000;
    transition: all 0.3s ease;
    font-weight: 400;
    line-height: 1.4;
    position: relative;
    min-height: 40px; /* Ensure minimum height for button */
}

.source:hover {
    background: #222;
    border-left-color: #ff4444;
}

.source-preview, .source-full {
    margin-bottom: 0;
    padding-right: 10px; /* Additional padding to avoid button overlap */
}

.source-toggle {
    background: #ff0000;
    color: #fff;
    border: none;
    padding: 3px 8px;
    font-size: 9px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    top: 8px;
    right: 8px;
    white-space: nowrap;
    z-index: 5;
    min-width: 60px;
    text-align: center;
}

.source-toggle:hover {
    background: #ff4444;
    transform: scale(1.05);
}

.source-toggle.expanded {
    background: #666;
}

.source-toggle.expanded:hover {
    background: #888;
}

/* Loading animation for button */
button.loading {
    position: relative;
    color: transparent;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    border: 2px solid #ffffff;
    border-radius: 0;
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .page-title {
        top: 15px;
        left: 15px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .container {
        margin: 50px auto 15px auto;
        height: calc(100vh - 65px);
    }
    
    .chat-messages {
        padding: 20px 15px 10px 15px;
    }
    
    .message {
        max-width: 90%;
        padding: 10px 15px;
        margin-bottom: 12px;
    }
    
    .message.user {
        min-width: 100px;
        max-width: fit-content;
    }
    
    .input-area {
        padding: 15px;
        gap: 12px;
    }
    
    #question-input {
        padding: 12px 15px;
        height: 44px;
        min-height: 44px;
        max-height: 44px;
        font-size: 14px;
    }
    
    button {
        padding: 12px 20px;
        height: 44px;
        font-size: 13px;
        letter-spacing: 1px;
    }
    
    .typing-indicator {
        margin: 0 15px 15px;
        padding: 12px 20px;
    }
    
    .sources {
        padding: 12px;
        margin-top: 10px;
        border-radius: 6px;
    }
    
    .sources-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 10px;
    }
    
    .sources h4 {
        font-size: 12px;
    }
    
    .sources-collapse {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .sources-content {
        max-height: 250px;
    }
    
    .source {
        padding: 10px 70px 10px 10px;
        font-size: 11px;
        margin: 4px 0;
        border-radius: 4px;
        min-height: 35px;
    }
    
    .source-toggle {
        padding: 2px 6px;
        font-size: 8px;
        top: 6px;
        right: 6px;
        min-width: 50px;
    }
    
    /* Mobile settings modal improvements */
    .modal-content {
        width: 98%;
        margin: 1% auto;
        max-height: 98vh;
        border-radius: 4px;
    }
    
    .modal-header {
        padding: 20px 15px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-body {
        max-height: calc(98vh - 120px);
    }
    
    .modal-body-content {
        padding: 15px;
        gap: 15px;
    }
    
    .setting-section {
        padding: 15px;
        min-height: 180px;
        max-height: none;
    }
    
    .setting-section-header {
        margin-bottom: 15px;
    }
    
    .setting-section-header h3 {
        font-size: 18px;
    }
    
    .setting-group {
        margin-bottom: 15px;
    }
    
    .modal-footer {
        padding: 15px;
        gap: 10px;
        flex-direction: column;
    }
    
    .modal-footer button {
        max-width: none;
        width: 100%;
    }
}

/* Ensure user messages wrap content */
.message.user {
    width: auto;
    max-width: 85%;
}

/* Jost font specific adjustments */
.message {
    letter-spacing: 0.3px;
}

button {
    letter-spacing: 1px;
}

/* Smooth scrolling */
.chat-messages {
    scroll-behavior: smooth;
}

/* AI Disclaimers */
.ai-disclaimers {
    text-align: center;
    padding: 8px 15px;
    margin-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ai-disclaimers p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

/* ========================================
   ACCESSIBILITY STYLES & SETTINGS
======================================== */

/* Accessibility option styling */
.accessibility-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.radio-option:hover, .checkbox-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.radio-option input, .checkbox-option input {
    margin: 0;
    accent-color: var(--theme-primary);
}

.radio-option span, .checkbox-option span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

/* Font Size Settings */
body.font-small {
    font-size: 14px;
}

body.font-normal {
    font-size: 16px;
}

body.font-large {
    font-size: 18px;
}

body.font-extra-large {
    font-size: 20px;
}

/* Adjust specific elements for font scaling */
.font-large .main-title,
.font-extra-large .main-title {
    font-size: 28px;
}

.font-large .page-title,
.font-extra-large .page-title {
    font-size: 26px;
}

.font-large .message,
.font-extra-large .message {
    font-size: inherit;
}

.font-large #question-input,
.font-extra-large #question-input {
    font-size: inherit;
}

/* High Contrast Mode */
body.high-contrast {
    --theme-primary: #ffff00;
    --theme-secondary: #ffff66;
    --theme-dark: #cccc00;
    --theme-light: #ffff99;
    background: #000000;
    color: #ffffff;
}

body.high-contrast .container {
    background: #000000;
    border: 2px solid #ffffff;
}

body.high-contrast .message {
    border: 1px solid #ffffff;
}

body.high-contrast .message.user {
    background: #ffffff;
    color: #000000;
}

body.high-contrast .message.assistant {
    background: #000000;
    color: #ffffff;
    border: 1px solid #ffffff;
}

body.high-contrast button {
    border: 2px solid #ffff00;
    color: #ffff00;
    background: #000000;
}

body.high-contrast button:hover {
    background: #ffff00;
    color: #000000;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

body.reduce-motion .typing-animation {
    display: none;
}

body.reduce-motion .typewriter-cursor {
    display: none;
}

/* Enhanced Focus Indicators */
body.enhanced-focus *:focus {
    outline: 3px solid var(--theme-primary) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px rgba(255, 68, 68, 0.3) !important;
}

body.enhanced-focus button:focus,
body.enhanced-focus input:focus,
body.enhanced-focus select:focus,
body.enhanced-focus textarea:focus {
    outline: 3px solid var(--theme-primary) !important;
    outline-offset: 2px !important;
}

/* Keyboard Navigation Enhancement */
body.keyboard-navigation [tabindex]:focus,
body.keyboard-navigation button:focus,
body.keyboard-navigation input:focus,
body.keyboard-navigation select:focus,
body.keyboard-navigation textarea:focus {
    background: rgba(255, 68, 68, 0.1) !important;
    border-color: var(--theme-primary) !important;
}

/* Screen Reader Optimizations */
body.screen-reader-mode .visual-only {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Announcement area for screen readers */
#accessibility-announcements {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--theme-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* ===== COMPREHENSIVE MOBILE-FIRST IMPROVEMENTS ===== */

/* Touch-friendly click targets */
@media (max-width: 768px) {
    button, 
    .btn, 
    input[type="submit"], 
    input[type="button"], 
    a.button,
    select,
    input {
        min-height: 44px; /* Apple's recommended minimum touch target */
        min-width: 44px;
    }
    
    /* Improve text readability on mobile */
    body {
        font-size: 16px; /* Base font size to prevent zoom on iOS */
        line-height: 1.5;
    }
    
    /* Better spacing for mobile interactions */
    .form-group {
        margin-bottom: 20px;
    }
    
    /* Improved modal behavior on mobile */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        border-radius: 12px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better sidebar behavior on mobile */
    .chat-sidebar {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    }
    
    /* Optimize scrolling on mobile */
    .chat-messages,
    .sidebar-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* Phone-specific optimizations */
@media (max-width: 480px) {
    /* Larger touch targets for phones */
    button, 
    .btn, 
    input[type="submit"], 
    input[type="button"], 
    a.button {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }
    
    /* Better typography scaling */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    
    /* Improved form inputs */
    input, 
    textarea, 
    select {
        border-radius: 8px;
        padding: 12px 16px;
        font-size: 16px;
        border: 2px solid #333;
        transition: border-color 0.2s ease;
    }
    
    input:focus, 
    textarea:focus, 
    select:focus {
        border-color: var(--theme-primary);
        box-shadow: 0 0 8px var(--theme-shadow);
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
    
    /* Better container spacing */
    .container {
        margin: 60px 10px 10px 10px;
        border-radius: 12px;
    }
}

/* Landscape phone optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .main-title {
        font-size: 16px;
        top: 10px;
    }
    
    .container {
        margin-top: 50px;
        height: calc(100vh - 70px);
    }
    
    .chat-messages {
        padding: 10px 15px;
    }
    
    .input-area {
        padding: 10px 15px;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows for retina displays */
    .modal-content,
    .container,
    .chat-sidebar {
        border-width: 0.5px;
    }
}

/* Dark mode improvements for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    /* Enhance contrast for better mobile readability */
    .modal-content {
        background: rgba(10, 10, 10, 0.95);
        border: 1px solid #444;
    }
    
    input, textarea, select {
        background: rgba(30, 30, 30, 0.9);
        color: #fff;
        border-color: #555;
    }
}

/* ===============================================
   Cookie Banner Styles
   =============================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border-top: 2px solid var(--theme-primary);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.cookie-banner.visible {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.cookie-banner-text {
    flex: 1;
}

.cookie-banner-text p {
    color: #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.cookie-banner-actions {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cookie-btn-accept {
    background: var(--theme-primary);
    color: white;
}

.cookie-btn-accept:hover {
    background: var(--theme-dark);
    transform: translateY(-1px);
}

.cookie-btn-reject {
    background: transparent;
    color: #ccc;
    border: 1px solid #333;
}

.cookie-btn-reject:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
}

.cookie-btn-settings {
    background: rgba(40, 40, 40, 0.9);
    color: #e0e0e0;
    border: 1px solid #555;
}

.cookie-btn-settings:hover {
    background: rgba(60, 60, 60, 0.9);
    border-color: #777;
}

/* Cookie Settings Modal */
.cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cookie-settings-modal.visible {
    opacity: 1;
    visibility: visible;
}

.cookie-settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.cookie-settings-content {
    position: relative;
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid var(--theme-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.cookie-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 2rem 0 2rem;
    border-bottom: 1px solid #333;
    margin-bottom: 1.5rem;
}

.cookie-settings-header h3 {
    color: var(--theme-primary);
    font-size: 1.5rem;
    margin: 0;
}

.cookie-settings-close {
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.cookie-settings-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--theme-primary);
}

.cookie-settings-body {
    padding: 0 2rem;
}

.cookie-settings-description {
    color: #ccc;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.cookie-category {
    margin-bottom: 2rem;
}

.cookie-category-header {
    margin-bottom: 0.5rem;
}

.cookie-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #e0e0e0;
}

.cookie-toggle input[type="checkbox"] {
    display: none;
}

.cookie-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: #333;
    border-radius: 13px;
    transition: all 0.3s ease;
}

.cookie-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: #ccc;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cookie-toggle input[type="checkbox"]:checked + .cookie-slider {
    background: var(--theme-primary);
}

.cookie-toggle input[type="checkbox"]:checked + .cookie-slider::before {
    transform: translateX(24px);
    background: white;
}

.cookie-toggle input[type="checkbox"]:disabled + .cookie-slider {
    background: #555;
    opacity: 0.7;
}

.cookie-toggle input[type="checkbox"]:disabled + .cookie-slider::before {
    background: #aaa;
}

.cookie-category-description {
    color: #aaa;
    font-size: 0.9rem;
    margin: 0;
    padding-left: 66px;
    line-height: 1.5;
}

.cookie-settings-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem 2rem 2rem;
    border-top: 1px solid #333;
    margin-top: 1.5rem;
}

.cookie-btn-primary {
    background: var(--theme-primary);
    color: white;
}

.cookie-btn-primary:hover {
    background: var(--theme-dark);
}

.cookie-btn-secondary {
    background: transparent;
    color: #ccc;
    border: 1px solid #555;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

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

    .cookie-settings-content {
        width: 95%;
        max-height: 90vh;
    }

    .cookie-settings-header,
    .cookie-settings-body,
    .cookie-settings-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .cookie-category-description {
        padding-left: 66px;
    }
}

/* Purchase Modal Styles */
.purchase-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.purchase-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.purchase-modal-content {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 68, 68, 0.2);
    position: relative;
    animation: slideIn 0.3s ease;
}

.purchase-modal-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.purchase-modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

.purchase-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--theme-primary);
    margin-bottom: 10px;
}

.purchase-modal-subtitle {
    font-size: 16px;
    color: #aaa;
    line-height: 1.5;
}

.purchase-options {
    margin: 25px 0;
}

.purchase-option {
    background: rgba(255, 68, 68, 0.1);
    border: 2px solid rgba(255, 68, 68, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.purchase-option:hover {
    border-color: var(--theme-primary);
    background: rgba(255, 68, 68, 0.15);
    transform: translateY(-2px);
}

.purchase-option.selected {
    border-color: var(--theme-primary);
    background: rgba(255, 68, 68, 0.2);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.3);
}

.purchase-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.purchase-option-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.purchase-option-price {
    font-size: 20px;
    font-weight: bold;
    color: var(--theme-primary);
}

.purchase-option-description {
    color: #ccc;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
}

.purchase-option-features {
    list-style: none;
    padding: 0;
}

.purchase-option-features li {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 5px;
    padding-left: 20px;
    position: relative;
}

.purchase-option-features li:before {
    content: "✓";
    color: var(--theme-primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.purchase-modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.purchase-btn {
    flex: 1;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.purchase-btn.primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-dark));
    color: white;
}

.purchase-btn.primary:hover {
    background: linear-gradient(135deg, var(--theme-secondary), var(--theme-primary));
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 68, 68, 0.3);
}

.purchase-btn.primary:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.purchase-btn.secondary {
    background: transparent;
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.purchase-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

.current-usage {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.current-usage-title {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-bar {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary));
    transition: width 0.3s ease;
}

.usage-bar-fill.full {
    background: linear-gradient(90deg, #ff4444, #cc0000);
}

.usage-text {
    font-size: 13px;
    color: #ccc;
    display: flex;
    justify-content: space-between;
}

.popular-badge {
    position: absolute;
    top: -8px;
    right: 20px;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-dark));
    color: white;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .purchase-modal-content {
        margin: 20px;
        padding: 20px;
        max-width: none;
        width: calc(100% - 40px);
    }
    
    .purchase-modal-title {
        font-size: 20px;
    }
    
    .purchase-modal-buttons {
        flex-direction: column;
    }
    
    .purchase-option-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}