/* ==========================================================================
   TLG — A4 registration document
   Shared by the on-screen preview, the applicant slip, the admin print view
   and the dompdf download. Kept to plain block/table CSS because dompdf
   supports neither flexbox nor grid.
   ========================================================================== */

.a4 {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 16mm 15mm;
    background: #fff;
    color: #1b1b1b;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 10.5pt;
    line-height: 1.45;
    box-sizing: border-box;
}

/* ---------- masthead ---------- */
.doc-head { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.doc-head td { vertical-align: middle; border: 0; padding: 0; }
.doc-crest { width: 72px; }
.doc-crest img { width: 64px; height: auto; display: block; }
.doc-title { padding-left: 12px !important; }
.doc-title h1 {
    margin: 0; font-size: 19pt; letter-spacing: .04em;
    color: #1A2E5E; font-family: Georgia, 'Times New Roman', serif;
}
.doc-sub   { margin: 2px 0 0; font-size: 9pt; color: #5C6470; }
.doc-motto { margin: 1px 0 0; font-size: 8.5pt; color: #B67A08; font-style: italic; }
.doc-ref { width: 128px; }
.doc-ref-box { width: 128px; border: 1px solid #1A2E5E; border-collapse: collapse; }
.doc-ref-box td { padding: 3px 5px; text-align: center; border: 0; }
.doc-ref-label {
    background: #1A2E5E; color: #fff;
    font-size: 7pt; letter-spacing: .12em; text-transform: uppercase;
}
.doc-ref-id {
    font-size: 18pt; color: #1A2E5E;
    font-family: Georgia, serif; font-weight: 700; line-height: 1.1;
}

.doc-banner {
    margin: 4px 0 16px; padding: 7px 0;
    border-top: 2px solid #1A2E5E; border-bottom: 2px solid #1A2E5E;
    text-align: center; font-size: 11.5pt; letter-spacing: .08em;
    color: #1A2E5E; font-family: Georgia, serif;
}

/* ---------- sections ---------- */
.doc-section {
    margin: 15px 0 7px; padding: 5px 9px;
    background: #EEF1F8; border-left: 4px solid #EFA81C;
    font-size: 9.5pt; letter-spacing: .07em; text-transform: uppercase;
    color: #1A2E5E;
}

.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th,
.doc-table td {
    border-bottom: 1px dotted #B9BFCC;
    padding: 5px 4px; text-align: left; vertical-align: top;
    font-size: 10pt; font-weight: 400;
}
.doc-table th { width: 38%; color: #5C6470; }
.doc-table td { color: #16181d; }

.doc-declaration { font-size: 9.5pt; color: #333; }
.doc-declaration p { margin: 0 0 6px; }
.doc-accepted {
    margin-top: 8px !important; padding: 6px 10px;
    background: #FBF8F1; border-left: 3px solid #EFA81C; font-size: 9.5pt;
}

/* ---------- signature blocks ---------- */
.doc-sign { width: 100%; border-collapse: collapse; margin-top: 26px; }
.doc-sign td { width: 50%; padding: 0 18px 0 0; vertical-align: bottom; }
.doc-sign-single td { width: 60%; }
.doc-sign-line { border-bottom: 1px solid #1b1b1b; height: 26px; }
.doc-sign span {
    display: block; margin-top: 4px;
    font-size: 7.5pt; letter-spacing: .1em; text-transform: uppercase; color: #5C6470;
}

/* ---------- official use ---------- */
.doc-official { margin-top: 26px; border: 1px solid #1A2E5E; padding: 10px 14px 14px; }
.doc-official h3 {
    margin: 0 0 8px; padding: 5px 0;
    border-top: 2px solid #4A79C4; border-bottom: 2px solid #4A79C4;
    text-align: center; font-size: 10pt; letter-spacing: .1em; color: #1b1b1b;
    font-family: Georgia, serif;
}
.doc-table-official th { width: 42%; }

.doc-foot {
    margin-top: 18px; padding-top: 8px; border-top: 1px solid #E3E6ED;
    text-align: center; font-size: 8pt; color: #5C6470;
}

/* ---------- on-screen framing (never in the PDF) ---------- */
.a4-stage { background: #E9ECF3; padding: 28px 14px; }
.a4-stage .a4 { box-shadow: 0 10px 34px rgba(11,23,51,.18); }

.doc-actions {
    max-width: 210mm; margin: 0 auto 18px; text-align: center;
}
.doc-actions .btn { margin: 0 5px 8px; }

@media print {
    .a4-stage { background: #fff; padding: 0; }
    .a4 { box-shadow: none; margin: 0; width: auto; min-height: 0; padding: 10mm; }
    .doc-actions, .site-header, .topbar, .site-footer, .page-banner, .no-print { display: none !important; }
}

@media (max-width: 820px) {
    .a4 { width: 100%; min-height: 0; padding: 18px 16px; font-size: 10pt; }
    .doc-ref-id { font-size: 14pt; }
}

/* dotted fill for unanswered lines: clipped so a long run cannot wrap */
.doc-blank {
    display: inline-block; max-width: 100%; overflow: hidden;
    white-space: nowrap; color: #9AA1B0; letter-spacing: 1px;
}

/* ---------- pre-submission preview overlay ---------- */
.preview-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(11, 23, 51, .62);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 24px 14px; overflow-y: auto;
}
.preview-overlay[hidden] { display: none; }

.preview-shell {
    width: 100%; max-width: 236mm; background: #fff;
    border-radius: 14px; overflow: hidden;
    box-shadow: 0 26px 70px rgba(11, 23, 51, .34);
    display: flex; flex-direction: column;
}
.preview-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 16px 22px; background: #1A2E5E; color: #fff;
}
.preview-bar h2 {
    margin: 0; font-size: 1.02rem; color: #fff;
    font-family: 'Inter', sans-serif; font-weight: 650;
}
.preview-bar i { color: #EFA81C; margin-right: 7px; }
.preview-close {
    background: rgba(255,255,255,.12); border: 0; color: #fff; cursor: pointer;
    width: 34px; height: 34px; border-radius: 50%; font-size: 1rem;
}
.preview-close:hover { background: #EFA81C; color: #0B1733; }

.preview-body { background: #E9ECF3; padding: 22px 14px; overflow-x: auto; }
.preview-body .a4 { box-shadow: 0 8px 26px rgba(11,23,51,.16); min-height: 0; }

.preview-foot {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    padding: 16px 22px; border-top: 1px solid #E3E6ED; background: #fff;
    flex-wrap: wrap;
}

@media (max-width: 820px) {
    .preview-body { padding: 14px 8px; }
    .preview-foot { justify-content: stretch; }
    .preview-foot .btn { flex: 1; }
}

/* register numbers are long, so they need a smaller size than an admission ID */
.doc-ref-id-sm { font-size: 11pt; }
.doc-meta-line { margin: 0 0 2px; font-size: 9pt; color: #4A5160; }

/* passport photo on the right of the identity header */
.doc-photo-right { text-align: right; }
.doc-photo-right img { margin-left: auto; }
.doc-photo-row .doc-photo-meta { padding-left: 0; padding-right: 4mm; }
