/* Align toolbar/mobile menu popovers to the right edge of the app bar */
.mud-toolbar-menu + .mud-popover,
.mud-toolbar-menu .mud-popover,
.mud-popover.mud-menu,
.mud-popover.mud-toolbar-menu {
    left: auto !important;
    right: 0 !important;
    transform-origin: top right !important;
}

/* Small offset to avoid clipping under the app bar shadow */
.mud-popover {
    margin-top: 6px;
}

/* Existing styles (unchanged) */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0; /* remove default browser margin that caused white strip */
    background-color: #1a1a27; /* match MudMainContent background to avoid bottom strip */
    color: rgba(255,255,255,0.87);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

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

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    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;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPj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E4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* MudBlazor typography defaults for this project */
.mud-typography.mud-typography-body1,
.mud-typography.mud-typography-body2,
.mud-typography.mud-typography-subtitle1,
.mud-typography.mud-typography-subtitle2 {
    text-align: justify;
    color: rgba(255,255,255,0.75); /* enforce readable light text for body typography */
}

/* Keep headings centered */
.mud-typography.mud-typography-h5,
.mud-typography.mud-typography-h6,
.mud-typography.mud-typography-h4 {
    text-align: center;
}

/* Style for the message textarea to make it visually distinct */
.message-textarea, textarea.message-textarea {
    border: 1px solid rgba(255,255,255,0.12);
    background-color: rgba(255,255,255,0.02);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    box-sizing: border-box;
    min-height: 6rem;
    resize: vertical;
    color: inherit;
}

.message-textarea:focus, textarea.message-textarea:focus {
    outline: none;
    border-color: #7c4dff; /* subtle accent on focus */
    box-shadow: 0 0 0 6px rgba(124,77,255,0.06);
}

/* Dark filled inputs similar to background so fields blend with theme */
input.mud-input-element,
textarea.mud-input-element,
.mud-input-root .mud-input-slot input,
.mud-input-root .mud-input-slot textarea {
    background-color: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    color: inherit !important;
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
}

input.mud-input-element:focus,
textarea.mud-input-element:focus,
.mud-input-root .mud-input-slot input:focus,
.mud-input-root .mud-input-slot textarea:focus {
    outline: none;
    border-color: #7c4dff !important;
    box-shadow: 0 0 0 6px rgba(124,77,255,0.06) !important;
}

/* Temporary diagnostic bar at the bottom */
#diagnostic-ui {
    background-color: rgba(255, 255, 255, 0.9);
    border-top: 2px solid #0071c1;
    color: #333;
    height: 3rem;
    left: 0;
    padding: 0.5rem 1rem;
    position: fixed;
    text-align: center;
    top: auto;
    width: 100%;
    z-index: 2000;
    display: none; /* hidden by default */
}

#diagnostic-ui.show {
    display: block; /* shown when there's an error */
}

#diagnostic-ui .dismiss {
    cursor: pointer;
    float: right;
    font-weight: bold;
}

#diagnostic-ui pre {
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    white-space: pre-wrap; /* wrap long lines */
    word-wrap: break-word; /* break words if necessary */
}

/* End of diagnostic bar styles */
/* Make the container use full width on small screens while preserving desktop layout */
@media (max-width: 600px) {
  /* use the custom class so other pages are unaffected */
  .full-mobile,
  .full-mobile .mud-container {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0.1rem !important;  /* small horizontal padding so content isn't edge-to-edge */
    padding-right: 0.1rem !important;
    box-shadow: none !important; /* remove outer shadow if that appears like a border */
    border-left: none !important;
    border-right: none !important;
  }

  /* If MudCard or other child components add extra page-level padding, reduce it here */
  .full-mobile .mud-card,
  .full-mobile .mud-paper {
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-shadow: none !important;
  }
}

/* Drawer small sizing */
.drawer-content .mud-nav-link,
.drawer-content .mud-nav-menu,
.drawer-content .mud-list-item,
.drawer-content .mud-button {
  font-size: 0.9rem !important; /* slightly smaller text */
}

.drawer-content .mud-icon-button .mud-icon-root,
.drawer-content .mud-icon,
.drawer-content svg {
  width: 18px !important;
  height: 18px !important;
}

/* Tighten nav link padding inside drawer */
.drawer-content .mud-nav-link {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

/* Hide Blazor error UI banner (shown when unhandled errors occur) */
#blazor-error-ui {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Markdown content styling for spotlights */
.markdown-content {
  color: var(--mud-palette-text-primary, rgba(255,255,255,0.87));
  line-height: 1.6;
  font-family: var(--mud-typography-body1-font-family, 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif);
  font-size: var(--mud-typography-body1-font-size, 0.95rem);
  font-weight: var(--mud-typography-body1-font-weight, 400);
  text-align: justify; /* default body text alignment: justified to match MudBlazor body style */
  text-justify: inter-word;
}

/* Ensure markdown inherits Mud typography colors when dark/light theme toggles */
.markdown-content, .markdown-content * {
  color: inherit;
}

/* Headings mimic Mud h4/h5 sizing/weight */
.markdown-content h1 { font-size: var(--mud-typography-h4-font-size, 1.5rem); font-weight: 500; }
.markdown-content h2 { font-size: var(--mud-typography-h5-font-size, 1.25rem); font-weight: 500; }
.markdown-content h3 { font-size: var(--mud-typography-h6-font-size, 1.05rem); font-weight: 500; }
/* Add extra spacing above section headings generated from markdown (e.g. '##') so they sit lower */
.markdown-content h2 { margin-top: 2.0rem; margin-bottom: 0.5rem; }

/* Images inside markdown: responsive and visually consistent */
.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 0.5rem auto;
}

/* Paragraph spacing */
.markdown-content p { margin: 0.5rem 0; }

/* Ensure lists display correctly and match MudBlazor spacing */
.markdown-content ul,
.markdown-content ol {
  margin: 0.6rem 0 0.6rem 1.25rem;
  padding-left: 1rem;
  list-style-position: outside;
  color: inherit;
  text-align: left; /* keep list items left-aligned for readability while paragraphs are justified */
}

.markdown-content ul {
  list-style-type: disc !important;
}

.markdown-content ol {
  list-style-type: decimal !important;
}

.markdown-content li {
  margin: 0.35rem 0;
}

/* Nested lists */
.markdown-content li ul,
.markdown-content li ol {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

/* Blockquotes */
.markdown-content blockquote {
  border-left: 4px solid rgba(0,0,0,0.08);
  padding: 0.5rem 1rem;
  margin: 0.5rem 0;
  color: rgba(0,0,0,0.65);
  background: rgba(0,0,0,0.02);
}

/* Code blocks */
.markdown-content pre {
  overflow: auto;
  background: var(--mud-palette-surface, rgba(255,255,255,0.03));
  padding: 0.75rem;
  border-radius: 6px;
  color: var(--mud-palette-text-primary, rgba(255,255,255,0.87));
}

.markdown-content code { background: rgba(0,0,0,0.06); padding: 0.15rem 0.3rem; border-radius: 3px; }

/* Tables */
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
}
.markdown-content th,
.markdown-content td {
  padding: 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  text-align: left;
}

/* small utility to match Mud spacing for lists inside cards */
.mud-card .markdown-content { padding: 0.5rem 0; }
/* Spotlights mini-grid list */
.spotlight-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Each row: image | content | action */
.spotlight-item {
  display: grid;
  grid-template-columns: 160px 1fr 72px;
  gap: 1rem;
  align-items: stretch;
  border: 1px solid var(--mud-palette-divider, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 0.6rem;
  background: var(--mud-palette-surface, rgba(255,255,255,0.02));
}

/* Image fills its column and keeps aspect ratio */
.spotlight-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* Content column: title at top, synopsis below */
.spotlight-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
}

/* Right-side action: center the icon */
.spotlight-action {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive: stack on small screens */
@media (max-width: 720px) {
  .spotlight-item {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .spotlight-image img {
    height: 200px; /* fixed preview height on mobile */
  }
  .spotlight-action {
    justify-content: flex-end;
    padding-top: 0.5rem;
  }
}