/* ============================================================
   ID CARDS — Printable Student ID Card (CR80) & A4 Bulk Layouts
   Strictly complies with <= 350 lines limit
   ============================================================ */

/* ── ID Card Preview Controls ──────────────────────────────── */
.id-side-switcher {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.id-side-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.id-side-btn:hover {
    color: var(--tenant-primary);
    border-color: var(--tenant-primary);
}

.id-side-btn.active {
    background: var(--tenant-primary);
    color: #ffffff;
    border-color: var(--tenant-primary);
}

.id-cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12mm;
    align-items: center;
    padding: 10px;
}

/* ── CR80 Card Box (85.6mm x 54mm) ─────────────────────────── */
.student-id-card {
    width: var(--id-card-width, 85.6mm);
    height: var(--id-card-height, 54mm);
    min-width: var(--id-card-width, 85.6mm);
    min-height: var(--id-card-height, 54mm);
    max-width: var(--id-card-width, 85.6mm);
    max-height: var(--id-card-height, 54mm);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #94a3b8;
    border-radius: 3mm;
    font-family: 'Inter', -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    page-break-inside: avoid;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.student-id-card.hidden-side { display: none !important; }

.id-card-front, .id-card-back {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.id-card-header {
    background: #1e293b;
    color: #ffffff;
    padding: 1.8mm 2.8mm 1.5mm 2.8mm;
    border-bottom: 0.7mm solid var(--tenant-primary, #2563eb);
    display: flex;
    align-items: center;
    gap: 2.2mm;
    flex-shrink: 0;
}

.id-logo-wrap {
    width: 8.5mm;
    height: 8.5mm;
    background: #ffffff;
    border-radius: 1.5mm;
    padding: 0.5mm;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.id-logo-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }

.id-header-titles { flex: 1; min-width: 0; overflow: hidden; }
.id-header-titles .school-title {
    font-family: 'Outfit', sans-serif;
    font-size: 7.2pt;
    font-weight: 800;
    line-height: 1.1;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.id-header-titles .school-subtitle {
    font-size: 4.8pt;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.3mm;
}

.id-card-badge {
    font-size: 4.8pt;
    font-weight: 700;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 0.3mm solid rgba(56, 189, 248, 0.4);
    padding: 0.4mm 1.4mm;
    border-radius: 1mm;
    text-transform: uppercase;
    flex-shrink: 0;
}

.id-card-body {
    display: flex;
    flex: 1;
    padding: 2mm 2.8mm 1.5mm 2.8mm;
    gap: 2.5mm;
    align-items: center;
    background: #ffffff;
    min-height: 0;
}

.id-photo-box {
    width: 18.5mm;
    height: 23mm;
    background: #f1f5f9;
    border: 0.4mm solid #94a3b8;
    border-radius: 1.5mm;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.id-photo-box img { width: 100%; height: 100%; object-fit: cover; }

.id-details-list {
    flex: 1;
    min-width: 0;
    font-size: 5.6pt;
    line-height: 1.35;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.id-student-name {
    font-family: 'Outfit', sans-serif;
    font-size: 7.6pt;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 0.35mm solid #e2e8f0;
    padding-bottom: 0.5mm;
    margin-bottom: 0.7mm;
}

.id-field-row { display: flex; justify-content: space-between; }
.id-field-row strong { color: #475569; font-weight: 600; }

.id-card-footer {
    background: #f8fafc;
    border-top: 0.3mm solid #e2e8f0;
    padding: 1.2mm 2.8mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 5pt;
    color: #64748b;
    flex-shrink: 0;
}

.id-sig-line {
    border-bottom: 0.3mm dashed #94a3b8;
    min-width: 15mm;
    display: inline-block;
    text-align: center;
    font-weight: 600;
    color: #334155;
}

/* ── ID Card Back Details ──────────────────────────────────── */
.id-back-header {
    background: #0f172a;
    color: #ffffff;
    padding: 1.5mm 2.8mm;
    font-size: 5.8pt;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    flex-shrink: 0;
}

.id-back-body-full {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 2.2mm 3mm 1.8mm 3mm;
    gap: 1.6mm;
    background: #ffffff;
    justify-content: space-between;
    min-height: 0;
}

.id-back-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2mm;
    border-bottom: 0.3mm solid #e2e8f0;
    padding-bottom: 1.2mm;
}

.id-back-cell {
    display: flex;
    flex-direction: column;
    font-size: 5.2pt;
    line-height: 1.25;
}

.id-back-label { font-weight: 700; color: #0f172a; margin-bottom: 0.3mm; }
.id-back-val { color: #334155; }
.id-back-rules {
    font-size: 4.6pt;
    color: #64748b;
    background: #f8fafc;
    border: 0.3mm dashed #cbd5e1;
    padding: 1mm 1.5mm;
    border-radius: 1mm;
    line-height: 1.2;
}

.id-back-footer {
    background: #f8fafc;
    border-top: 0.3mm solid #e2e8f0;
    padding: 1.1mm 2.8mm;
    font-size: 4.6pt;
    color: #64748b;
    text-align: center;
    flex-shrink: 0;
}

/* ── A4 Bulk Layout Sheet ──────────────────────────────────── */
.a4-pages-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.a4-page {
    width: 210mm;
    height: 297mm;
    min-width: 210mm;
    min-height: 297mm;
    max-width: 210mm;
    max-height: 297mm;
    box-sizing: border-box;
    padding: 10mm 15mm;
    display: grid;
    grid-template-columns: 85.6mm 85.6mm;
    grid-template-rows: repeat(5, 54mm);
    gap: 1.75mm 8.8mm;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin: 0 auto;
    page-break-after: always;
    break-after: page;
    position: relative;
}

.a4-page-badge {
    position: absolute;
    top: 2mm;
    right: 3mm;
    font-size: 7pt;
    color: #94a3b8;
    font-weight: 600;
}

.id-preview-scale-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.id-bulk-print-toolbar {
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 210mm;
}

