/*
 * Single-page A4 checklist za grouped-by-code album-e (FIFA WC 2026 i sl.).
 * Koristi se za:
 *   - Browser HTML print view (route `album_print`) — sa screen toolbar-om
 *   - Gotenberg PDF render (route `album_pdf`) — bez toolbar-a (@media print)
 * Sve dimenzije sticker grida u mm/pt da bi i browser print i Gotenberg-ov Chromium
 * proizveli identičan A4 layout.
 */

@page {
    size: A4 portrait;
    margin: 8mm;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #0f172a;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #f1f5f9;
}

.checklist-page {
    width: 210mm;
    min-height: 281mm;
    margin: 12mm auto;
    padding: 8mm;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* ── Screen-only toolbar ────────────────────────────────────────────── */
.checklist-toolbar {
    max-width: 210mm;
    margin: 12mm auto 0;
    padding: 0 8mm;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.checklist-toolbar__views {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.checklist-toolbar__tab {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.checklist-toolbar__tab + .checklist-toolbar__tab {
    border-left: 1px solid #cbd5e1;
}

.checklist-toolbar__tab:hover {
    background: #f1f5f9;
}

.checklist-toolbar__tab--active {
    background: #0f172a;
    color: #fff;
}

.checklist-toolbar__tab--active:hover {
    background: #0f172a;
}

.checklist-toolbar__actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.checklist-toolbar__btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.checklist-toolbar__btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.checklist-toolbar__btn--pdf {
    background: #3b82f6;
    border-color: #2563eb;
    color: #fff;
}

.checklist-toolbar__btn--pdf:hover {
    background: #2563eb;
}

.checklist-toolbar__back {
    font-size: 13px;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
}

.checklist-toolbar__back:hover {
    text-decoration: underline;
}

@media print {
    html, body {
        background: #fff;
    }
    .checklist-toolbar {
        display: none;
    }
    .checklist-page {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
}

/* ── Header ─────────────────────────────────────────────────────────── */
.checklist-header {
    display: grid;
    grid-template-columns: 1fr 22mm;
    gap: 6mm;
    align-items: center;
    padding: 0 0 2mm 0;
    margin-bottom: 2mm;
    border-bottom: 0.5pt solid #1e293b;
}

.checklist-title {
    font-size: 14pt;
    font-weight: 800;
    letter-spacing: 0.2pt;
    line-height: 1.1;
    margin: 0;
    text-transform: uppercase;
}

.checklist-subtitle {
    font-size: 7pt;
    color: #475569;
    margin: 0.5mm 0 0 0;
    font-weight: 500;
}

.checklist-qr {
    width: 22mm;
    height: 22mm;
}

.checklist-qr img {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Row ─────────────────────────────────────────────────────────────── */
.checklist-row {
    display: grid;
    grid-template-columns: 32mm repeat(20, 1fr);
    gap: 0;
    border-bottom: 0.3pt solid #e2e8f0;
    page-break-inside: avoid;
    break-inside: avoid;
}

.checklist-row__label {
    display: flex;
    align-items: center;
    gap: 1.5mm;
    padding: 0 1.5mm;
    background: #f1f5f9;
    border-right: 0.3pt solid #cbd5e1;
    min-height: 4.6mm;
}

.checklist-row__flag {
    font-size: 10pt;
    line-height: 1;
    flex-shrink: 0;
}

.checklist-row__name {
    font-size: 7pt;
    font-weight: 700;
    color: #0f172a;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checklist-row__code {
    font-family: 'Courier New', monospace;
    font-size: 5pt;
    color: #64748b;
    font-weight: 400;
    flex-shrink: 0;
}

/* ── Cell ───────────────────────────────────────────────────────────── */
.checklist-cell {
    position: relative;
    font-family: 'Courier New', monospace;
    font-size: 5pt;
    font-weight: 600;
    text-align: center;
    border-right: 0.3pt solid #e2e8f0;
    color: #475569;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.6mm;
    line-height: 1;
    padding: 0;
    overflow: hidden;
}

.checklist-cell:last-child {
    border-right: none;
}

.checklist-cell__code {
    position: relative;
    z-index: 2;
}

/* status-want: pastel plava bez X-a (cilj, još nema) */
.checklist-cell.status-want {
    background: #dbeafe;
    color: #1e3a8a;
}

/* status-have: pastel zelena + zeleni X overlay */
.checklist-cell.status-have {
    background: #dcfce7;
    color: #14532d;
}

.checklist-cell.status-have::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top right,
            transparent calc(50% - 0.15mm),
            #16a34a calc(50% - 0.15mm),
            #16a34a calc(50% + 0.15mm),
            transparent calc(50% + 0.15mm)),
        linear-gradient(to top left,
            transparent calc(50% - 0.15mm),
            #16a34a calc(50% - 0.15mm),
            #16a34a calc(50% + 0.15mm),
            transparent calc(50% + 0.15mm));
    opacity: 0.75;
    pointer-events: none;
    z-index: 1;
}

/* status-duplicate: pastel žuta + žuto-narandžasti X (ima viška) */
.checklist-cell.status-duplicate {
    background: #fef3c7;
    color: #713f12;
}

.checklist-cell.status-duplicate::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top right,
            transparent calc(50% - 0.15mm),
            #b45309 calc(50% - 0.15mm),
            #b45309 calc(50% + 0.15mm),
            transparent calc(50% + 0.15mm)),
        linear-gradient(to top left,
            transparent calc(50% - 0.15mm),
            #b45309 calc(50% - 0.15mm),
            #b45309 calc(50% + 0.15mm),
            transparent calc(50% + 0.15mm));
    opacity: 0.75;
    pointer-events: none;
    z-index: 1;
}

/* Prazna ćelija (kada specijalna grupa ima manje od 20 sticker-a) */
.checklist-cell--empty {
    background: #f8fafc;
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.checklist-footer {
    margin-top: 2mm;
    padding-top: 1.5mm;
    border-top: 0.3pt solid #cbd5e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 6pt;
    color: #475569;
}

.checklist-footer strong {
    color: #0f172a;
}

.checklist-legend {
    display: flex;
    gap: 3mm;
    align-items: center;
}

.checklist-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 1mm;
}

.checklist-legend__swatch {
    display: inline-block;
    width: 3mm;
    height: 3mm;
    border: 0.3pt solid #94a3b8;
    position: relative;
}

.checklist-legend__swatch--have {
    background: #dcfce7;
}

.checklist-legend__swatch--have::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top right, transparent 45%, #16a34a 45%, #16a34a 55%, transparent 55%),
        linear-gradient(to top left, transparent 45%, #16a34a 45%, #16a34a 55%, transparent 55%);
    opacity: 0.85;
}

.checklist-legend__swatch--duplicate {
    background: #fef3c7;
}

.checklist-legend__swatch--duplicate::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top right, transparent 45%, #b45309 45%, #b45309 55%, transparent 55%),
        linear-gradient(to top left, transparent 45%, #b45309 45%, #b45309 55%, transparent 55%);
    opacity: 0.85;
}

.checklist-legend__swatch--want {
    background: #dbeafe;
}
