/* MAUI design tokens (see MAUI Resources/Styles/Colors.xaml + Styles.xaml) */
:root {
    --brand: #0B5FFF;
    --brand-hover: #0A54E0;
    --titlebar: #1591EA;
    --titlebar-text: #FFFFFF;
    --page-bg: #F5F7FB;
    --surface: #FFFFFF;
    --text: #111827;
    --text-secondary: #6B7280;
    --border: #D9DEE8;
    --danger: #DC2626;
    --radius-card: 18px;
    --radius-field: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --brand: #4C8DFF;
        --brand-hover: #6A9DFF;
        --titlebar: #12324A;
        --page-bg: #0E1116;
        --surface: #1B2028;
        --text: #F3F4F6;
        --text-secondary: #9AA4B2;
        --border: #2C333F;
    }
}

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--page-bg);
    color: var(--text);
}

h1:focus { outline: none; }

a, .btn-link { color: var(--brand); }

/* Brand title bar (mirrors the MAUI Shell chrome) */
.app-titlebar {
    background-color: var(--titlebar);
    color: var(--titlebar-text);
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

    .app-titlebar .brand {
        color: var(--titlebar-text);
        text-decoration: none;
        font-weight: 700;
        font-size: 1.2rem;
    }

    .app-titlebar .titlebar-back {
        color: var(--titlebar-text);
        text-decoration: none;
        font-size: 1.5rem;
        line-height: 1;
        font-weight: 700;
    }

/* MAUI TitleBarButton: transparent, white text + border */
.titlebar-btn {
    background-color: transparent;
    color: var(--titlebar-text);
    border: 1px solid var(--titlebar-text);
    border-radius: 8px;
    font-weight: 700;
    font-size: .85rem;
    padding: .35rem .9rem;
    cursor: pointer;
}

    .titlebar-btn:hover { background-color: rgba(255,255,255,.15); }

/* Fills the area under the title bar so a lone card can center vertically + horizontally */
.center-viewport {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-content {
    max-width: 920px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* Primary buttons -> brand, rounded, bold (MAUI Button style) */
.btn-primary {
    color: #fff;
    background-color: var(--brand);
    border-color: var(--brand);
    font-weight: 600;
    border-radius: var(--radius-field);
}

    .btn-primary:hover, .btn-primary:focus, .btn-primary:active {
        background-color: var(--brand-hover);
        border-color: var(--brand-hover);
    }

.btn-primary:disabled { opacity: .5; }

.btn { border-radius: var(--radius-field); }

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(11,95,255,.20);
}

/* Cards (MAUI CardBorder: surface, 1px border, radius 18) */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}

/* Fields (MAUI FieldBorder: surface, 1px border, radius 10, touch height) */
.form-control, .form-select {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-field);
    color: var(--text);
    min-height: 44px;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--brand);
    }

.text-muted { color: var(--text-secondary) !important; }
.text-danger { color: var(--danger) !important; }

.table { color: var(--text); --bs-table-bg: transparent; }

/* Home hub tiles — icon + title + description tap cards (mirrors the MAUI home cards) */
.nav-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    min-height: 92px;
    padding: 1.1rem 1.25rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    text-decoration: none;
    color: var(--text);
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

    .nav-tile:hover, .nav-tile:focus {
        border-color: var(--brand);
        box-shadow: 0 4px 14px rgba(11,95,255,.12);
        color: var(--text);
        text-decoration: none;
        transform: translateY(-1px);
    }

.nav-tile-icon {
    font-size: 2rem;
    line-height: 1;
    flex: 0 0 auto;
}

.nav-tile-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-tile-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.nav-tile-desc {
    color: var(--text-secondary);
    font-size: .85rem;
    line-height: 1.25;
}

/* Production go/stop actions + steppers + info tiles (MAUI Production palette) */
.btn-go { background-color: #1E9E57; border-color: #1E9E57; color: #fff; font-weight: 700; }
.btn-go:hover, .btn-go:focus { background-color: #178049; border-color: #178049; color: #fff; }
.btn-stop { background-color: #D9342B; border-color: #D9342B; color: #fff; font-weight: 700; }
.btn-stop:hover, .btn-stop:focus { background-color: #bd2a22; border-color: #bd2a22; color: #fff; }

.stepper-btn {
    background-color: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1;
    width: 44px;
    min-width: 44px;
    height: 44px;
}

    .stepper-btn:hover { background-color: var(--brand-hover); color: #fff; }

.timer-badge {
    background-color: #E3ECFB;
    color: #1B3A6B;
    font-weight: 700;
    font-size: .8rem;
    border-radius: 12px;
    padding: .25rem .6rem;
    height: fit-content;
    white-space: nowrap;
}

.step-label { color: #1B3A6B; font-weight: 700; font-size: .8rem; }

.info-tile {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem .6rem;
}

    .info-tile .lbl { font-size: .7rem; }

.content { padding-top: 1.1rem; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

#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: #b32121;
    padding: 1rem;
    color: white;
}

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

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 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: #0B5FFF;
            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");
    }

/* Dark-mode accent overrides — placed AFTER the base rules so source order wins (media queries do
   not add specificity). Lightens hard-coded light-mode accents that wash out on dark cards. */
@media (prefers-color-scheme: dark) {
    .step-label { color: #8FB3FF; }
    .timer-badge { background-color: #22314F; color: #CFE0FF; }
}
