/*
 * This file is compiled via Propshaft.
 * Tailwind is compiled separately via tailwindcss-rails.
 */

/* ── Compliance Schedule timeline ──────────────────────────────────────────
   A renewal fee window has a start and an end, so it is drawn as a bar rather
   than a point. These few rules are plain CSS because the geometry is
   computed server-side and set inline as percentages — Tailwind has no
   utility for "34% from the left, 8% wide". */

.tl-track {
    position: relative;
    height: 34px;
    background: #f8fafc;
    border-radius: 6px;
    overflow: hidden;
}

.tl-track::before {
    /* Faint gridline every 1/12 of the width, one per month on the track. */
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        to right, #e2e8f0 0 1px, transparent 1px calc(100% / 12)
    );
    background-size: calc(100% / 12) 100%;
}

.tl-bar {
    position: absolute;
    top: 9px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.tl-marker {
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
}

.tl-diamond {
    position: absolute;
    top: 11px;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    transform: rotate(45deg);
    border-radius: 2px;
}

.tl-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #c8102e;
    z-index: 5;
}

@media (prefers-reduced-motion: no-preference) {
    .tl-bar { transition: filter .15s ease; }
    .tl-bar:hover { filter: brightness(1.08); }
}

/* ── Licensing heat map ────────────────────────────────────────────────────
   An 11-column tile grid standing in for a US map. Plain CSS because the
   colour step is chosen server-side and applied as a class, and because
   aspect-ratio tiles in a fixed 11-column grid is not something Tailwind
   utilities express cleanly. */

.tilemap {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: 6px;
}

.tile {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .1s ease, border-color .1s ease;
    line-height: 1.1;
    text-decoration: none;
}

.tile:hover    { transform: scale(1.08); border-color: #0a1a3d; }
.tile.selected { border-color: #0a1a3d; box-shadow: 0 0 0 3px rgba(10, 26, 61, .15); }
.tile-count    { font-size: 9px; font-weight: 600; opacity: .75; }

/* Heat steps 0-4, plus the two states that are not a quantity: a state with
   no licences at all, and one whose cover has already failed. */
.heat-0      { background: #f1f5f9; color: #94a3b8; }
.heat-1      { background: #dae2f3; color: #1f3566; }
.heat-2      { background: #8aa3d4; color: #0a1a3d; }
.heat-3      { background: #3d5ea0; color: #ffffff; }
.heat-4      { background: #152a55; color: #ffffff; }
.heat-risk   { background: #fee2e2; color: #991b1b; box-shadow: inset 0 0 0 2px #ef4444; }
.heat-vacant { background: #c8102e; color: #ffffff; box-shadow: inset 0 0 0 2px #7f1020; }
.heat-none   { background: #ffffff; color: #cbd5e1; box-shadow: inset 0 0 0 1px #e2e8f0; }

/* Matrix cell marker. */
.hm-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 9999px;
}

/* ── The hidden attribute always wins ──────────────────────────────────────
   Tailwind's display utilities (flex, grid) are declared after its base
   `[hidden] { display: none }` rule and quietly override it, so an element with
   both `hidden` and `flex` stays visible. The Stimulus controllers toggle the
   attribute to show and hide parts of forms, so it has to be authoritative. */
[hidden] {
    display: none !important;
}
