* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    padding: 20px 60px;
    margin-bottom: 0;
    border-bottom: 4px solid #1e40af;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    outline: none;
}

.header:focus,
.header *:focus:not(input):not(button):not(select):not(textarea) {
    outline: none;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-logo {
    flex-shrink: 0;
    margin-top: -10px;
    margin-left: -35px;
}

.header-logo img {
    height: 45px;
    width: auto;
    display: block;
}

.header-text {
    flex: 1;
    outline: none;
}

.header-text:focus,
.header-text *:focus {
    outline: none;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: white;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.beta-badge {
    display: inline-block;
    background: #fbbf24;
    color: #1e3a8a;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 6px;
    letter-spacing: 1px;
    vertical-align: middle;
    margin-left: 12px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(251, 191, 36, 0.6);
    }
}

/* Debug Toggle */
.debug-toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: auto;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.debug-toggle .toggle-label {
    min-width: 110px;
    text-align: left;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    transition: background-color 0.3s;
    margin-right: 10px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: #22c55e;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Inline toggle switch for search options */
.toggle-switch-inline {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.toggle-switch-inline .toggle-slider {
    width: 40px;
    height: 20px;
    background-color: #d1d5db;
    margin-right: 0;
}

.toggle-switch-inline .toggle-slider::before {
    width: 14px;
    height: 14px;
}

.toggle-switch-inline input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-switch-inline input[type="checkbox"]:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-message {
    background: white;
    padding: 20px 60px;
    margin-bottom: 0;
    border-bottom: 1px solid #e5e7eb;
}

.status-message.success {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    border-bottom: 1px solid #bbf7d0;
}

.error-message {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 20px 60px;
    margin-bottom: 0;
    border-bottom: 1px solid #fecaca;
    color: #991b1b;
}

.session-info {
    margin-top: 10px;
    font-weight: 600;
    color: #059669;
    font-size: 0.9rem;
}

/* Initial Suggestions */
.initial-suggestions {
    background: white;
    padding: 30px 60px;
    border-bottom: 1px solid #e5e7eb;
}

.initial-suggestions strong {
    display: block;
    margin-bottom: 15px;
    color: #374151;
    font-size: 1rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.query-section {
    background: white;
    padding: 30px 60px;
    border-bottom: 1px solid #e5e7eb;
}

.query-section-initial {
    flex-shrink: 0;
}

.query-section-pinned {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1400px;
    flex-shrink: 0;
    border-top: 3px solid #2563eb;
    border-bottom: none;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100;
    background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
    padding: 28px 60px 36px 60px;
    box-sizing: border-box;
}

.input-group {
    display: flex;
    gap: 10px;
}

.question-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 1.05rem;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.question-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.btn-primary {
    padding: 16px 48px;
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.processing-status {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 20px 60px;
    margin-bottom: 0;
    border-bottom: 1px solid #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 30px 60px;
    padding-bottom: 200px;
    background: #fafafa;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.result-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.question-display {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    color: #333;
}

.debug-info {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #00bcd4;
    color: #00838f;
}

.elapsed-time {
    margin-bottom: 15px;
    color: #666;
}

.token-detail {
    color: #888;
    font-size: 0.9em;
}

/* Prominent Answer Display */
.answer-display-prominent {
    margin-bottom: 20px;
    padding: 28px 32px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.answer-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-content {
    font-size: 1rem;
    color: #1f2937;
    line-height: 1.75;
    font-weight: 400;
}

.answer-content p {
    margin-bottom: 16px;
}

.answer-content p:last-child {
    margin-bottom: 0;
}

.answer-content ul,
.answer-content ol {
    margin: 12px 0 12px 24px;
}

.answer-content li {
    margin-bottom: 8px;
}

.answer-content strong {
    color: #111827;
    font-weight: 600;
}

.answer-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #1e40af;
}

.answer-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-copy:active {
    background: #e5e7eb;
}

.btn-copy.copied {
    background: #ecfdf5;
    border-color: #10b981;
    color: #10b981;
}

.btn-copy svg {
    flex-shrink: 0;
}

.copy-text {
    font-weight: 500;
}

/* Citations Display */
.citations-display {
    margin-bottom: 15px;
    padding: 15px;
    background: #fefce8;
    border-radius: 8px;
    border-left: 4px solid #eab308;
}

.citations-display strong {
    color: #854d0e;
    display: block;
    margin-bottom: 8px;
}

.citations-display ul {
    list-style: disc;
    margin-left: 20px;
    color: #713f12;
}

.citations-display li {
    margin-bottom: 4px;
}

/* Source Document Links */
.source-link {
    color: #1e40af;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.source-link:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.source-link:visited {
    color: #6b21a8;
}

.external-link-icon {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.source-link:hover .external-link-icon {
    opacity: 1;
}

/* File Type Icons */
.file-icon {
    flex-shrink: 0;
    margin-right: 6px;
    vertical-align: middle;
}

.file-icon-pdf {
    color: #dc2626;
}

.file-icon-word {
    color: #2563eb;
}

.file-icon-excel {
    color: #16a34a;
}

.file-icon-powerpoint {
    color: #ea580c;
}

.file-icon-text {
    color: #6b7280;
}

.file-icon-html {
    color: #7c3aed;
}

.file-icon-image {
    color: #0891b2;
}

.file-icon-default {
    color: #9ca3af;
}

.source-title {
    flex: 1;
}

.source-no-link {
    display: inline-flex;
    align-items: center;
    color: #713f12;
}

.error-display {
    padding: 15px;
    background: rgba(244, 67, 54, 0.05);
    border-radius: 8px;
    border-left: 4px solid #f44336;
    color: #d32f2f;
}

.error-display p {
    margin-top: 10px;
}

.suggested-questions {
    margin-top: 20px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.suggested-questions ul {
    list-style: none;
    margin-top: 10px;
}

.suggested-questions li {
    margin-bottom: 8px;
}

.suggested-questions strong {
    color: #1e40af;
    font-size: 1rem;
    font-weight: 600;
}

.suggestion-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.btn-suggestion {
    background: #eff6ff;
    color: #1e3a8a;
    border: 2px solid #3b82f6;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: fit-content;
}

.btn-suggestion::before {
    content: '→';
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.btn-suggestion:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-suggestion:hover:not(:disabled)::before {
    transform: translateX(3px);
}

.btn-suggestion:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #d1d5db;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.3);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 768px) {
    .chat-container {
        min-height: 0;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .status-message,
    .error-message,
    .initial-suggestions,
    .query-section,
    .processing-status,
    .results-section {
        padding-left: 20px;
        padding-right: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .suggestion-buttons {
        flex-direction: column;
    }

    .btn-suggestion {
        width: 100%;
    }
}

/* Search Options */
.search-options {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.search-results-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #4b5563;
}

.search-results-select {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.search-results-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.btn-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-info:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: white;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 24px;
}

.modal-body h4 {
    font-size: 1.1rem;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.modal-body h4:not(:first-child) {
    margin-top: 24px;
}

.modal-body ol {
    margin: 0 0 16px 24px;
    color: #4b5563;
    line-height: 1.8;
}

.modal-body ol li {
    margin-bottom: 8px;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.9rem;
}

.info-table th,
.info-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid #e5e7eb;
}

.info-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #1f2937;
}

.info-table td {
    color: #4b5563;
}

.info-table tr:nth-child(even) {
    background: #f9fafb;
}

.info-note {
    margin-top: 16px;
    padding: 12px 16px;
    background: #eff6ff;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
    font-size: 0.9rem;
}

.info-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fef3c7;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.info-warning svg {
    flex-shrink: 0;
    color: #d97706;
}

.modal-body p {
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 12px;
}

.modal-body ul {
    margin: 0 0 16px 24px;
    color: #4b5563;
    line-height: 1.8;
}

.modal-body ul li {
    margin-bottom: 6px;
}

/* Session Action Buttons */
.btn-clear-session,
.btn-export-session {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #6b7280;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-session:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-export-session:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-clear-session:disabled,
.btn-export-session:disabled,
.btn-view-prompt:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* View System Prompt Button */
.btn-view-prompt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #6b7280;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view-prompt:hover {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #22c55e;
}

/* System Prompt Modal */
.modal-content-wide {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content-wide .modal-body {
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 80px); /* Account for header */
}

.system-prompt-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #334155;
    word-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
    margin-top: 12px;
}

.system-prompt-content strong {
    color: #1e40af;
    font-weight: 700;
}

.system-prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    gap: 12px;
}

/* Session Warning Banner */
.session-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fef3c7;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.session-warning svg {
    flex-shrink: 0;
    color: #d97706;
}

/* Editable System Prompt Textarea */
.system-prompt-textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    resize: none;
    margin-top: 8px;
    overflow-y: hidden;
}

.system-prompt-textarea.auto-resize {
    overflow-y: hidden;
}

/* Read-only mode styling */
.system-prompt-textarea.readonly {
    background: #f8fafc;
    cursor: default;
    color: #475569;
}

/* Editable mode styling */
.system-prompt-textarea.editable {
    background: #ffffff;
    cursor: text;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.system-prompt-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Reset to Default Button */
.btn-reset-prompt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-prompt:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-reset-prompt:disabled,
.btn-reset-prompt.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Apply Changes Button */
.btn-apply-prompt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.btn-apply-prompt:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
    transform: translateY(-1px);
}

.btn-apply-prompt:disabled,
.btn-apply-prompt.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9ca3af;
    box-shadow: none;
}

/* Cancel Button */
.btn-cancel {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

/* Footer Layout */
.system-prompt-footer .footer-left {
    display: flex;
    gap: 8px;
}

.system-prompt-footer .footer-right {
    display: flex;
    gap: 10px;
}

/* Unsaved Changes Indicator */
.unsaved-changes-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fef3c7;
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
    color: #92400e;
    font-size: 0.85rem;
    margin-top: 12px;
}

.unsaved-changes-indicator svg {
    flex-shrink: 0;
    color: #d97706;
}

/* Changes Saved Indicator */
.changes-saved-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #dcfce7;
    border-radius: 6px;
    border-left: 3px solid #22c55e;
    color: #166534;
    font-size: 0.85rem;
    margin-top: 12px;
}

.changes-saved-indicator svg {
    flex-shrink: 0;
    color: #22c55e;
}

/* Textarea with unsaved changes */
.system-prompt-textarea.has-changes {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Prompt Section Header */
.prompt-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    margin-bottom: 6px;
}

/* Prompt Section Labels */
.prompt-section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

/* Edit Prompt Button */
.btn-edit-prompt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #3b82f6;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-edit-prompt:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #2563eb;
}

.btn-edit-prompt svg {
    flex-shrink: 0;
}

/* Editing Indicator */
.editing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
}

.editing-indicator svg {
    flex-shrink: 0;
}

.prompt-section-label.locked {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    margin-top: 20px;
}

.prompt-section-label.locked svg {
    color: #9ca3af;
}

/* Locked Prompt Display */
.locked-prompt-display {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #64748b;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Streaming Indicator - Three Dots */
.streaming-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

.streaming-indicator .dot {
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.streaming-indicator .dot:nth-child(1) {
    animation-delay: 0s;
}

.streaming-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.streaming-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* ============================================
   Markdown Content Styles (for LLM responses)
   ============================================ */

/* Headers */
.answer-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 1.25em 0 0.5em 0;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #e5e7eb;
}

.answer-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin: 1.1em 0 0.4em 0;
}

.answer-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #374151;
    margin: 1em 0 0.4em 0;
}

.answer-content h4,
.answer-content h5,
.answer-content h6 {
    font-size: 1rem;
    font-weight: 600;
    color: #4b5563;
    margin: 0.9em 0 0.3em 0;
}

/* Tables */
.answer-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 0.95rem;
    overflow-x: auto;
    display: block;
}

.answer-content table th,
.answer-content table td {
    border: 1px solid #d1d5db;
    padding: 10px 14px;
    text-align: left;
}

.answer-content table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #1f2937;
}

.answer-content table tr:nth-child(even) {
    background: #f9fafb;
}

.answer-content table tr:hover {
    background: #f0f9ff;
}

/* Code Blocks */
.answer-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1em 1.25em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.answer-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Inline Code */
.answer-content code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Blockquotes */
.answer-content blockquote {
    border-left: 4px solid #3b82f6;
    margin: 1em 0;
    padding: 0.75em 1em;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 0 8px 8px 0;
}

.answer-content blockquote p {
    margin: 0;
}

.answer-content blockquote blockquote {
    margin-top: 0.5em;
    border-left-color: #93c5fd;
}

/* Horizontal Rules */
.answer-content hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 1.5em 0;
}

/* Images */
.answer-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Links */
.answer-content a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.answer-content a:hover {
    border-bottom-color: #2563eb;
}

/* Task Lists (checkboxes) */
.answer-content ul.contains-task-list {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

.answer-content li.task-list-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.answer-content li.task-list-item input[type="checkbox"] {
    margin-top: 4px;
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

/* Definition Lists */
.answer-content dl {
    margin: 1em 0;
}

.answer-content dt {
    font-weight: 600;
    color: #1f2937;
    margin-top: 0.5em;
}

.answer-content dd {
    margin-left: 1.5em;
    color: #4b5563;
}

/* Footnotes */
.answer-content .footnotes {
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid #e5e7eb;
    font-size: 0.9rem;
    color: #6b7280;
}

.answer-content .footnote-ref {
    font-size: 0.8em;
    vertical-align: super;
    color: #3b82f6;
}

/* Abbreviations */
.answer-content abbr {
    text-decoration: underline dotted;
    cursor: help;
}

/* Keyboard input */
.answer-content kbd {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Highlighted/marked text */
.answer-content mark {
    background: #fef08a;
    padding: 1px 4px;
    border-radius: 2px;
}

/* Strikethrough */
.answer-content del,
.answer-content s {
    text-decoration: line-through;
    color: #9ca3af;
}

/* Superscript and Subscript */
.answer-content sup {
    font-size: 0.75em;
    vertical-align: super;
}

.answer-content sub {
    font-size: 0.75em;
    vertical-align: sub;
}

/* ============================================
   Blazor Server Reconnection Modal Styles
   ============================================ */

#components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

/* Hide all inner content by default */
#components-reconnect-modal .reconnect-content,
#components-reconnect-modal .reconnect-failed-content,
#components-reconnect-modal .reconnect-rejected-content {
    display: none;
}

/* Show modal during reconnection attempts */
#components-reconnect-modal.components-reconnect-show {
    display: flex;
}

#components-reconnect-modal.components-reconnect-show .reconnect-content {
    display: block;
}

/* Show modal when reconnection failed */
#components-reconnect-modal.components-reconnect-failed {
    display: flex;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-failed-content {
    display: block;
}

/* Show modal when connection rejected (session expired) */
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-rejected-content {
    display: block;
}

/* Show modal when circuit resume failed (server disposed the circuit) */
#components-reconnect-modal.components-reconnect-resume-failed {
    display: flex;
}

#components-reconnect-modal.components-reconnect-resume-failed .reconnect-rejected-content {
    display: block;
}

/* Hide modal when connection restored */
#components-reconnect-modal.components-reconnect-hide {
    display: none !important;
}

/* Modal content containers */
.reconnect-content,
.reconnect-failed-content,
.reconnect-rejected-content {
    display: none;
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icon styles */
.reconnect-icon {
    color: #3b82f6;
    margin-bottom: 1rem;
}

.reconnect-icon.failed {
    color: #ef4444;
}

.reconnect-icon.rejected {
    color: #f59e0b;
}

.reconnect-icon svg {
    animation: reconnectSpin 2s linear infinite;
}

.reconnect-icon.failed svg,
.reconnect-icon.rejected svg {
    animation: none;
}

@keyframes reconnectSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Text styles */
.reconnect-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.reconnect-message {
    color: #6b7280;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.reconnect-attempt {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.reconnect-countdown {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.reconnect-warning {
    font-size: 0.875rem;
    color: #f59e0b;
    background: #fef3c7;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Spinner */
.reconnect-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: reconnectSpinner 0.8s linear infinite;
}

@keyframes reconnectSpinner {
    to {
        transform: rotate(360deg);
    }
}

/* Buttons */
.reconnect-reload-btn,
.reconnect-retry-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0.25rem;
}

.reconnect-reload-btn {
    background: #3b82f6;
    color: white;
    border: none;
}

.reconnect-reload-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.reconnect-retry-btn {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.reconnect-retry-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
