/* Theme tokens. Every color in the app comes from here; components never hard-code colors. */
:root {
    --tl-black: #111111;        /* sidebar, top bar, login background */
    --tl-black-soft: #2a2a2a;   /* lighter end of black gradients */
    --tl-yellow: #ffc600;       /* primary accent: buttons, active items, highlights */
    --tl-yellow-dark: #d9a800;  /* hover state of yellow elements */
    --tl-amber: #8a6a00;        /* yellow readable on white: links */
    --tl-surface: #ffffff;      /* content background */
    --tl-text: #1a1a1a;         /* text on light surfaces */
    --tl-text-on-dark: #f2f2f2; /* text on black surfaces */
    --tl-muted-on-dark: #b0b0b0;
    --tl-border: #e3e3e3;

    /* Chart series colors, assigned to battery types in this order (statistics page). */
    --tl-chart-1: #ffc600;
    --tl-chart-2: #111111;
    --tl-chart-3: #8a6a00;
    --tl-chart-4: #8c8c8c;
    --tl-chart-5: #ffe27a;
    --tl-chart-6: #4a4a4a;
    --tl-chart-7: #c9a227;
    --tl-chart-8: #c4c4c4;

    /* Calendar heat levels, light to dark. */
    --tl-heat-1: #ffefb3;
    --tl-heat-2: #ffdb66;
    --tl-heat-3: #ffc600;
    --tl-heat-4: #111111;

    /* The main gradient: used on the sidebar and the login page, not on content. */
    --tl-gradient-dark: linear-gradient(180deg, var(--tl-black) 0%, var(--tl-black-soft) 100%);

    /* Bootstrap hooks so that its own components follow the theme. */
    --bs-primary: var(--tl-yellow);
    --bs-primary-rgb: 255, 198, 0;
    --bs-link-color: var(--tl-amber);
    --bs-link-hover-color: var(--tl-black);
    --bs-body-color: var(--tl-text);
    --bs-body-bg: var(--tl-surface);
    --bs-focus-ring-color: rgba(255, 198, 0, 0.4);
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

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

/* Primary action: yellow with black text. */
.btn-primary {
    --bs-btn-color: var(--tl-black);
    --bs-btn-bg: var(--tl-yellow);
    --bs-btn-border-color: var(--tl-yellow);
    --bs-btn-hover-color: var(--tl-black);
    --bs-btn-hover-bg: var(--tl-yellow-dark);
    --bs-btn-hover-border-color: var(--tl-yellow-dark);
    --bs-btn-active-color: var(--tl-black);
    --bs-btn-active-bg: var(--tl-yellow-dark);
    --bs-btn-active-border-color: var(--tl-yellow-dark);
    --bs-btn-disabled-color: var(--tl-black);
    --bs-btn-disabled-bg: var(--tl-yellow);
    --bs-btn-disabled-border-color: var(--tl-yellow);
    font-weight: 600;
}

.btn-outline-primary {
    --bs-btn-color: var(--tl-black);
    --bs-btn-border-color: var(--tl-yellow);
    --bs-btn-hover-color: var(--tl-black);
    --bs-btn-hover-bg: var(--tl-yellow);
    --bs-btn-hover-border-color: var(--tl-yellow);
    --bs-btn-active-color: var(--tl-black);
    --bs-btn-active-bg: var(--tl-yellow);
    --bs-btn-active-border-color: var(--tl-yellow);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--tl-yellow-dark);
    box-shadow: 0 0 0 0.25rem rgba(255, 198, 0, 0.4);
}

/* Headings get a short yellow underline. */
h1 {
    padding-bottom: 0.4rem;
    border-bottom: 3px solid var(--tl-yellow);
    display: inline-block;
}

/* Tables: dark header row with yellow text. */
.table > thead {
    --bs-table-bg: var(--tl-black);
    --bs-table-color: var(--tl-yellow);
    --bs-table-border-color: var(--tl-black);
}

.card {
    border-color: var(--tl-border);
    border-top: 3px solid var(--tl-yellow);
}

.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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aC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I2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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;
}

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

/* Full-screen dark background for pages without the sidebar (login). */
.tl-dark-page {
    background: var(--tl-gradient-dark);
    color: var(--tl-text-on-dark);
}

/* App name on the login card. */
.tl-brand {
    display: block;
    border-bottom: none;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--tl-black);
}

.tl-brand::after {
    content: "";
    display: block;
    width: 3rem;
    height: 3px;
    margin: 0.5rem auto 0;
    background: var(--tl-yellow);
}

/* Language switcher (UA / EN), shown next to the app name and under the login card. */
.tl-culture-switcher {
    display: inline-flex;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.tl-culture-switcher a {
    color: var(--tl-muted-on-dark);
    text-decoration: none;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
}

.tl-culture-switcher a:hover:not(.active) {
    color: var(--tl-text-on-dark);
}

.tl-culture-switcher a.active {
    color: var(--tl-black);
    background: var(--tl-yellow);
}

/* Dashboard: one card per battery type, a box per stage with the count of batteries there. */
.tl-type-card {
    border: 1px solid var(--tl-border);
    border-top: 3px solid var(--tl-yellow);
    border-radius: 0.375rem;
    background: var(--tl-surface);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.tl-type-card .tl-type-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    border: none;
    padding: 0;
}

.tl-stages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.tl-stage {
    flex: 1 1 8rem;
    min-width: 8rem;
    border: 1px solid var(--tl-border);
    border-radius: 0.375rem;
    padding: 0.6rem 0.75rem;
    text-align: center;
}

.tl-stage .tl-stage-count {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.tl-stage .tl-stage-name {
    font-size: 0.85rem;
    color: #555;
}

.tl-stage.tl-stage-shipped {
    background: var(--tl-black);
    border-color: var(--tl-black);
    color: var(--tl-yellow);
}

.tl-stage.tl-stage-shipped .tl-stage-name {
    color: var(--tl-muted-on-dark);
}

.tl-scan-feedback {
    min-height: 2.5rem;
}

/* The scan field on the production page: focusable and typed into, but not visible. */
.tl-scan-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    border: 0;
    padding: 0;
    overflow: hidden;
}

/* Charts (Components/Charts). Global rather than scoped CSS: scoped styles are not applied to SVG elements. */
.tl-donut {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.tl-donut svg {
    width: 11rem;
    height: 11rem;
    flex: 0 0 auto;
}

.tl-donut-total {
    font-size: 22px;
    font-weight: 700;
    fill: var(--tl-text);
}

.tl-donut-caption {
    font-size: 8px;
    fill: #666;
}

.tl-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 10rem;
    font-size: 0.9rem;
}

.tl-legend li {
    display: grid;
    grid-template-columns: 0.8rem 1fr auto 3rem;
    gap: 0.5rem;
    align-items: center;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--tl-border);
}

.tl-legend li:last-child {
    border-bottom: none;
}

.tl-legend-swatch {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 2px;
    vertical-align: -2px;
}

.tl-bars-legend .tl-legend-swatch, .table .tl-legend-swatch {
    margin-right: 0.3rem;
}

.tl-legend-value {
    font-weight: 600;
    text-align: right;
}

.tl-legend-share {
    color: #666;
    text-align: right;
}
.tl-bars svg {
    width: 100%;
    height: auto;
}

.tl-bars-grid {
    stroke: var(--tl-border);
    stroke-width: 1;
}

.tl-bars-tick, .tl-bars-label {
    font-size: 10px;
    fill: #666;
}

.tl-bars-value {
    font-size: 10px;
    font-weight: 600;
    fill: var(--tl-text);
}

.tl-bars-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0.5rem 0 0;
    padding: 0;
    font-size: 0.85rem;
}

.tl-calendar svg {
    width: 100%;
    max-width: 44rem;
    height: auto;
}

.tl-calendar-label {
    font-size: 9px;
    fill: #666;
}

.tl-calendar-today {
    stroke: var(--tl-black);
    stroke-width: 1.5;
}

.tl-calendar-scale {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #666;
}

.tl-calendar-swatch {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 2px;
}
