/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    
    /* Eye gaze specific */
    --hover-ring-color: #3b82f6;
    --selection-color: #10b981;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background-color: var(--surface);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow);
}

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

.smf-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Common header icon styles */
.header-icon {
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: transform 0.3s ease;
    filter: brightness(0) invert(1); /* Make icons white */
    padding: 4px;
    border-radius: 0.5rem;
}

/* People icon */
.people-icon {
    width: 48px;
    height: 48px;
}

/* Settings icon  */
.settings-icon {
    width: 48px;
    height: 48px;
}

/* User Menu */
.user-menu-container {
    position: relative;
}

.user-menu-icon {
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 4px;
    border-radius: 0.5rem;
}

.user-menu-icon:hover {
    transform: scale(1.1);
    background-color: rgba(16, 185, 129, 0.1);
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 280px;
    z-index: 1000;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-menu-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.user-menu-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.user-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

.user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.user-menu-item:hover:not(:disabled) {
    background-color: var(--surface-hover);
}

.user-menu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.user-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.user-menu-item .coming-soon {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.user-menu-item.logout-item {
    color: var(--danger-color);
}

.user-menu-item.logout-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* User Data Submenu */
.user-menu-item.has-submenu {
    position: relative;
    justify-content: flex-start;
}

.user-menu-item.has-submenu > span {
    flex: 1;
}

.submenu-arrow {
    width: 12px;
    height: 12px;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.user-menu-item.has-submenu:hover .submenu-arrow {
    transform: translateX(3px);
}

.user-menu-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 250px;
    margin-left: 8px;
    z-index: 1001;
}

.user-menu-item.has-submenu:hover .user-menu-submenu {
    display: block;
}

.submenu-item {
    width: 100%;
}

.delete-account-item {
    color: var(--danger-color);
}

.delete-account-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Memorial Indicator */
.memorial-indicator {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 1rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    animation: memorial-pulse 3s ease-in-out infinite;
}

@keyframes memorial-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(102, 126, 234, 0.5);
    }
}

/* Posthumous Settings Form */
.posthumous-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.form-subtitle {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
    text-align: left;
}

.radio-option:hover {
    background-color: var(--surface-hover);
    border-color: var(--primary-color);
}

.radio-option input[type="radio"] {
    margin-top: 0.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-content > div:first-child,
.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

.radio-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.radio-content > div:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.radio-content small {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.4;
}

.designee-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.form-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Privacy Policy Modal */
.privacy-policy-content {
    max-height: 600px;
    overflow-y: auto;
    text-align: left;
}

.privacy-policy-content h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.privacy-policy-content h4 {
    color: var(--text-primary);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.privacy-policy-content p {
    text-align: left;
    line-height: 1.6;
    margin-bottom: 1rem;
    white-space: pre-line;
}

.privacy-policy-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.privacy-policy-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.policy-version {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Delete Account Modal */
.delete-warning {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    border: 2px solid var(--danger-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.delete-warning svg {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.delete-warning h3 {
    color: var(--danger-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.delete-warning p {
    color: var(--text-primary);
    line-height: 1.8;
    text-align: left;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.btn-secondary {
    background-color: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.speaker-indicator {
    background-color: var(--surface-hover);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* People Modal Styles */
.people-modal-content {
    max-width: 800px;
    width: 90%;
}

.people-section {
    margin-bottom: 30px;
}

.people-section h3,
.add-person-section h3 {
    color: #64b5f6;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* People Grid - 4 per row */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    max-height: 250px;
    overflow-y: auto;
    padding: 5px;
}

/* Person Button - 25% smaller */
.person-btn {
    background: #2c3e50;
    color: white;
    border: 2px solid #34495e;
    padding: 15px 10px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 500;
}

.person-btn:hover {
    background: #34495e;
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Remove the active class styling that causes green border */
.person-btn.selected {
    background: #4a90e2;
    border-color: #64b5f6;
}

.person-btn:active {
    transform: translateY(0);
}

/* Person Actions - At bottom of modal */
.person-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #34495e;
}

.action-btn {
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Edit Person Section */
.edit-person-section {
    border-top: 1px solid #34495e;
    padding-top: 20px;
}

.edit-person-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Add Person Form */
.add-person-section {
    border-top: 1px solid #34495e;
    padding-top: 20px;
}

.add-person-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.person-input,
.person-textarea {
    background: #2c3e50;
    color: white;
    border: 1px solid #34495e;
    padding: 12px;
    font-size: 16px;
    border-radius: 6px;
    width: 100%;
    transition: border-color 0.3s ease;
}

.person-input:focus,
.person-textarea:focus {
    outline: none;
    border-color: #4a90e2;
}

.person-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: #4a90e2;
    color: white;
}

.btn-primary:hover {
    background: #357abd;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #34495e;
    color: white;
}

.btn-secondary:hover {
    background: #2c3e50;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .people-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .person-btn {
        font-size: 14px;
        padding: 12px 8px;
        min-height: 50px;
    }
    
    .person-actions {
        flex-direction: column;
    }
    
    .action-btn {
        max-width: 100%;
    }
}


/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Conversation Display */
.conversation-display {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--background);
}

.transcript-container {
    max-width: 800px;
    margin: 0 auto;
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-instructions {
    margin-top: 2rem;
    padding: 1.5rem;
    cursor: pointer;
    color: #667eea;
    font-size: 1.1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    background-color: rgba(102, 126, 234, 0.05);
    border: 2px solid transparent;
}

.welcome-instructions:hover {
    background-color: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    transform: translateY(-2px);
}

.welcome-instructions.speaking {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
    animation: pulse-speaking 1.5s ease-in-out infinite;
}

@keyframes pulse-speaking {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.click-hint {
    display: block;
    font-size: 0.9em;
    opacity: 0.7;
    margin-top: 0.5rem;
    font-style: italic;
}

.message {
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease-in;
}

.message-speaker {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.message-content {
    background-color: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.message.user .message-content {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    max-width: 70%;
}

.message.assistant .message-content {
    max-width: 70%;
}

/* Response Selection */
.response-selection {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: none;
}

.response-selection.active {
    display: block;
}

.response-selection h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Response Selection Header */
.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.response-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
}

.response-actions {
    display: flex;
    gap: 0.75rem;
}

.response-action-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cancel-btn {
    background-color: #dc2626;
    color: white;
}

.cancel-btn:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.cancel-btn:active {
    transform: translateY(0);
}

.resend-btn {
    background-color: #2563eb;
    color: white;
}

.resend-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.resend-btn:active {
    transform: translateY(0);
}

.compose-btn {
    background-color: var(--success-color);
    color: white;
}

.compose-btn img {
    filter: invert(1);
}

.compose-btn:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.compose-btn:active {
    transform: translateY(0);
}

/* Disabled state for buttons */
.response-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading message style */
.loading-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.response-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.response-option {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    background-color: var(--surface-hover);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.response-option:hover {
    border-color: var(--hover-ring-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.response-option.gaze-hover {
    border-color: var(--hover-ring-color);
    background-color: rgba(59, 130, 246, 0.1);
}

.response-option.gaze-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, var(--selection-color), transparent);
    animation: gazeProgress 3s linear;
}

.response-option.selected {
    border-color: var(--selection-color);
    background-color: rgba(16, 185, 129, 0.1);
    animation: pulse 0.5s ease-out;
}

/* Input Controls */
.input-controls {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.recording-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--danger-color);
}

.recording-indicator.active {
    display: flex;
}

.pulse {
    width: 12px;
    height: 12px;
    background-color: var(--danger-color);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.text-input-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Word prediction wrapper */
.word-prediction-wrapper {
    position: relative;
    flex: 1;
    max-width: 90%;
}

.text-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    resize: none;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Ghost text overlay for word prediction */
.ghost-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: transparent;
    pointer-events: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    z-index: 1;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    background: var(--surface-hover);
    overflow: hidden;
}

.ghost-word {
    color: var(--text-secondary) !important;
    opacity: 0.6 !important;
    font-weight: 400;
}

/* AI spell check button */
.ai-spell-check-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    background: transparent;
    border: none;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ai-spell-check-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.ai-spell-check-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.ai-spell-check-btn:active {
    transform: scale(0.95);
}

.ai-spell-check-btn.checking {
    animation: pulse 1s infinite;
}

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

.send-btn {
    background-color: var(--primary-color);
    border: none;
    border-radius: 0.75rem;
    padding: 0 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
    flex-shrink: 0;
}

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

.speak-btn {
    background-color: var(--success-color);
    border: none;
    border-radius: 0.75rem;
    padding: 0 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speak-btn:hover {
    background-color: #059669;
}

.speak-btn:disabled {
    background-color: #6b7280;
    cursor: not-allowed;
}

.speak-btn img {
    filter: brightness(0) invert(1);
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.control-btn {
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.control-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.control-btn.recording {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    position: relative;
}

/* Soundwave canvas */
.soundwave-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.control-btn.recording .soundwave-canvas {
    opacity: 1;
}

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

/* Add this to properly center the modals */
#fileManagerModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    /* Add these two lines */
    justify-content: center;
    align-items: center;
}

#peopleModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    /* Add these two lines */
    justify-content: center;
    align-items: center;
}

/* When the modals are shown, they need to use flex display */
#fileManagerModal[style*="display: block"],
#peopleModal[style*="display: block"] {
    display: flex !important;
}

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

.modal-content {
    background-color: var(--surface);
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

#posthumous-settings-modal .modal-header h2,
#privacy-policy-modal .modal-header h2 {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    text-align: center;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Settings */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.setting-item {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item label {
    flex: 1;
    color: var(--text-secondary);
}

.setting-control {
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.setting-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

input[type="range"] {
    width: 200px;
    height: 6px;
    background: var(--surface-hover);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.value-display {
    margin-left: 1rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* Tab Navigation */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface);
    padding: 0 2rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: var(--surface-hover);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Base setting item structure */
.setting-item {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Horizontal layout for voice tab dropdowns */
.setting-item.horizontal-layout {
    margin-bottom: 1.5rem;
}

.setting-item.horizontal-layout .control-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.5rem;
}

.setting-item.horizontal-layout label {
    min-width: 150px;
    margin: 0;
    color: var(--text-primary);
    font-weight: 500;
    text-align: left;
    display: block;
}

.setting-item.horizontal-layout .setting-control {
    flex: 1;
    max-width: 600px;
}

/* Override any centering that might be inherited */
#voice-tab .control-row label {
    text-align: left !important;
    justify-content: flex-start !important;
}

/* Standard setting item label */
.setting-item label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* Input controls */
.setting-control {
    width: 100%;
    max-width: 400px;
}

/* Select and text inputs */
select.setting-control,
input[type="text"].setting-control,
input[type="number"].setting-control {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Voice Tab Specific Fixes - Add this after your existing CSS */

/* Force all Voice tab select boxes to use flexbox instead of grid */
#settings-modal #voice-tab .setting-item.horizontal-layout .control-row {
    display: flex !important;
    align-items: center !important;
    gap: 1.5rem !important;
    width: 100% !important;
}

#settings-modal #voice-tab .setting-item.horizontal-layout .control-row label {
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 120px !important;
    flex-shrink: 0 !important;
}

#settings-modal #voice-tab .setting-item.horizontal-layout .control-row select.setting-control {
    flex: 1 !important;
    width: 100% !important;
    max-width: 400px !important;
    min-width: 300px !important;
}

/* Force exact same size for all three select boxes */
#settings-modal #voice-tab select#voice-select,
#settings-modal #voice-tab select#tts-model,
#settings-modal #voice-tab select#output-quality {
    width: 100% !important;
    max-width: 400px !important;
    min-width: 300px !important;
    box-sizing: border-box !important;
}

/* Ensure consistent spacing between items */
#settings-modal #voice-tab .setting-item.horizontal-layout {
    margin-bottom: 1.5rem !important;
    width: 100% !important;
}

/* Make sure description text is consistent */
#settings-modal #voice-tab .setting-item.horizontal-layout .setting-description {
    margin-top: 0.5rem !important;
    width: 100% !important;
}

select.setting-control:focus,
input[type="text"].setting-control:focus,
input[type="number"].setting-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Number inputs - smaller width */
input[type="number"].setting-control {
    max-width: 150px;
}

/* Range inputs */
input[type="range"] {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: var(--surface-hover);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Value display for sliders */
.value-display {
    margin-left: 1rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

/* Textarea - larger for system prompt */
textarea.setting-control {
    width: 100%;
    max-width: 600px;
    padding: 0.75rem;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    min-height: 150px;
}

textarea.setting-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Description text */
.setting-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
    max-width: 600px;
}

/* Checkbox/Toggle items */
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1rem;
    gap: 1rem;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
/* Update your existing CSS */
.horizontal-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 1rem; /* Smaller gap for narrow container */
    margin-bottom: 2rem;
}

/* Make slider span both columns */
.horizontal-group .slider-group {
    grid-column: 1 / -1;
}

/* On smaller screens, stack them */
@media (max-width: 768px) {
    .horizontal-group .setting-item {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* RAG settings grid */
.rag-grid {
    margin-bottom: 1rem;
}

.rag-labels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 0.75rem;
}

.rag-labels label {
    color: var(--text-primary);
    font-weight: 500;
    margin: 0;
}

.rag-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 0.75rem;
}

.rag-inputs input {
    width: 100%;
    max-width: 120px;
}

/* Slider group with value display */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.slider-label .value-display {
    color: var(--primary-color);
    font-weight: 600;
    margin-left: 1rem;
}

/* Settings section headers */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    margin-top: 2rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:first-child h3 {
    margin-top: 0;
}

/* Tab specific adjustments */
#voice-tab .setting-control {
    margin-bottom: 0.5rem;
}

#voice-tab .checkbox-label {
    margin-top: 1rem;
}

#recorder-tab .slider-group {
    margin-bottom: 1.5rem;
}

#recorder-tab .slider-label {
    margin-bottom: 1rem;
}

#llm-tab .setting-item {
    margin-bottom: 2.5rem;
}

#llm-tab input[type="number"] {
    max-width: 120px;
}

#system-tab textarea {
    margin-bottom: 1rem;
}

#system-tab .horizontal-group {
    margin-top: 2rem;
}

/* System tab RAG number inputs */
#system-tab input[type="number"] {
    max-width: 120px;
}

/* Hidden element - Fixed seed container */
#fixed-seed-container {
    transition: all 0.3s ease;
}

/* Save button */
.save-btn {
    background-color: var(--primary-color);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 2rem;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .settings-tabs {
        padding: 0 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .horizontal-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .setting-item.horizontal-layout .control-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .setting-item.horizontal-layout label {
        min-width: auto;
    }
    
    .rag-labels,
    .rag-inputs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .setting-control,
    input[type="range"].setting-control,
    textarea.setting-control {
        max-width: 100%;
    }
}

/* Speaker Management */
.speaker-list {
    margin-bottom: 1rem;
}

.speaker-item {
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.speaker-name {
    font-weight: 500;
}

.speaker-notes {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.speaker-last {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.speaker-actions {
    display: flex;
    gap: 0.5rem;
}

.speaker-actions button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.speaker-actions button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.add-speaker-btn {
    width: 100%;
    background-color: var(--surface-hover);
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.add-speaker-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.save-btn {
    background-color: var(--primary-color);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 2rem;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* File Manager Modal */
.file-manager-modal-content {
    max-width: 900px;
    width: 90%;
    height: 80vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
}

/* Modal header - more compact */
.file-manager-modal-content .modal-header {
    padding: 1rem 1.5rem;
}

.file-manager-modal-content .modal-header h2 {
    font-size: 1.25rem;
}
.file-manager-modal-content .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* File Manager Tabs - more compact */
.file-manager-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface);
    padding: 0 1.5rem;
}

.file-manager-tabs .tab-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

/* Tab Content - reduced padding */
.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* Files Tab Specific */
#files-tab {
    position: relative;
}

/* URLs Tab Specific */
#urls-tab {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

.files-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.files-header {
    flex-shrink: 0;
}

.files-header-labels {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.files-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-row:last-child {
    border-bottom: none;
}

.file-row:hover {
    background-color: var(--surface-hover);
}

.file-row.selected {
    background-color: rgba(59, 130, 246, 0.2);
    border-left: 3px solid var(--primary-color);
}

.file-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-status {
    display: flex;
    align-items: center;
    min-width: 40px;
    justify-content: center;
}

.status-icon {
    font-size: 1rem;
    font-weight: bold;
}

.status-icon.indexed {
    color: var(--success-color);
}

.status-icon.not-indexed {
    color: var(--danger-color);
}

/* Indexing spinner */
.indexing-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Files bottom section - more compact */
.files-bottom {
    position: sticky;
    bottom: 0;
    background-color: var(--surface);
    padding-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.files-info {
    background-color: var(--surface-hover);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    flex: 1;
}

.files-info p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.file-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Memories Tab Specific */
#memories-tab {
    position: relative;
}

.memories-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 1rem;
}

.memories-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

/* Memory row - compact */
.memory-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.memory-row:last-child {
    border-bottom: none;
}

.memory-row:hover {
    background-color: var(--surface-hover);
}

.memory-row.selected {
    background-color: rgba(59, 130, 246, 0.2);
    border-left: 3px solid var(--primary-color);
}

.memory-title {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.memory-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Load More Button - more compact */
.load-more-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.load-more-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Memory Form */
.memory-form {
    background-color: var(--surface-hover);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.memory-input {
    flex: 1;
    padding: 0.75rem;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.memory-input.full-width {
    width: 100%;
}

.memory-textarea {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 1rem;
}

.memory-input:focus,
.memory-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Memory actions - FIXED AT BOTTOM */
.memory-actions {
    position: sticky;
    bottom: 0;
    background-color: var(--surface);
    padding-top: 1rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* Action buttons - more compact */
.action-btn {
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* KB Icon in header */
.kb-icon {
    width: 56px;
    height: 56px;
    cursor: pointer;
    transition: transform 0.3s ease;
    filter: brightness(0) invert(1);
    padding: 4px;
    border-radius: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .file-manager-modal-content {
        max-width: 100%;
        width: 95%;
        margin: 1rem;
        height: 90vh;
    }
    
    .file-manager-tabs {
        padding: 0 1rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .files-header-labels {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    .file-row,
    .memory-row {
        padding: 0.5rem;
    }
    
    .file-name,
    .memory-title {
        font-size: 0.875rem;
    }
    
    .memory-date {
        font-size: 0.75rem;
    }
    
    .files-bottom {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .files-info {
        width: 100%;
        padding: 0.5rem;
    }
    
    .files-info p {
        font-size: 0.75rem;
    }
    
    .file-actions,
    .memory-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    .action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        flex: 1;
        min-width: 80px;
    }
    
    /* Memory form on mobile */
    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .memory-input {
        width: 100%;
    }
    
    .memory-textarea {
        font-size: 0.875rem;
        min-height: 120px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    
    .form-actions .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .file-manager-modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .file-manager-tabs .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .files-list,
    .memories-list {
        margin-top: 0.5rem;
    }
    
    /* Smaller status icons on mobile */
    .status-icon {
        font-size: 1rem;
    }
    
    .indexing-spinner {
        width: 16px;
        height: 16px;
    }
    
    /* Stack file info on small screens */
    .files-header-labels {
        display: none;
    }
    
    .file-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .file-status {
        align-self: flex-end;
        margin-top: -1.5rem;
    }
    
    /* Adjust memory rows on small screens */
    .memory-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .memory-date {
        align-self: flex-end;
        margin-top: -1.25rem;
    }
}

/* Info Button */
.info-button {
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 0.75rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-button:hover {
    opacity: 0.7;
}

.info-button img {
    width: 24px;
    height: 24px;
    filter: invert(1);
}

/* Info Modal Content */
.info-modal-content {
    max-width: 700px;
    width: 90%;
}

.info-body {
    padding: 2rem;
}

.info-section {
    margin-bottom: 3rem;  /* Increased from 2rem for more spacing */
}

.info-section h3 {
    color: var(--primary-color);
    font-size: 1.1rem;  /* Reduced from 1.2rem */
    margin-bottom: 1rem;
}

.info-section p {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.9rem;  /* Reduced from 1rem */
}

.info-section a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.info-section a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.foundation-tagline {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;  /* Reduced from 1.1rem */
}

/* Update the .close-modal class to match .close-btn exactly */
.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
    /* Add these to ensure it's treated as a button */
    flex-shrink: 0;
    line-height: 1;
}

.close-modal:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

/* Help Icon */
.help-icon {
    width: 54px;
    height: 54px;
    cursor: pointer;
    transition: transform 0.3s ease;
    filter: brightness(0) invert(1);
    padding: 4px;
    border-radius: 0.5rem;
}

/* Help Modal - Centered like other modals */
#help-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

/* Help Modal Content - Centered */
.help-modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Modal Header */
#help-modal .modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface);
    border-radius: 1rem 1rem 0 0;
}

#help-modal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Close Button */
#help-modal .close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

#help-modal .close-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

/* Help Body */
.help-body {
    display: flex;
    gap: 2rem;
    height: 100%;
    min-height: 0;
    padding: 2rem;
    overflow: hidden;
}

/* Help Navigation */
.help-nav {
    flex-shrink: 0;
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.help-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.875rem;
    white-space: nowrap;
}

.help-nav-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.help-nav-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Help Content */
.help-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
    min-height: 0;
}

.help-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.help-section.active {
    display: block;
}

.help-section h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.help-section h4 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.help-section h5 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.help-section p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.help-section ul,
.help-section ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.help-section strong {
    color: var(--text-primary);
}

/* Inline Icons in Help Text */
.inline-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin: 0 0.25rem;
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

/* Demo Buttons in Help */
.demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-hover);
    color: var(--text-primary);
    cursor: default;
    vertical-align: middle;
}

.demo-btn svg {
    width: 20px;
    height: 20px;
}

.demo-btn.record-btn {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.demo-btn.speak-btn {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.demo-btn.action-btn {
    background-color: var(--surface-hover);
}

.demo-btn.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.demo-btn.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.demo-btn.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* Help Tips */
.help-tip {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    color: var(--text-primary);
}

/* Scrollbar styling for help content */
.help-content::-webkit-scrollbar,
.help-nav::-webkit-scrollbar {
    width: 8px;
}

.help-content::-webkit-scrollbar-track,
.help-nav::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

.help-content::-webkit-scrollbar-thumb,
.help-nav::-webkit-scrollbar-thumb {
    background: var(--surface-hover);
    border-radius: 4px;
}

.help-content::-webkit-scrollbar-thumb:hover,
.help-nav::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Responsive Design for Tablets */
@media (max-width: 768px) {
    .help-modal-content {
        max-width: 95%;
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .help-body {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .help-nav {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding-right: 0;
        padding-bottom: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        -webkit-overflow-scrolling: touch;
    }
    
    .help-nav-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        font-size: 0.813rem;
    }
    
    .help-content {
        padding-right: 0;
    }
    
    .help-section h3 {
        font-size: 1.25rem;
    }
    
    .help-section h4 {
        font-size: 1rem;
    }
    
    .demo-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.813rem;
    }
    
    .inline-icon {
        width: 20px;
        height: 20px;
    }
}

/* Responsive Design for Mobile */
@media (max-width: 480px) {
    .help-modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    #help-modal .modal-header {
        padding: 1rem;
        border-radius: 0;
    }
    
    #help-modal .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .help-body {
        padding: 0.75rem;
    }
    
    .help-nav {
        padding-bottom: 0.5rem;
        gap: 0.25rem;
    }
    
    .help-nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .help-content {
        padding: 0.5rem;
    }
    
    .help-section h3 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }
    
    .help-section h4 {
        font-size: 0.938rem;
        margin-top: 1.5rem;
    }
    
    .help-section h5 {
        font-size: 0.875rem;
    }
    
    .help-section p,
    .help-section li {
        font-size: 0.875rem;
    }
    
    .help-tip {
        padding: 0.75rem;
        font-size: 0.813rem;
    }
    
    .demo-btn {
        display: inline-block;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        margin: 0.125rem;
    }
    
    .demo-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .inline-icon {
        width: 18px;
        height: 18px;
    }
    
    /* Stack buttons on mobile */
    .help-section ul,
    .help-section ol {
        padding-left: 1.25rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .help-modal-content {
        border: 2px solid var(--text-primary);
    }
    
    .help-nav-btn.active {
        outline: 2px solid white;
        outline-offset: -2px;
    }
    
    .demo-btn {
        border-width: 2px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 2000;
}

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

.notification.success {
    border-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.1);
}

.notification.error {
    border-color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
}

.notification.warning {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.1);
}

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

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(1);
    }
}

@keyframes gazeProgress {
    from {
        transform: scaleX(0);
        transform-origin: left;
    }
    to {
        transform: scaleX(1);
        transform-origin: left;
    }
}

/* Disconnected state */
.app-header.disconnected {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .conversation-display {
        padding: 1rem;
    }
    
    .response-options {
        flex-direction: column;
    }
    
    .response-option {
        max-width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

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

/* Large buttons for eye gaze */
button, .response-option {
    min-height: 60px;
    min-width: 120px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #60a5fa;
        --text-primary: #ffffff;
        --text-secondary: #e2e8f0;
        --background: #000000;
        --surface: #1a1a1a;
        --border-color: #4a4a4a;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Custom Expandable System Prompt Styles */
.custom-prompt-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-prompt-textarea {
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.custom-prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-expand-btn {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    background: var(--surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 3px !important;
    padding: 2px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    z-index: 10 !important;
    color: var(--text-secondary) !important;
    width: 14px !important;
    height: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    min-width: 14px !important;
    max-width: 14px !important;
    min-height: 14px !important;
    max-height: 14px !important;
}

.custom-expand-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.custom-expand-btn svg {
    display: block;
    width: 10px;
    height: 10px;
}

/* Expanded Prompt Modal */
.expanded-prompt-content {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.expanded-prompt-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.expanded-prompt-textarea {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.expanded-prompt-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.expanded-prompt-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Expanded Prompt Modal Footer */
#expanded-prompt-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

#expanded-prompt-modal .prompt-builder-btn {
    margin: 0;
}

/* URL Input Section */
.url-input-section {
    margin-bottom: 20px;
}

.url-explainer {
    margin-bottom: 15px;
}

.info-box {
    background: #f0f8ff;
    border: 1px solid #4a90e2;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #333;
}

.info-box i {
    color: #4a90e2;
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box ul {
    margin: 5px 0;
    padding-left: 20px;
}

.info-box li {
    margin: 3px 0;
}

/* URLs Tab Container */
#urls-tab {
    position: relative;
}

.urls-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

/* URLs Header - matching Files tab */
.urls-header {
    flex-shrink: 0;
}

.urls-header-labels {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

/* URLs List Container */
/* Make URLs list consistent with files and memories */
.urls-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0 !important;  /* Remove padding - files/memories have no padding */
    margin-top: 0.5rem;  /* Add margin like files list */
}

/* Make URL rows exactly like file rows */
.url-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem !important;  /* Exact same as file-row */
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    margin: 0 !important;  /* No margin */
    background: none !important;  /* No background */
    border: none !important;  /* No border except bottom */
    border-bottom: 1px solid var(--border-color) !important;  /* Only bottom border */
    border-radius: 0 !important;  /* No radius */
}

.url-row:last-child {
    border-bottom: none !important;
}

.url-row:hover {
    background-color: var(--surface-hover) !important;
    transform: none !important;  /* No transform */
}

.url-row.selected {
    background-color: rgba(59, 130, 246, 0.2) !important;
    border-left: 3px solid var(--primary-color) !important;
    color: inherit !important;  /* Don't change text color */
}

.url-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.875rem !important;  /* Same as file-name */
    font-weight: normal !important;  /* Same as file-name */
    line-height: 1.4 !important;  /* Same line height */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-status {
    display: flex;
    align-items: center;
    margin-left: 1rem;
}

/* Status Icons - matching Files tab */
.status-icon {
    font-size: 1.2rem;
}

.status-icon.indexed {
    color: var(--success-color);
}

.status-icon.not-indexed {
    color: var(--error-color);
}

.indexing-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--surface-hover);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* URLs Bottom Section */
.urls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface);
}

.urls-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Guidelines Button */
.guidelines-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.guidelines-btn:hover {
    background-color: var(--surface-hover);
    color: var(--primary-color);
}

.guidelines-btn img {
    width: 16px;
    height: 16px;
}

/* URL Count Info */
#url-count-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* URL Actions Buttons */
.url-actions {
    display: flex;
    gap: 0.5rem;
}

/* Update button specific */
.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d97706;
}

.btn-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Add URL Form Section */
.url-input-section {
    padding: 1rem;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.url-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.url-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--background);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.url-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.add-url-btn, .cancel-url-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.add-url-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-url-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.add-url-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cancel-url-btn {
    background-color: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.cancel-url-btn:hover {
    background-color: var(--surface);
}

/* Error Message */
#url-error-message {
    color: var(--error-color, #dc2626);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: rgba(220, 38, 38, 0.1);
    border-radius: 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Empty State */
#no-urls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Loading State */
#urls-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Guidelines Modal Popup */
.guidelines-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.guidelines-content {
    padding: 1.5rem;
    max-width: 500px;
    position: relative;
}

.guidelines-content h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.guidelines-content ul {
    list-style-type: none;
    padding: 0;
}

.guidelines-content li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.guidelines-content li:before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
}

.close-guidelines {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.close-guidelines:hover {
    color: var(--text-primary);
}

/* Responsive Design for URLs Tab */
@media (max-width: 768px) {
    .urls-header-labels {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    .url-row {
        padding: 0.5rem;
    }
    
    .url-name {
        font-size: 0.875rem;
    }
    
    .urls-bottom {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .urls-info {
        width: 100%;
        justify-content: space-between;
        padding: 0.5rem;
    }
    
    .urls-info p {
        font-size: 0.75rem;
    }
    
    .url-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    .url-actions .action-btn {
        flex: 1;
        min-width: 80px;
    }
    
    .url-input-wrapper {
        flex-direction: column;
    }
    
    .add-url-btn,
    .cancel-url-btn {
        width: 100%;
        justify-content: center;
    }
    
    .guidelines-modal {
        width: 90%;
        max-width: none;
    }
    
    .guidelines-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .urls-list {
        margin-top: 0.5rem;
    }
    
    /* Stack URL info on small screens */
    .urls-header-labels {
        display: none;
    }
    
    .url-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .url-status {
        align-self: flex-end;
        margin-left: 0;
    }
    
    /* Smaller status icons on mobile */
    .status-icon {
        font-size: 1rem;
    }
    
    .indexing-spinner {
        width: 16px;
        height: 16px;
    }
    
    .guidelines-btn {
        font-size: 0.75rem;
        padding: 0.25rem;
    }
    
    .guidelines-btn img {
        width: 14px;
        height: 14px;
    }
}

/* Tab Content - Fix overflow */
.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    overflow: hidden; /* Keep hidden to let children handle scroll */
    min-height: 0; /* IMPORTANT: Add this for flexbox */
}

.tab-content.active {
    display: flex;
    height: calc(100% - 2rem); /* Account for padding */
}

/* Files Container Fix */
.files-container,
.memories-container,
.urls-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0.5rem;
    min-height: 0; /* IMPORTANT: Add this */
}

/* Files/Memories/URLs Lists - Fix scrolling */
.files-list,
.memories-list,
.urls-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* IMPORTANT: Add this */
    max-height: calc(80vh - 300px); /* Adjust based on your header/footer heights */
}

/* For Files tab specifically */
.files-list {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    padding: 0; /* Remove padding to avoid scroll issues */
}

/* For Memories tab specifically */
.memories-list {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0; /* Remove padding to avoid scroll issues */
}

/* For URLs tab specifically */
.urls-list {
    padding: 0.5rem;
    max-height: calc(80vh - 350px); /* Slightly less for URLs due to bottom section */
}

/* Load More Button - Make it visible */
.load-more-btn {
    display: block;
    width: calc(100% - 1rem);
    margin: 0.5rem;
    padding: 0.75rem;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    flex-shrink: 0; /* Don't let it shrink */
}

.load-more-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Files bottom section - Ensure it doesn't overlap */
.files-bottom,
.urls-bottom {
    position: relative; /* Change from sticky to relative */
    bottom: auto;
    background-color: var(--surface);
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0; /* Don't let it shrink */
}

/* Memory actions - Ensure visibility */
.memory-actions {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface);
    flex-shrink: 0; /* Don't let it shrink */
}

/* Modal body - Ensure proper height calculation */
.file-manager-modal-content .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0; /* IMPORTANT: Add this */
    height: calc(80vh - 100px); /* Adjust based on header height */
}

/* Ensure file rows don't have issues */
.file-row,
.memory-row,
.url-row {
    flex-shrink: 0; /* Prevent rows from shrinking */
}

/* Fix for Memories List - leave room for Load More AND action buttons */
#memoriesList, .memories-list {
    flex: none !important;
    height: calc(100% - 120px) !important; /* Leave 120px for buttons */
    max-height: 300px !important; /* Maximum height */
    overflow-y: auto !important;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

/* Container should use flexbox properly */
#memories-tab {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.memories-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0.5rem;
}

/* Load More button positioning */
#loadMoreMemoriesBtn {
    flex-shrink: 0;
    margin: 10px 0;
}

/* Memory actions at the bottom */
.memory-actions {
    flex-shrink: 0;
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface);
    margin-top: auto;
}

/* Responsive Design for Tablets */
@media (max-width: 768px) {
    #memoriesList, .memories-list {
        height: calc(100% - 140px) !important; /* More space for wrapped buttons */
        max-height: 250px !important;
    }
    
    .memory-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .memory-actions .action-btn {
        flex: 1;
        min-width: 100px;
    }
    
    #loadMoreMemoriesBtn {
        margin: 8px 0;
        padding: 0.6rem;
        font-size: 0.875rem;
    }
}

/* Responsive Design for Mobile */
@media (max-width: 480px) {
    #memoriesList, .memories-list {
        height: calc(100% - 160px) !important; /* Even more space for stacked buttons */
        max-height: 200px !important;
    }
    
    .memory-actions {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .memory-actions .action-btn {
        width: 100%;
        padding: 0.75rem;
    }
    
    #loadMoreMemoriesBtn {
        margin: 6px 0;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Adjust memory rows on small screens */
    .memory-row {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .memory-title {
        font-size: 0.85rem;
    }
    
    .memory-date {
        font-size: 0.75rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    #memoriesList, .memories-list {
        height: calc(100% - 180px) !important;
        max-height: 150px !important;
    }
}

/* Fix for Files List - leave room for info section AND action buttons */
#filesList, .files-list {
    flex: none !important;
    height: calc(100% - 140px) !important; /* Leave space for bottom section */
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

/* Files tab container */
#files-tab {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.files-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0.5rem;
}

/* Files bottom section */
.files-bottom {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface);
    margin-top: auto;
}

/* Load More button for Files */
#loadMoreFilesBtn {
    flex-shrink: 0;
    margin: 10px 0;
}

/* Files info section */
.files-info {
    background-color: var(--surface-hover);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    flex: 1;
}

.files-info p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* File actions */
.file-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Responsive Design for Tablets */
@media (max-width: 768px) {
    #filesList, .files-list {
        height: calc(100% - 160px) !important;
        max-height: 250px !important;
    }
    
    .files-bottom {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.5rem;
    }
    
    .files-info {
        width: 100%;
        padding: 0.5rem;
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .file-actions .action-btn {
        flex: 1;
        min-width: 100px;
    }
    
    #loadMoreFilesBtn {
        margin: 8px 0;
        padding: 0.6rem;
        font-size: 0.875rem;
    }
}

/* Responsive Design for Mobile */
@media (max-width: 480px) {
    #filesList, .files-list {
        height: calc(100% - 180px) !important;
        max-height: 200px !important;
    }
    
    .files-info p {
        font-size: 0.7rem;
    }
    
    .file-actions {
        flex-direction: row;
        width: 100%;
    }
    
    .file-actions .action-btn {
        flex: 1;
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }
    
    #loadMoreFilesBtn {
        margin: 6px 0;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Adjust file rows on small screens */
    .file-row {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .file-name {
        font-size: 0.85rem;
    }
    
    .files-header-labels {
        display: none; /* Hide headers on mobile */
    }
}

/* Very small screens */
@media (max-width: 360px) {
    #filesList, .files-list {
        height: calc(100% - 200px) !important;
        max-height: 150px !important;
    }

    .file-actions .action-btn {
        padding: 0.5rem 0.3rem;
        fontf-size: 0.8rem;
    }
}

/* ============================================================================
   CONVERSATIONS HISTORY MODAL STYLES
   ============================================================================ */

/* Conversations modal centering */
#conversations-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Conversations list container */
.conversations-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#conversations-modal .modal-body {
    display: flex;
    justify-content: center;
}

/* Header actions (delete all button) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-delete-all-header {
    background: #ef4444;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.delete-icon-white {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

.delete-icon-red {
    width: 18px;
    height: 18px;
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

.loading-message, .no-conversations-message, .error-message {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

/* Individual conversation item */
.conversation-item {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    max-width: 600px;
    width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
}

.conversation-content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

/* Delete button on conversation item */
.conversation-delete-btn {
    background: transparent;
    color: #ef4444;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 0.25rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.conversation-delete-btn:hover {
    background: #fee;
    transform: scale(1.1);
}

.conversation-content {
    flex: 1;
    cursor: pointer;
    text-align: center;
}

.conversation-item:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Conversation header */
.conversation-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
}

.conversation-person {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.conversation-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Conversation details */
.conversation-details {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    justify-content: center;
}

.conversation-preview {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Conversation detail modal */
.conversation-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.conversation-modal-content {
    max-width: 700px;
    max-height: 85vh;
    width: 90%;
    display: flex;
    flex-direction: column;
}

.conversation-modal-content .modal-header {
    padding-bottom: 0.5rem;
}

.conversation-modal-content .modal-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Conversation metadata */
.conversation-metadata {
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
}

.conversation-metadata p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.conversation-metadata strong {
    color: var(--text-primary);
}

/* Exchanges container */
.conversation-exchanges {
    max-height: calc(85vh - 150px);
    overflow-y: auto;
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* Individual exchange item */
.exchange-item {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

/* Exchange timestamp */
.exchange-timestamp {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* Exchange content - MATCHING LIVE UI COLORS */
.exchange-content {
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
}

/* User message - BLUE like live UI */
.exchange-user .exchange-content {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    max-width: 70%;
}

/* Assistant message - GREEN like live UI */
.exchange-assistant .exchange-content {
    background-color: var(--success-color);
    color: white;
    max-width: 70%;
}

/* Exchange type badge */
.exchange-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    font-weight: 600;
}

.exchange-type-complete {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.exchange-type-unanswered {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.exchange-type-speak_only {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

/* Speaker label */
.exchange-speaker {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.exchange-user .exchange-speaker {
    text-align: right;
}

/* Scrollbar styling for conversations - only on exchanges */
.conversation-exchanges::-webkit-scrollbar {
    width: 8px;
}

.conversation-exchanges::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.conversation-exchanges::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.conversation-exchanges::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* Responsive design for conversations */
@media (max-width: 768px) {
    .conversation-modal-content {
        max-width: 95%;
        max-height: 90vh;
    }

    .exchange-user .exchange-content,
    .exchange-assistant .exchange-content {
        max-width: 85%;
    }

    .conversation-details {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Prompt Builder Button */
.prompt-builder-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    margin-top: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.prompt-builder-btn:hover {
    background: #45a049;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.5);
    transform: translateY(-2px);
}

.prompt-builder-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.4);
}

.prompt-builder-btn svg {
    flex-shrink: 0;
}

.prompt-builder-btn span {
    white-space: nowrap;
}
