/* ═══════════════════════════════════════════════════
   ROOT VARIABLES
   ═══════════════════════════════════════════════════ */
:root {
    --card-scale: 3;
    --primary:   #0f4c81;
    --secondary: #5e6d7c;
    --radius:    8px;
}

/* Card preview scale per viewport width */
@media screen and (max-width: 600px) {
    :root { --card-scale: 1; }
}
@media screen and (min-width: 601px) and (max-width: 900px) {
    :root { --card-scale: 2; }
}

/* ═══════════════════════════════════════════════════
   RESET / BASE
   ═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(120deg, #f7f9fc 0%, #eaf1f7 100%);
    color: #1b2636;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════ */
.container {
    max-width: 980px;
    margin: 30px auto;
    padding: 0 16px;
}

.panel {
    background: #ffffff;
    border: 1px solid #dde6f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 24px rgba(15, 41, 77, 0.08);
}

h1, h2, h3, p { margin-top: 0; }

/* ═══════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════ */
.nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.nav a,
button,
.btn {
    border: 0;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 14px;
    min-height: 42px;
    line-height: 1.3;
    transition: filter 0.15s;
}

.nav a:hover,
button:hover,
.btn:hover { filter: brightness(1.12); }

.nav a.secondary,
.btn.secondary { background: var(--secondary); }

/* ═══════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════ */
input[type='text'],
input[type='date'],
input[type='file'],
input[type='password'] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c8d5e2;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type='text']:focus,
input[type='date']:focus,
input[type='password']:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: 600;
}

.grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full { grid-column: 1 / -1; }

/* ═══════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-weight: 600;
}

.alert.ok  { background: #e8f8ef; color: #145c35; border: 1px solid #a7e2bc; }
.alert.bad { background: #fdecec; color: #7f1f1f; border: 1px solid #f1b8b8; }

/* ═══════════════════════════════════════════════════
   CARD SHELL — ISO/IEC 7810 ID-1  (85.6 × 54 mm)
   ═══════════════════════════════════════════════════ */
.card {
    width:    85.6mm;
    height:   54mm;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* card.png is the blank FKF template */
.card-exact {
    background: url('../card.png') no-repeat 0 0 / 100% 100%;
    border: none;
    font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', Arial, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust:         exact;
    color-adjust:               exact;
}

/* Reserve space so layout doesn't collapse; uses CSS var for scale */
.card-screen-wrap {
    width:    calc(85.6mm * var(--card-scale));
    height:   calc(54mm   * var(--card-scale));
    position: relative;
    margin:   0 auto 28px;
    overflow: visible;
}

@media screen {
    .card {
        transform:        scale(var(--card-scale));
        transform-origin: top left;
        position:         absolute;
        top:  0;
        left: 0;
    }
    .panel { overflow-x: auto; }
}

/* ── Passport photo ── */
.exact-photo {
    position:        absolute;
    left:    1.8mm;
    top:    14.2mm;
    width:  19.4mm;
    height: 25.2mm;
    object-fit:      cover;
    object-position: center top;
    display:         block;
}

/* ── Signature block ── */
.exact-sig {
    position:       absolute;
    left:  1.0mm;
    top:  40.2mm;
    width: 21.0mm;
    font-family:    Arial, Helvetica, sans-serif;
    font-size:      1.2mm;
    font-weight:    700;
    color:          #111;
    text-transform: uppercase;
    line-height:    1.7;
    text-align:     center;
}

/* ── Right-side fields container ── */
.exact-fields {
    position:       absolute;
    left:  23.0mm;
    top:   14.5mm;
    width: 60.5mm;
    display:        flex;
    flex-direction: column;
}

.f-row {
    display:     flex;
    align-items: flex-end;
    height:      6.3mm;
    gap:         0.5mm;
}

.f-label {
    font-family:    Impact, Haettenschweiler, 'Arial Narrow Bold', Arial, sans-serif;
    font-size:      2.2mm;
    color:          #0d0d0d;
    white-space:    nowrap;
    text-transform: uppercase;
    flex-shrink:    0;
    line-height:    1;
    padding-bottom: 0.4mm;
}

.f-val {
    font-family:    Impact, Haettenschweiler, 'Arial Narrow Bold', Arial, sans-serif;
    font-size:      2.2mm;
    color:          #0d0d0d;
    text-transform: uppercase;
    flex:           1;
    min-width:      0;
    border-bottom:  0.3mm dotted #2a2a2a;
    padding-bottom: 0.4mm;
    overflow:       hidden;
    text-overflow:  ellipsis;
    white-space:    nowrap;
    line-height:    1;
}

.f-val.f-static {
    border-bottom:  none;
    letter-spacing: 0.1mm;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════ */

/* ── Tablet (≤ 900 px) ── */
@media (max-width: 900px) {
    .container { margin: 20px auto; }
}

/* ── Large mobile / small tablet (≤ 720 px) ── */
@media (max-width: 720px) {
    .grid { grid-template-columns: 1fr; }
}

/* ── Mobile (≤ 600 px) ── */
@media (max-width: 600px) {
    .container {
        margin:  10px auto;
        padding: 0 10px;
    }

    .panel {
        padding:       14px 12px;
        border-radius: 10px;
    }

    h1 { font-size: 20px; }
    h2 { font-size: 17px; }

    .nav {
        gap:           6px;
        margin-bottom: 14px;
    }

    /* Buttons stretch to share the row evenly */
    .nav a,
    button,
    .btn {
        flex:          1 1 auto;
        justify-content: center;
        padding:       9px 10px;
        font-size:     13px;
        min-height:    40px;
    }

    /* Prevent iOS zoom on input focus */
    input[type='text'],
    input[type='date'],
    input[type='file'],
    input[type='password'] {
        font-size: 16px;
    }

    .card-screen-wrap { margin-bottom: 14px; }

    img[alt='Player Photo'] {
        max-width: 100%;
        height: auto;
        border-radius: 6px;
    }
}

/* ═══════════════════════════════════════════════════
   PRINT  (single-card popup window)
   ═══════════════════════════════════════════════════ */
@media print {
    html, body {
        margin:     0 !important;
        padding:    0 !important;
        background: #fff !important;
        width:      85.6mm !important;
        height:     54mm  !important;
        overflow:   hidden !important;
    }

    .hide-print { display: none !important; }

    .container, .panel, h2 {
        margin:     0 !important;
        padding:    0 !important;
        border:     none !important;
        box-shadow: none !important;
        background: none !important;
        display:    block !important;
    }

    .card-screen-wrap {
        width:    85.6mm !important;
        height:   54mm   !important;
        position: static !important;
        margin:   0      !important;
        overflow: hidden !important;
    }

    .card {
        transform:  none     !important;
        position:   relative !important;
        width:      85.6mm   !important;
        height:     54mm     !important;
        box-shadow: none     !important;
        margin:     0        !important;
        overflow:   hidden   !important;
    }

    .card-exact {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust:         exact !important;
        color-adjust:               exact !important;
    }

    .exact-photo {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust:         exact !important;
    }

    @page {
        size:   85.6mm 54mm;
        margin: 0;
    }
}
