html, body {
    font-family: 'Inter', 'Roboto', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Skip-to-content link for keyboard accessibility */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--mud-palette-primary);
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}

.skip-link:focus {
    left: 10px;
    top: 10px;
}

/* Visible focus indicators for keyboard navigation (WCAG AA) */
:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* Refined card styling */
.mud-card {
    border: 1px solid rgba(128, 128, 128, 0.08);
}

/* Softer paper shadows */
.mud-paper {
    border: 1px solid rgba(128, 128, 128, 0.06);
}

/* More refined button hover states */
.mud-button-filled:hover {
    filter: brightness(1.08);
}

/* Smoother transitions globally */
.mud-button, .mud-card, .mud-paper, .mud-nav-link {
    transition: all 0.2s ease;
}

/* Nav link active state refinement */
.mud-nav-link.active {
    background: rgba(92, 107, 192, 0.12) !important;
    border-left: 3px solid var(--mud-palette-primary);
}

/* Subtle gradient header for tables */
.mud-table-head {
    background: linear-gradient(180deg, rgba(128, 128, 128, 0.04) 0%, transparent 100%);
}

/* Fix table hover styling for dark theme */
.mud-table-row:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

.mud-table-row.mud-table-row-hover:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Striped table rows - more subtle */
.mud-table-striped .mud-table-row:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.02);
}

.mud-table-striped .mud-table-row:nth-child(odd):hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

.mud-table-striped .mud-table-row:nth-child(even):hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Table cell padding refinement */
.mud-table-cell {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Selected row styling */
.mud-table-row.mud-selected {
    background-color: rgba(92, 107, 192, 0.15) !important;
}

.mud-table-row.mud-selected:hover {
    background-color: rgba(92, 107, 192, 0.2) !important;
}

/* Fix conversation sidebar alignment */
.conversation-sidebar-container {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    height: 80vh;
}

.conversation-sidebar-container .conversation-list {
    flex: 1 1 auto;
    overflow-y: auto;
    display: block;
}

h1:focus {
    outline: none;
}

.cursor-pointer {
    cursor: pointer;
}

.cursor-pointer:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-in-out;
}

.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."
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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;
}

/* ==========================================
   Full-Screen Chat Mode
   ========================================== */

/* Container for full-screen capable chat areas */
.chat-fullscreen-container {
    position: relative;
    transition: all 0.3s ease;
}

/* When in full-screen mode */
.chat-fullscreen-container.fullscreen {
    position: fixed;
    top: 64px; /* Below the app bar */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050; /* Below MudAppBar (1100) so nav bar stays accessible */
    background: var(--mud-palette-background);
    padding: 0;
    margin: 0;
}

/* Hide sibling elements when container is in fullscreen */
.chat-fullscreen-container.fullscreen ~ * {
    display: none !important;
}

/* Full-screen toggle button styling */
.fullscreen-toggle-btn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.fullscreen-toggle-btn:hover {
    opacity: 1;
}

/* Chat paper should fill the container in fullscreen mode */
.chat-fullscreen-container.fullscreen .chat-fullscreen-paper {
    height: calc(100vh - 64px) !important;
    max-height: calc(100vh - 64px) !important;
    border-radius: 0 !important;
}

/* Header adjustments in fullscreen */
.chat-fullscreen-container.fullscreen .chat-header {
    border-radius: 0;
}

/* Ensure proper spacing for the chat messages area */
.chat-fullscreen-container.fullscreen .chat-messages {
    max-height: calc(100vh - 64px - 140px); /* Account for app bar, header, and input area */
}

/* Mobile-specific fullscreen adjustments */
@media (max-width: 600px) {
    .chat-fullscreen-container.fullscreen {
        top: 56px; /* Mobile app bar is smaller */
    }
    .chat-fullscreen-container.fullscreen .chat-messages {
        max-height: calc(100vh - 56px - 120px);
    }
}

/* Animation for entering/exiting fullscreen */
.chat-fullscreen-container {
    transition: position 0s,
                top 0.3s ease,
                left 0.3s ease,
                right 0.3s ease,
                bottom 0.3s ease,
                z-index 0s;
}

/* Hide sidebar columns in fullscreen mode */
.chat-fullscreen-container.fullscreen .mud-grid > .mud-item:first-child {
    display: none !important;
}

/* Expand chat column to full width in fullscreen mode */
.chat-fullscreen-container.fullscreen .mud-grid > .mud-item:last-child {
    flex-basis: 100% !important;
    max-width: 100% !important;
}

/* Ensure the fullscreen container doesn't interfere with the drawer */
.chat-fullscreen-container.fullscreen + .sliding-options-drawer {
    z-index: 1300; /* Drawer should be above fullscreen content */
}
