html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Hide error UI by default - only show when Blazor adds 'show' class */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #b32121;
    color: white;
    padding: 1rem;
    z-index: 10000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui.show {
    display: block;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    margin-left: 0.5rem;
}

#blazor-error-ui .dismiss {
    float: right;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 1rem;
}

/* Loading state - show during initial load */
#app.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* Hide app content while loading */
#app.loading > *:not(.loading-screen) {
    display: none !important;
}

#app:not(.loading) .loading-screen {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-content {
    text-align: center;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    background: white;
    border-radius: 16px;
    padding: 3rem 3.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 420px;
    max-width: 500px;
}

/* Logo with animated pulse */
.loading-logo {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.logo-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10a37f 0%, #0d8b6b 100%);
    box-shadow: 0 8px 32px rgba(16, 163, 127, 0.4);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logo-float 3s ease-in-out infinite;
}

.logo-circle::before {
    content: 'AI';
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.logo-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #10a37f;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: 1;
}

.logo-pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #10a37f;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    animation-delay: 0.5s;
}

@keyframes logo-float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Loading title and subtitle */
.loading-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.3);
    margin: 0 0 0.5rem 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.loading-subtitle {
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 2.5rem 0;
    font-weight: 400;
}

/* Loading bar */
.loading-bar-container {
    width: 280px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.loading-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #10a37f 0%, #0d8b6b 50%, #10a37f 100%);
    background-size: 200% 100%;
    border-radius: 3px;
    position: relative;
    animation: loading-bar 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 0 15px rgba(16, 163, 127, 0.6), 0 0 30px rgba(16, 163, 127, 0.3);
    transform-origin: left center;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: loading-shine 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes loading-bar {
    0% {
        transform: scaleX(0);
        opacity: 0.8;
    }
    50% {
        transform: scaleX(0.75);
        opacity: 1;
    }
    100% {
        transform: scaleX(1);
        opacity: 0.9;
    }
}

@keyframes loading-shine {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(300%);
    }
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Markdown rendering styles for chat messages */
.message-content h1, .message-content h2, .message-content h3, 
.message-content h4, .message-content h5, .message-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.message-content h1 { font-size: 1.5rem; }
.message-content h2 { font-size: 1.3rem; }
.message-content h3 { font-size: 1.1rem; }

.message-content p {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.message-content ul, .message-content ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.message-content li {
    margin-bottom: 0.25rem;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}

.message-content th, .message-content td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    text-align: left;
}

.message-content th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.message-content code {
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.message-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
}

.message-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6c757d;
}

.message-content strong {
    font-weight: bold;
}

.message-content em {
    font-style: italic;
}

/* Chat Page Layout Override */
.chat-page-layout {
    height: 100vh;
    overflow: hidden;
}

.chat-page-layout .page {
    height: 100vh;
    overflow: hidden;
}

.chat-page-layout .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

.chat-page-layout main {
    margin-left: 0;
    height: 100vh;
    overflow: hidden;
    padding: 0;
    margin-top: 0;
    width: 100%;
}

.chat-content {
    padding: 0 !important;
    margin: 0 !important;
    height: 100vh;
    overflow: hidden;
}

.chat-content.content {
    padding-top: 0 !important;
}

.chat-content .chat-page {
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* Modern Chat Page Styles */
.chat-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 0;
    margin: 0;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: white;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    overflow: hidden;
    width: 100%;
}

.chat-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 0;
}

.chat-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    min-width: 0; /* Allow flex items to shrink */
}

.assistant-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.assistant-icon {
    display: none;
}

.assistant-details {
    flex: 1;
}

.assistant-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.assistant-subtitle {
    font-size: 1rem;
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-weight: 400;
}

.connection-status {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    flex-wrap: nowrap;
    flex-shrink: 0; /* Don't allow this container to shrink */
    white-space: nowrap; /* Prevent wrapping */
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.connected {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border: 2px solid rgba(40, 167, 69, 0.3);
}

.status-badge.disconnected {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 2px solid rgba(255, 193, 7, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    background: #f8f9fa;
}

.chat-messages-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    display: none;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 30px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.suggestion-chip {
    background: white;
    color: #1e293b;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.suggestion-chip:hover {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.3);
}

.loading-message {
    display: flex;
    justify-content: flex-start;
    margin-top: 15px;
}

.loading-content {
    background: white;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #1e293b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #1e293b;
    font-weight: 600;
    font-size: 0.9rem;
}

.message-wrapper {
    margin-bottom: 15px;
}

.message {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.user-message {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    margin-left: auto;
    border-radius: 20px 20px 5px 20px;
}

.assistant-message {
    background: white;
    color: #2c3e50;
    margin-right: auto;
    border: 1px solid #e9ecef;
    border-radius: 20px 20px 20px 5px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.8rem;
    opacity: 0.8;
}

.message-sender {
    font-weight: 600;
}

.message-time {
    font-size: 0.75rem;
}

.message-content {
    line-height: 1.6;
    font-size: 0.95rem;
}

.chat-input-container {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f7f7f8;
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid #e5e5e5;
    transition: all 0.3s ease;
    max-width: 1200px;
    margin: 0 auto;
    width: 90%;
}

.chat-input-wrapper:focus-within {
    border-color: #10a37f;
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 1rem;
    outline: none;
    color: #2c3e50;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 24px;
    max-height: 200px;
    font-family: inherit;
}

.chat-input::placeholder {
    color: #8e8ea0;
}

.chat-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button {
    background: #10a37f;
    color: white;
    border: none;
}

.send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.send-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.stop-button {
    background: #ef4444;
    color: white;
}

.stop-button:hover {
    background: #dc2626;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        margin: 0;
        border-radius: 0;
    }
    
    .chat-header {
        padding: 15px 20px;
        border-radius: 0;
    }
    
    .assistant-title {
        font-size: 1.5rem;
    }
    
    .chat-messages {
        padding: 15px 20px;
    }
    
    .chat-input-container {
        padding: 15px 20px;
    }
    
    .message {
        max-width: 85%;
    }
}