/* aadhaar.css - Pixel Perfect Grid Rewrite */

@import url('https://fonts.googleapis.com/css2?family=Arya:wght@400;700&family=Open+Sans:wght@400;600;700&display=swap');

/* Reset and variables */
:root {
    --orange: #f58220;
    --green: #1B8635;
    --red: #CC0000;
    --dark: #333333;
    --divider: #e5e5e5;
}

#a4-letter {
    width: 210mm;
    height: 297mm;
    background: #ffffff;
    box-sizing: border-box;
    font-family: Arial, 'Mangal', sans-serif;
    color: var(--dark);
    position: relative;
    padding: 10mm;
    display: flex;
    flex-direction: column;
}

/* Base Top Form Padding & Borders */
.a4-main-border {
    border: 2px solid #000;
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Rows & Quadrants */
.a4-row {
    flex: 1;
    display: flex;
    position: relative;
}

.a4-row.top-row {
    flex: 1;
    border-bottom: 1px dashed #666;
}

.a4-row.bottom-row {
    height: 80mm;
    flex: none;
    border-top: 1px dashed #666;
}

.a4-quad {
    width: 50%;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.top-left {
    border-right: 1px dashed #666;
}

.card-front {
    border-right: 1px dashed #666;
}

.scissors-line {
    height: 15mm;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.scissors-line::before {
    content: '';
    position: absolute;
    left: 20px;
    right: 20px;
    top: 50%;
    border-top: 1px dashed #333;
}

.scissor-icon {
    background: #fff;
    padding: 0 5px;
    z-index: 2;
    font-size: 16px;
    color: #000;
}

/* --- Common Headers --- */
.q-header-full {
    width: 100%;
}

/* Legacy Orange/Green Band Headers for the Top Cards */
.h-band-orange {
    background-color: var(--orange);
    color: #fff;
    text-align: center;
    padding: 6px 0 4px 0;
    line-height: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.h-band-green {
    background-color: var(--green);
    color: #fff;
    text-align: center;
    padding: 6px 0 4px 0;
    line-height: 1.1;
}

/* White Band Header with Tricolor Brush (Left cards) */
.h-band-white {
    background-color: #fff;
    color: var(--dark);
    text-align: center;
    padding: 6px 0 4px 0;
    line-height: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tricolor-brush {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(245, 130, 32, 0.5) 15%, rgba(245, 130, 32, 0.5) 45%,
            transparent 45%, transparent 55%,
            rgba(27, 134, 53, 0.5) 55%, rgba(27, 134, 53, 0.5) 85%,
            transparent 100%);
    z-index: 1;
    border-radius: 50%;
}

/* Green Stripe Header with background brush (Right cards) */
.h-band-green-bg {
    background-color: #fff;
    color: var(--dark);
    text-align: center;
    padding: 6px 0 4px 0;
    line-height: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.green-brush {
    position: absolute;
    top: 30%;
    left: 15%;
    width: 70%;
    height: 40%;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(27, 134, 53, 0.4) 15%, rgba(27, 134, 53, 0.4) 85%,
            transparent 100%);
    z-index: 1;
    border-radius: 50%;
}

.h-hi {
    font-size: 18px;
    font-weight: bold;
    font-family: 'Arya', 'Mangal', sans-serif;
    z-index: 2;
    position: relative;
}

.h-en {
    font-size: 14px;
    font-weight: 600;
    z-index: 2;
    position: relative;
}

.h-logos-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}

/* Specific logic for TOP LEFT card to mimic text wrap and gap */
.top-left .h-band-orange,
.top-left .h-band-green {
    align-items: center;
    padding: 4px 0 2px 0;
}

.top-left .h-hi,
.top-left .h-en {
    width: 60%;
    line-height: 1.1;
}

.top-left .h-hi {
    font-size: 14px;
    margin-bottom: -1px;
}

.top-left .h-en {
    font-size: 11px;
}

/* Specific logic for front card to mimic small text wrap */
.card-front .h-band-white,
.card-front .h-band-green-bg {
    align-items: center;
}

.card-front .h-hi,
.card-front .h-en {
    width: 65%;
    /* Forces text to wrap if it gets too long, matching the margins of original */
    line-height: 1.2;
}

.card-front .h-hi {
    font-size: 16px;
    margin-bottom: -2px;
}

.card-front .h-en {
    font-size: 12px;
}

.h-logo {
    height: 45px;
    background: transparent;
    padding: 2px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    z-index: 2;
    position: relative;
}

/* Original trick: Top row logos literally have a white box to hide the bands behind them */
.top-row .h-logo {
    background: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    height: 50px;
}

.h-logo img {
    height: 35px;
    object-fit: contain;
}

.h-logo.emblem {
    top: -10px;
    position: relative;
}

.h-logo.emblem img {
    height: 25px;
}

.h-logo.emblem div {
    font-size: 6px;
    font-weight: bold;
    color: #000;
    line-height: 1;
    text-align: center;
    margin-top: 2px;
}

/* Line Header (Top Right) */
.h-line-header {
    width: 100%;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-top: 3px solid var(--red);
}

.swoosh-line {
    position: absolute;
    left: 20%;
    top: 25px;
    width: 60%;
    height: 12px;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            var(--orange) 20%,
            var(--orange) 45%,
            rgba(255, 255, 255, 0) 50%,
            var(--green) 55%,
            var(--green) 80%,
            rgba(255, 255, 255, 0) 100%);
    opacity: 0.5;
    border-radius: 50%;
}

.centered-text-line {
    position: absolute;
    width: 100%;
    top: 20px;
    text-align: center;
}

.centered-text-line .h-hi {
    font-size: 14px;
    color: #000;
}

.centered-text-line .h-en {
    font-size: 11px;
    color: #000;
}

.h-line-header .h-logo {
    box-shadow: none;
    background: transparent;
}

/* === TOP LEFT SECTIONS === */
.tl-content {
    padding: 15px 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tl-enrolment {
    font-size: 13px;
    font-weight: bold;
    color: #444;
    margin-bottom: 10px;
}

.tl-address {
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
}

.tl-qr-sig {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.tl-sig {
    font-size: 6px;
    line-height: 1;
    position: relative;
}

.tl-sig-mark {
    position: absolute;
    font-size: 40px;
    color: rgba(255, 215, 0, 0.4);
    top: -20px;
    left: 15px;
    z-index: 0;
}

.tl-large-qr {
    width: 160px;
    height: 160px;
}

.tl-footer {
    text-align: center;
    padding-bottom: 10px;
}

.c-red {
    color: var(--red);
}

.tl-footer-title {
    font-size: 12px;
    font-weight: bold;
}

.tl-footer-num {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    line-height: 1;
    margin: 4px 0;
}

.tl-footer-vid {
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tl-footer-tagline {
    font-size: 15px;
    font-weight: bold;
    font-family: 'Arya', sans-serif;
    margin-top: 5px;
}


/* === TOP RIGHT SECTIONS === */
.tr-content {
    padding: 10px 15px;
    flex-grow: 1;
}

.tr-title {
    text-align: center;
    color: var(--red);
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
}

.tr-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tr-bullets li {
    font-size: 9px;
    line-height: 1.3;
    margin-bottom: 6px;
    padding-left: 12px;
    position: relative;
    text-align: justify;
    font-weight: 600;
}

.tr-bullets li::before {
    content: '■';
    color: var(--red);
    position: absolute;
    left: 0;
    top: -1px;
    font-size: 9px;
}

.tr-bullets li span.c-red {
    font-weight: bold;
}


/* === BOTTOM LEFT FRONT CARD === */
.cl-content {
    flex-grow: 1;
    position: relative;
}

.cl-photo-box {
    position: absolute;
    top: 5px;
    left: 15px;
    width: 100px;
    height: 125px;
    border: 1px solid #ccc;
}

.cl-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cl-details {
    position: absolute;
    top: 3px;
    left: 125px;
    right: 15px;
}

.cl-name-hi {
    font-size: 13px;
    font-weight: bold;
    font-family: 'Arya', sans-serif;
}

.cl-name-en {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
}

.cl-dob-gender {
    font-size: 10px;
    font-weight: bold;
    line-height: 1.3;
}

.cl-red-box {
    margin-top: 5px;
    border: 1px solid var(--red);
    padding: 2px;
    font-size: 7px;
    line-height: 1.1;
    text-align: justify;
}

.cl-footer {
    position: absolute;
    bottom: 2px;
    width: 100%;
    text-align: center;
}

.cl-num {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 4px;
}

.cl-tag {
    font-size: 14px;
    font-weight: bold;
    position: relative;
    display: inline-block;
    padding: 0 10px;
    border-top: 1px solid var(--red);
    margin-top: 6px;
    padding-top: 4px;
}

.cl-issue-date {
    position: absolute;
    left: -42px;
    top: 100px;
    transform: rotate(-90deg);
    font-size: 8px;
    font-weight: bold;
}

/* === BOTTOM RIGHT BACK CARD === */
.cr-content {
    flex-grow: 1;
    position: relative;
    padding: 10px 15px;
}

.cr-addr-split {
    display: flex;
    justify-content: space-between;
}

.cr-addr-block {
    width: 60%;
    font-size: 8px;
    line-height: 1.1;
    font-weight: 600;
}

.cr-qr-block {
    width: 38%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    min-width: 80px;
    min-height: 80px;
}

.cr-qr-large {
    width: 80px;
    height: 80px;
    margin-bottom: 2px;
    display: block;
    position: relative;
    z-index: 10;
}

.cr-download-date {
    position: absolute;
    left: -32px;
    top: 100px;
    transform: rotate(-90deg);
    font-size: 8px;
    font-weight: bold;
}

.cr-footer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    border-top: 2px solid var(--red);
    display: flex;
    justify-content: space-between;
    padding: 5px 15px;
    font-size: 9px;
    font-weight: bold;
}

/* Print Handling */
@media print {
    body * {
        visibility: hidden;
    }

    #a4-letter,
    #a4-letter * {
        visibility: visible;
    }

    #a4-letter {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        padding: 5mm;
        width: 210mm;
        height: 297mm;
        transform: none !important;
    }
}

@media (max-width: 1024px) {
    #a4-letter:not(.no-scale) {
        transform: scale(0.6);
        transform-origin: top left;
        margin-bottom: -400px;
    }
}

.no-scale {
    transform: none !important;
}