:root {
    --appbar-height: 64px;
}
@media (min-width: 601px) {
    :root {
        --appbar-height: 80px;
    }
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}

/* AppBar is fixed; main content needs deterministic top padding so page headers are never hidden */
.main-content-offset {
    padding-top: var(--appbar-height) !important;
}

/* Premium AppBar styling - MudAppBar Fixed="true" handles position; ensure z-index and spacing */
.appbar-premium {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    min-height: 64px;
    z-index: 1300;
}
.mud-theme-dark .appbar-premium {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
.appbar-premium .appbar-title {
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.appbar-premium .mud-select-outlined {
    margin-right: 12px;
    min-width: 140px;
    max-width: 220px;
}
.appbar-premium .mud-menu {
    margin-right: 8px;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    .appbar-premium .mud-select-outlined {
        min-width: 120px;
        max-width: 160px;
    }
}

.login-page-wrapper {
    width: 100%;
}

.login-card {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.login-header {
    margin-bottom: 18px;
    text-align: center;
}

.login-title {
    font-weight: 700;
}

.login-subtitle {
    opacity: 0.75;
    margin-top: 6px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-actions {
    display: flex;
    justify-content: flex-end;
}

.login-button {
    border-radius: 12px;
    height: 48px;
}

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."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Force anything inside chart sections to fill width, regardless of MudBlazor internal markup */
.full-width-chart {
    width: 100%;
    max-width: none !important;
}

.full-width-chart .chart-host {
    width: 100%;
    max-width: none !important;
    display: block;
}

.full-width-chart .chart-aspect {
    width: 100%;
}

.full-width-chart .chart-aspect--tall {
    height: 420px;
}

.full-width-chart .chart-aspect--medium {
    height: 300px;
}

/* Make MudChart and its svg fill the aspect box */
.full-width-chart .chart-aspect .mud-chart,
.full-width-chart .chart-aspect svg.mud-chart-line {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Keep legend from crushing the plot; allow wrapping */
.full-width-chart .mud-chart-legend {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
    font-size: 0.85rem;
    margin-top: 6px;
}

.full-width-chart .mud-chart-legend-item {
    margin: 0 !important;
}

.full-width-chart .mud-chart-legend-marker {
    width: 10px;
    height: 10px;
}

.full-width-chart .chart-fill {
    width: 100% !important;
    max-width: none !important;
    display: block !important;
}

/* SiteDetail layout spacing and cards */
.site-detail-grid {
    margin-top: 8px;
}
.site-card {
    border-radius: 12px;
}
.site-card--chart {
    min-height: 460px;
    display: flex;
    flex-direction: column;
}
.site-card--chart .full-width-chart,
.site-card--chart .chart-host,
.site-card--chart .chart-aspect,
.site-card--chart .chart-aspect--tall {
    flex: 1 1 auto;
    min-height: 0;
}
.site-card--chart .full-width-chart {
    display: flex;
    flex-direction: column;
}
.site-card--chart .chart-host {
    display: flex;
    flex-direction: column;
}
.site-card--chart .chart-aspect--tall {
    height: auto;
}
.site-card--chart .mud-chart-legend {
    margin-top: 6px !important;
    padding-bottom: 0 !important;
}
.site-card--chart .mud-chart {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.site-card--live {
    min-height: 160px;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
}

/* Top row cards (Device Info + Live Monitoring summary) - compact, same height */
.site-card--top {
    min-height: 220px;
    display: flex;
    flex-direction: column;
}
.site-card--deviceinfo .device-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}
.site-card--livemon-summary {
    min-height: 220px;
}

/* Live Monitoring layout */
.live-monitoring-header {
    margin-bottom: 10px;
}
.live-monitoring-chips {
    max-height: 72px;
    overflow: hidden;
}
.live-monitoring-chips .mud-chip {
    margin-bottom: 6px;
}

/* Empty state styling */
.telemetry-empty {
    margin-top: 12px;
}

/* DeviceTelemetryChart shell - consistent chart height */
.telemetry-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.telemetry-chart-area {
    height: 260px;
}
.telemetry-placeholder {
    height: 100%;
    border-radius: 8px;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0,0,0,0.05) 0px,
            rgba(0,0,0,0.05) 1px,
            transparent 1px,
            transparent 52px
        );
    opacity: 0.6;
}
.mud-theme-dark .telemetry-placeholder {
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(255,255,255,0.05) 0px,
            rgba(255,255,255,0.05) 1px,
            transparent 1px,
            transparent 52px
        );
}

.full-width-chart .mud-chart-legend {
    margin-top: 8px;
}
