/* ========================================
   स्वप्रमाणित घोषणा पत्र - Paper Style
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Devanagari', sans-serif;
    background: #e8e4df;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 30px 15px;
}

/* ========== PAGE ========== */
.page {
    background: #fff;
    width: 210mm;
    max-width: 100%;
    min-height: auto;
    padding: 30px 40px;
    border: 2px solid #222;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Decorative border */
.page::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid #999;
    pointer-events: none;
}

/* ========== TOP ROW ========== */
.top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 10px;
    gap: 20px;
    flex-wrap: wrap;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Aadhar Boxes */
.aadhar-boxes {
    display: flex;
    align-items: center;
    gap: 3px;
}

.aadhar-box {
    width: 26px;
    height: 30px;
    border: 1.5px solid #333;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', monospace;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.aadhar-box:focus {
    border-color: #0066cc;
    background: #f0f7ff;
}

.aadhar-sep {
    width: 6px;
    height: 2px;
    background: #333;
    display: inline-block;
    margin: 0 1px;
}

/* ========== TITLE ========== */
.title-block {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 8px;
    border-bottom: 2px solid #222;
}

.title-block h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: #111;
    text-decoration: underline;
    text-underline-offset: 4px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.title-block h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #222;
    letter-spacing: 0.5px;
}

/* ========== FORM BODY ========== */
.form-body {
    line-height: 2.4;
}

/* ========== FORM LINES ========== */
.form-line {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
    min-height: 40px;
}

.label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dotted Input */
.dotted-input {
    border: none;
    border-bottom: 1.5px dotted #555;
    outline: none;
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    color: #1a1a8e;
    background: transparent;
    padding: 0 4px 2px;
    min-width: 60px;
    transition: border-color 0.2s, background 0.2s;
}

.dotted-input:focus {
    border-bottom-color: #0066cc;
    border-bottom-style: solid;
    background: #f8faff;
}

.dotted-input::placeholder {
    color: #bbb;
    font-weight: 400;
}

/* Flex sizing */
.flex-1 {
    flex: 1;
    min-width: 80px;
}

.flex-2 {
    flex: 2;
    min-width: 120px;
}

.flex-3 {
    flex: 3;
    min-width: 160px;
}

.wide {
    flex: 1;
}

/* ========== DECLARATION ========== */
.declaration-start {
    font-size: 0.92rem;
    font-weight: 500;
    color: #111;
    flex: 3;
    line-height: 1.8;
}

.declaration-text {
    margin: 4px 0 24px 0;
    line-height: 2;
}

.declaration-text p {
    font-size: 0.92rem;
    font-weight: 500;
    color: #111;
    text-align: justify;
    text-justify: inter-word;
}

/* ========== BOTTOM SECTION ========== */
.bottom-section {
    margin-top: 20px;
    border-top: 1px solid #ccc;
    padding-top: 16px;
}

.bottom-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.bottom-left,
.bottom-mid,
.bottom-right-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bottom-left {
    flex: 1;
}

.bottom-mid {
    flex: 1;
}

.bottom-right-text {
    flex: 1;
}

.bottom-left .dotted-input,
.bottom-mid .dotted-input,
.bottom-right-text .dotted-input {
    flex: 1;
    min-width: 80px;
}

.bottom-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.bottom-right .label {
    font-size: 0.85rem;
}

/* ========== SIGNATURE ========== */
.signature-area {
    position: relative;
    border: 1.5px dashed #999;
    border-radius: 4px;
    background: #fefefe;
    cursor: crosshair;
}

#signaturePad {
    display: block;
    touch-action: none;
}

.clear-sig {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(200, 200, 200, 0.6);
    color: #666;
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.clear-sig:hover {
    background: #e74c3c;
    color: #fff;
}

/* Signature Wrapper */
.signature-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Signature Upload */
.sig-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Noto Sans Devanagari', sans-serif;
    background: #f0f2f5;
    border: 1.5px solid #999;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.upload-btn:hover {
    background: #1a365d;
    color: #fff;
    border-color: #1a365d;
}

.sig-or {
    font-size: 0.72rem;
    color: #999;
    font-style: italic;
}

/* Signature Preview */
.signature-preview {
    position: relative;
    border: 1.5px dashed #999;
    border-radius: 4px;
    background: #fefefe;
    width: 250px;
    height: 80px;
    overflow: hidden;
}

.signature-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

/* ========== ACTION BAR ========== */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px dashed #ccc;
}

.btn {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid #333;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Noto Sans Devanagari', sans-serif;
    transition: all 0.2s;
    background: #fff;
    color: #333;
}

.btn:hover {
    background: #333;
    color: #fff;
}

.btn-print {
    background: #1a365d;
    color: #fff;
    border-color: #1a365d;
}

.btn-print:hover {
    background: #0f2440;
}

.btn-download {
    background: #27ae60;
    color: #fff;
    border-color: #27ae60;
}

.btn-download:hover {
    background: #1e8449;
}

/* ========== PRINT STYLES ========== */
.no-print {
    /* visible normally */
}

@media print {
    body {
        background: #fff;
        padding: 0;
    }

    .page {
        border: 2px solid #000;
        box-shadow: none;
        width: 100%;
        padding: 25px 35px;
        margin: 0;
    }

    .no-print {
        display: none !important;
    }

    .dotted-input {
        color: #000;
        border-bottom-color: #333;
    }

    .aadhar-box {
        border-color: #000;
    }

    .clear-sig {
        display: none;
    }

    .signature-area {
        border-style: dashed;
        border-color: #666;
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 700px) {
    body {
        padding: 10px 5px;
    }

    .page {
        padding: 18px 16px;
    }

    .page::before {
        top: 4px;
        left: 4px;
        right: 4px;
        bottom: 4px;
    }

    .top-row {
        flex-direction: column;
        gap: 10px;
    }

    .title-block h1 {
        font-size: 1.3rem;
    }

    .title-block h2 {
        font-size: 0.95rem;
    }

    .form-line {
        flex-wrap: wrap;
        gap: 2px 4px;
    }

    .dotted-input {
        min-width: 60px;
    }

    .flex-1,
    .flex-2,
    .flex-3 {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .bottom-row {
        flex-direction: column;
        gap: 10px;
    }

    .bottom-right {
        align-items: flex-start;
    }

    .aadhar-box {
        width: 22px;
        height: 26px;
        font-size: 12px;
    }
}