html, body {
    font-family: Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
}

/*
 * Pilot portraits: square crop is baked on save, so display is always simple cover/center.
 * Editor still uses object-position + optional zoom while framing.
 */
.pilot-portrait {
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    background: #424242;
    flex-shrink: 0;
}

.pilot-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--portrait-x, 50%) var(--portrait-y, 50%);
    transform: scale(var(--portrait-zoom, 1));
    transform-origin: var(--portrait-x, 50%) var(--portrait-y, 50%);
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.pilot-portrait--sm {
    width: 40px;
    height: 40px;
}

.pilot-portrait--lg {
    width: 120px;
    height: 120px;
}

/* Displayed saved portraits are pre-cropped — always center, no zoom */
.pilot-portrait--final img {
    object-position: 50% 50%;
    transform: none;
}

.pilot-portrait-editor {
    width: min(280px, 80vw);
    height: min(280px, 80vw);
    border-radius: 50%;
    margin: 0 auto;
    cursor: grab;
    touch-action: none;
    border: 2px solid var(--mud-palette-primary, #b71c1c);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.pilot-portrait-editor:active {
    cursor: grabbing;
}

.pilot-portrait-editor img {
    pointer-events: none;
}

/* Baseline page colors before MudBlazor hydrates (see theme.js data-theme) */
html[data-theme="light"] body {
    background-color: #fafafa;
    color: rgba(0, 0, 0, 0.87);
}

html[data-theme="dark"] body {
    background-color: #121212;
    color: rgba(255, 255, 255, 0.87);
}

h1:focus {
    outline: none;
}

a {
    color: inherit;
}

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

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

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

/* Minimal form styling for Identity account pages (static SSR; no Bootstrap) */
.form-floating {
    position: relative;
    margin-bottom: 1rem;
}

.form-floating > .form-control,
.form-control {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #9e9e9e;
    border-radius: 4px;
    background: transparent;
    color: inherit;
}

html[data-theme="dark"] .form-floating > .form-control,
html[data-theme="dark"] .form-control {
    border-color: #616161;
    background: rgba(255, 255, 255, 0.04);
}

.form-floating > label,
.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #616161;
}

html[data-theme="dark"] .form-floating > label,
html[data-theme="dark"] .form-label {
    color: #bdbdbd;
}

.form-floating > .form-control:focus {
    outline: 2px solid #b71c1c;
    border-color: #b71c1c;
}

html[data-theme="dark"] .form-floating > .form-control:focus {
    outline-color: #ef5350;
    border-color: #ef5350;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.25;
}

.btn-primary {
    background: #b71c1c;
    color: #fff;
}

.btn-primary:hover {
    background: #9a1818;
}

html[data-theme="dark"] .btn-primary {
    background: #ef5350;
    color: #121212;
}

html[data-theme="dark"] .btn-primary:hover {
    background: #e57373;
}

.btn-link {
    background: transparent;
    color: #b71c1c;
    text-decoration: underline;
    padding: 0.25rem 0.5rem;
}

html[data-theme="dark"] .btn-link {
    color: #ef5350;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.05rem;
}

.w-100 {
    width: 100%;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.col-lg-6,
.col-md-6,
.col-md-4,
.col-lg-4 {
    flex: 1 1 280px;
    min-width: 0;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.text-danger {
    color: #c62828;
}

html[data-theme="dark"] .text-danger {
    color: #ef9a9a;
}

.text-secondary {
    color: #757575;
}

.text-muted {
    color: #757575;
}

html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] .text-muted {
    color: #bdbdbd;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1rem 0;
}

html[data-theme="dark"] hr {
    border-top-color: #424242;
}

/* Manage account nav */
.nav-pills {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.nav-pills .nav-item {
    margin-bottom: 0.25rem;
}

.nav-pills .nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
}

.nav-pills .nav-link.active,
.nav-pills .nav-link:hover {
    background: rgba(183, 28, 28, 0.12);
    color: #b71c1c;
}

html[data-theme="dark"] .nav-pills .nav-link.active,
html[data-theme="dark"] .nav-pills .nav-link:hover {
    background: rgba(239, 83, 80, 0.16);
    color: #ef5350;
}
