/*
 * Affiliate Monitor
 *
 * Plain CSS, no build step. Sized from the viewport so the dashboard fills
 * a TV in full screen (1080p and 4K) without scrolling.
 * Colors from Webready's brand: coral #f16272 and teal #19acca.
 */

:root {
    --coral: #f16272;
    --coral-dark: #eb1c33;
    --teal: #19acca;
    --teal-dark: #1699b3;
    --teal-darker: #117286;
    --teal-darkest: #0e5f6f;

    --bg: #071a20;
    --bg-glow: #0c3340;
    --panel: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text: #f1f5f8;
    --muted: #8fa3ad;
    --faint: #4f6670;

    --current: var(--teal);
    --previous: rgba(25, 172, 202, 0.32);
    --up: #4fd18b;
    --down: var(--coral);

    --radius: 1.25rem;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* One rem is 1/70 of the height or 1/122 of the width, whichever is smaller */
html {
    font-size: clamp(11px, min(1.43vh, 0.82vw), 64px);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(ellipse at 15% 0%, var(--bg-glow) 0%, var(--bg) 55%) fixed, var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-feature-settings: "tnum" 1, "cv11" 1;
    line-height: 1.3;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--teal);
}

/* Brand */

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand__dot {
    width: 0.9em;
    height: 0.9em;
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 0 1.2em rgba(241, 98, 114, 0.6);
}

.brand__team {
    color: var(--muted);
    font-weight: 500;
}

/* Change indicator, e.g. "+12,3 %" */

.change {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9em;
    white-space: nowrap;
}

.change:empty {
    display: none;
}

.change--up {
    color: var(--up);
    background: rgba(79, 209, 139, 0.12);
}

.change--down {
    color: var(--down);
    background: rgba(241, 98, 114, 0.12);
}

.change--none {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.06);
}

/* Bars, height set from JS as --size between 0 and 1 */

.bar {
    display: block;
    flex: 1;
    height: calc(var(--size, 0) * 100%);
    min-height: 0.25rem;
    border-radius: 0.5rem 0.5rem 0.15rem 0.15rem;
    background: var(--current);
    transition: height 1s ease;
}

.bar--previous {
    background: var(--previous);
}

/* ------------------------------------------------------------------------
 * Dashboard
 * --------------------------------------------------------------------- */

.dashboard {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 1.45fr) auto;
    gap: 1.6rem;
    height: 100vh;
    padding: 2rem 2.6rem 1.4rem;
    overflow: hidden;
}

.dashboard__header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.dashboard__header .brand {
    font-size: 1.9rem;
}

.clock {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.clock__time {
    font-size: 5.2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.clock__colon {
    transition: opacity 0.3s;
}

.clock__colon--off {
    opacity: 0.25;
}

.clock__date {
    margin-top: 0.3rem;
    color: var(--muted);
    font-size: 1.6rem;
    font-weight: 500;
}

.clock__date::first-letter {
    text-transform: uppercase;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    padding: 0.7rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.icon-button:hover,
.icon-button:focus-visible {
    color: var(--text);
    background: var(--panel);
}

.icon-button svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Day, week and month */

.kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.6rem;
    min-height: 0;
}

.kpi,
.year {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
}

.kpi {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 7rem;
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 1.5rem;
    padding: 1.5rem 1.8rem 1.6rem;
    min-height: 0;
}

.kpi__title,
.year__title {
    margin: 0;
    color: var(--muted);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.kpi__title {
    grid-column: 1 / -1;
}

.kpi__figures {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 0;
}

.figure {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 0.8rem;
}

.figure__label {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 1.3rem;
    font-weight: 500;
}

.figure__value {
    font-size: 4.6rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.figure--previous .figure__value {
    font-size: 2.9rem;
    color: #c9d6dd;
}

.figure__compare {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--muted);
    font-size: 1.4rem;
}

.unit {
    margin-left: 0.15em;
    font-size: 0.45em;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0;
}

.kpi__bars {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    padding-top: 1rem;
}

/* Year */

.year {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1.4rem;
    padding: 1.6rem 1.8rem 1.4rem;
    min-height: 0;
}

.year__header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.6rem 1.6rem;
}

.year__value {
    font-size: 3.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.year__compare {
    color: var(--muted);
    font-size: 1.5rem;
}

.year__compare strong {
    color: var(--text);
    font-weight: 600;
}

.change--large {
    font-size: 1.5rem;
}

.legend {
    display: flex;
    gap: 1.4rem;
    margin-left: auto;
    color: var(--muted);
    font-size: 1.2rem;
}

.legend__item::before {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-right: 0.45em;
    border-radius: 0.2em;
    background: var(--current);
    vertical-align: -0.05em;
}

.legend__item--previous::before {
    background: var(--previous);
}

.months {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0 1.2rem;
    min-height: 0;
}

.month {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto auto auto;
    justify-items: center;
    min-height: 0;
    text-align: center;
}

.month__bars {
    display: flex;
    align-items: flex-end;
    gap: 0.3rem;
    width: 100%;
    height: 100%;
    padding: 0 0.4rem;
}

.month__label {
    margin-top: 0.7rem;
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.month__year {
    margin-left: 0.2em;
    color: var(--muted);
    font-size: 0.75em;
    font-weight: 600;
}

.month__value {
    margin-top: 0.2rem;
    font-size: 1.45rem;
    font-weight: 700;
    white-space: nowrap;
}

.month__compare {
    color: var(--muted);
    font-size: 1.3rem;
    white-space: nowrap;
}

.month .change {
    margin-top: 0.35rem;
    font-size: 1.15rem;
}

/* Months after the current one show last year compared to the year before */
.month--rolling .bar {
    opacity: 0.5;
}

.month--current-last {
    position: relative;
}

.month--current-last::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: -0.6rem;
    border-right: 2px dashed rgba(241, 98, 114, 0.55);
}

.dashboard__footer {
    display: flex;
    justify-content: space-between;
    color: var(--faint);
    font-size: 1.1rem;
}

.status--error {
    color: var(--coral);
}

/* Hide the cursor on the TV when the mouse is idle */
.idle,
.idle * {
    cursor: none !important;
}

/* ------------------------------------------------------------------------
 * Login, settings and other forms
 * --------------------------------------------------------------------- */

.page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
    font-size: 16px;
}

.card {
    width: 100%;
    max-width: 30rem;
    padding: 2.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.3);
}

.card--wide {
    max-width: 44rem;
}

.card .brand {
    margin-bottom: 1.75rem;
    font-size: 1.1rem;
}

.card__title {
    margin: 0 0 1.5rem;
    font-size: 1.6rem;
    font-weight: 700;
}

.card__back {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--muted);
    text-decoration: none;
}

.card__back:hover {
    color: var(--text);
}

.form {
    display: grid;
    gap: 1.1rem;
}

.field {
    display: grid;
    gap: 0.4rem;
}

.field__label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.field__row {
    display: flex;
    gap: 0.6rem;
}

.field__row input {
    flex: 1;
}

.field__error {
    color: var(--coral);
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.6rem;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: inherit;
    font-feature-settings: "tnum" 1;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(25, 172, 202, 0.25);
}

input:disabled {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
}

.field--error input {
    border-color: var(--coral);
}

.field--success input {
    border-color: var(--up);
}

.checkbox,
.radio {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--teal);
}

.button {
    padding: 0.8rem 1.4rem;
    border: 0;
    border-radius: 0.6rem;
    background: var(--teal);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.button:hover,
.button:focus-visible {
    background: var(--teal-dark);
}

.button--secondary {
    background: rgba(255, 255, 255, 0.08);
}

.button--secondary:hover,
.button--secondary:focus-visible {
    background: rgba(255, 255, 255, 0.14);
}

.form__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.4rem;
}

.alert {
    padding: 0.8rem 1rem;
    border-radius: 0.6rem;
    font-weight: 600;
}

.alert--success {
    color: var(--up);
    background: rgba(79, 209, 139, 0.12);
}

.alert--error {
    color: var(--coral);
    background: rgba(241, 98, 114, 0.12);
}
