/* ===========================================
   NITSO Membership Form - Stylesheet
   =========================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Mangal', Tahoma, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #f1f5f9 100%);
    color: #1e293b;
    line-height: 1.5;
    padding: 24px 10px;
    min-height: 100vh;
}

/* ===========================================
   FORM CONTAINER
   =========================================== */
.form-container {
    max-width: 980px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.15);
    overflow: hidden;
    border: 1px solid #cbd5e1;
}

/* ===========================================
   HEADER
   =========================================== */
.form-header {
    background: linear-gradient(135deg, #003e7e 0%, #0066b3 100%);
    color: #ffffff;
    padding: 22px 28px 0;
}

.header-top {
    display: flex;
    gap: 20px;
    align-items: center;
    padding-bottom: 16px;
}

.logo-box {
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-weight: bold;
    color: #0066b3;
    font-size: 14px;
}

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

.header-text { flex: 1; }

.org-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.org-hindi {
    font-size: 17px;
    font-weight: 600;
    color: #fef3c7;
    margin-bottom: 8px;
}

.approved {
    font-size: 11px;
    color: #cbd5e1;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.address {
    font-size: 11.5px;
    color: #e2e8f0;
    line-height: 1.4;
}

.form-title-bar {
    background: rgba(255,255,255,0.12);
    text-align: center;
    padding: 10px;
    margin: 0 -28px;
    border-top: 2px solid rgba(255,255,255,0.2);
}

.form-title-bar h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff7ed;
}

/* ===========================================
   GREETING
   =========================================== */
.greeting-section {
    padding: 18px 28px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.greeting-section p {
    font-size: 13.5px;
    margin-bottom: 6px;
    color: #334155;
}

.greeting-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.greeting-row label {
    font-size: 13px;
    color: #334155;
}

.greeting-row input {
    flex: 1;
    min-width: 130px;
    padding: 6px 10px;
    border: 1px solid #94a3b8;
    border-radius: 5px;
    font-size: 13px;
}

/* ===========================================
   SECTIONS
   =========================================== */
.section {
    padding: 18px 28px;
    border-bottom: 1px solid #e2e8f0;
}

.section-title {
    background: linear-gradient(90deg, #0066b3 0%, #0284c7 100%);
    color: #ffffff;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 5px;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(2, 6, 23, 0.08);
}

.section-title.centered { text-align: center; }

/* ===========================================
   FORM GRID & ROWS
   =========================================== */
.form-grid { display: flex; flex-direction: column; gap: 14px; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

.form-row.double > .field-group { flex: 1; min-width: 220px; }

.form-row.triple > .field-group { flex: 1; min-width: 180px; }

.form-row.triple > .field-group.flex2 { flex: 2; }

.form-row.triple > .field-group.small { flex: 0 0 100px; min-width: 90px; }

.field-group { display: flex; flex-direction: column; }

.lbl {
    font-size: 12.5px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 4px;
}

.lbl-sm { font-size: 12px; font-weight: 600; color: #1e3a8a; }

.hindi-label {
    font-weight: 500;
    color: #475569;
    font-size: 12px;
}

/* Inputs */
.form-row input[type="text"],
.form-row input[type="tel"],
.form-row input[type="email"],
.form-row input[type="date"],
.form-row input[type="number"],
.form-row select,
.greeting-row input,
.boxed-inputs input,
.field-group input,
.field-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #94a3b8;
    border-radius: 5px;
    font-size: 13.5px;
    background: #ffffff;
    transition: all 0.2s ease;
    color: #0f172a;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0066b3;
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.15);
}

input::placeholder { color: #94a3b8; font-style: italic; }

/* Boxed inputs (for name fields) */
.boxed-inputs { flex: 1; min-width: 250px; }
.boxed-inputs.full { width: 100%; }

/* Form-row label as first child */
.form-row > .lbl {
    flex: 0 0 220px;
    min-width: 180px;
    margin-bottom: 0;
    line-height: 1.3;
}

/* Gender Box */
.gender-box {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 6px 10px;
    background: #eff6ff;
    border-radius: 5px;
    border: 1px dashed #93c5fd;
}

.radio-lbl {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
}

.radio-lbl input { accent-color: #0066b3; }

/* ===========================================
   DOCUMENTS LIST
   =========================================== */
.documents-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 12.5px;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.doc-item:hover { background: #e0f2fe; border-color: #0284c7; }

.doc-item input { accent-color: #0066b3; cursor: pointer; }

.file-upload {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px;
    background: #fef3c7;
    border: 1px dashed #f59e0b;
    border-radius: 5px;
    flex-wrap: wrap;
}

.file-upload input[type="file"] {
    flex: 1;
    min-width: 200px;
    padding: 4px;
}

/* ===========================================
   DECLARATION
   =========================================== */
.declaration-section { background: #fffbeb; }

.declaration-content {
    background: #ffffff;
    padding: 14px 18px;
    border-radius: 6px;
    border: 1px solid #fde68a;
}

.declaration-content p {
    font-size: 13.5px;
    color: #1e3a8a;
    margin-bottom: 6px;
}

.declaration-content ul {
    list-style: disc;
    margin-left: 24px;
}

.declaration-content ul li {
    font-size: 12.5px;
    color: #334155;
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ===========================================
   SIGNATURE
   =========================================== */
.signature-section { background: #f0fdf4; }

.signature-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-top: 6px;
}

.sig-block { flex: 1; min-width: 200px; }

.sig-block label {
    font-size: 12.5px;
    font-weight: 600;
    color: #166534;
    display: block;
    margin-bottom: 4px;
}

.sig-block input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #94a3b8;
    border-radius: 5px;
    font-size: 13px;
}

.sig-pad { min-width: 220px; }

.sig-line {
    height: 50px;
    border-bottom: 2px dashed #64748b;
    margin-bottom: 4px;
}

.sig-label {
    text-align: center;
    font-size: 11.5px;
    color: #475569;
    font-style: italic;
    line-height: 1.3;
}

.signature-row-fields {
    align-items: flex-end;
}

.signature-row-fields .sig-block {
    flex: 1;
    min-width: 160px;
}

.sig-block-title {
    display: flex;
    align-items: flex-end;
}

.sig-block-title .sig-pad-title {
    margin-bottom: 8px;
}

.signature-pad-row {
    margin-top: 12px;
}

.signature-split {
    display: flex;
    gap: 16px;
    align-items: stretch;
    flex-wrap: wrap;
}

.signature-draw-col {
    flex: 1;
    min-width: 260px;
}

.signature-photo-col {
    flex: 0 0 200px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

#memberCameraInput {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.photo-upload-box {
    border: 2px dashed #86efac;
    border-radius: 8px;
    background: #f0fdf4;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    height: 180px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.photo-upload-box:hover {
    background: #dcfce7;
    border-color: #16a34a;
}

.photo-upload-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 8px;
}

.photo-upload-text {
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    margin: 0;
}

.member-photo-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.member-photo-preview-wrap img {
    display: block;
    width: 40px;
    height: 40px;
    border: 2px solid #86efac;
    border-radius: 4px;
    object-fit: cover;
    background: #f8fafc;
}

.btn-retake-photo {
    padding: 4px 8px;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
}

.btn-retake-photo:hover {
    background: #e2e8f0;
}

.signature-draw-col .btn-sig-action {
    margin-top: 8px;
    width: 100%;
}

.sig-pad-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #166534;
    display: block;
    margin-bottom: 8px;
}

.sig-pad-title .req {
    color: #dc2626;
}

.member-signature-box {
    background: #fff;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
}

.sig-hidden {
    display: none !important;
}

.signature-canvas-wrap {
    position: relative;
    border: 2px dashed #64748b;
    border-radius: 6px;
    background: #fff;
    height: 180px;
    min-height: 180px;
    touch-action: none;
    -ms-touch-action: none;
    cursor: crosshair;
    overflow: hidden;
}

#memberSignatureCanvas {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    -ms-touch-action: none;
    cursor: crosshair;
}

.sig-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.btn-sig-action {
    padding: 8px 12px;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    background: #f1f5f9;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
}

.btn-sig-primary {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 20px;
}

#memberSignatureError.is-visible {
    display: block;
    margin-top: 8px;
}

/* ===========================================
   RECEIPT
   =========================================== */
.receipt-section {
    padding: 20px 28px;
    background: #ecfeff;
    border-top: 3px dashed #0891b2;
}

.receipt-body p {
    font-size: 13px;
    line-height: 2.2;
    color: #0f172a;
    margin-bottom: 10px;
}

.hindi-line { color: #1e293b; }

.inline-input {
    display: inline-block;
    width: 200px;
    padding: 3px 6px;
    border: none;
    border-bottom: 1.5px solid #0891b2;
    background: transparent;
    font-size: 13px;
    margin: 0 4px;
}

.inline-input.short { width: 100px; }

.inline-input:focus {
    outline: none;
    background: #fff;
    border-bottom-color: #0066b3;
}

.receipt-footer {
    display: flex;
    gap: 18px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ===========================================
   FORM ALERT
   =========================================== */
.form-alert {
    display: none;
    margin: 0 22px 16px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    line-height: 1.45;
}

.form-alert.is-visible {
    display: block;
}

.form-alert--error {
    background: #dc2626;
    border: 1px solid #b91c1c;
    color: #ffffff;
    text-align: center;
    font-weight: 600;
}

.form-alert--info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
}

/* ===========================================
   ACTIONS
   =========================================== */
.actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    padding: 22px;
    background: #f1f5f9;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-print { background: #6366f1; color: #fff; }
.btn-print:hover { background: #4f46e5; transform: translateY(-1px); }

.btn-reset { background: #94a3b8; color: #fff; }
.btn-reset:hover { background: #64748b; transform: translateY(-1px); }

.btn-submit { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); color: #fff; }
.btn-submit:hover { background: linear-gradient(135deg, #15803d 0%, #14532d 100%); transform: translateY(-1px); }

/* ===========================================
   FOOTER
   =========================================== */
.form-footer {
    background: #0f172a;
    color: #cbd5e1;
    text-align: center;
    padding: 12px;
    font-size: 11.5px;
    letter-spacing: 0.3px;
}

/* ===========================================
   VALIDATION
   =========================================== */
.field-error {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    color: #b91c1c;
    line-height: 1.35;
}

input.input-error,
select.input-error,
textarea.input-error {
    border-color: #dc2626;
    background: #fef2f2;
}

input.input-error:focus,
select.input-error:focus,
textarea.input-error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.documents-list .field-error,
.gender-box .field-error {
    flex: 1 1 100%;
    width: 100%;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 720px) {
    body { padding: 10px 4px; }
    .form-container { border-radius: 8px; }
    .form-header { padding: 16px 14px 0; }
    .header-top { flex-direction: column; text-align: center; gap: 10px; }
    .org-name { font-size: 17px; }
    .org-hindi { font-size: 14px; }
    .form-title-bar { margin: 0 -14px; }
    .form-title-bar h2 { font-size: 15px; }
    .section, .greeting-section, .receipt-section { padding: 14px 14px; }

    .form-row { flex-direction: column; align-items: stretch; }
    .form-row > .lbl { flex: 1 1 100%; min-width: 0; }
    .form-row.double > .field-group,
    .form-row.triple > .field-group { min-width: 0; flex: 1 1 100%; }
    .form-row.triple > .field-group.small { flex: 1 1 100%; }

    .boxed-inputs { min-width: 0; width: 100%; }
    .gender-box { width: 100%; }

    .greeting-row { flex-direction: column; align-items: stretch; }
    .greeting-row input { min-width: 0; width: 100%; }

    .documents-list { grid-template-columns: 1fr; }

    .file-upload { flex-direction: column; align-items: stretch; }
    .file-upload input[type="file"] { min-width: 0; width: 100%; }

    .signature-row { flex-direction: column; align-items: stretch; }
    .sig-block,
    .sig-pad { min-width: 0; width: 100%; }

    .signature-split {
        flex-direction: column;
    }

    .signature-photo-col {
        flex: 1 1 100%;
        min-width: 0;
    }

    .photo-upload-box {
        min-height: 100px;
    }

    .signature-row-fields .sig-block {
        min-width: 0;
        flex: 1 1 100%;
    }

    .sig-mode-btn { min-width: 0; }

    .inline-input { width: 100% !important; display: block; margin: 4px 0; }
    .receipt-body p { line-height: 1.7; }

    .actions { flex-direction: column; }
    .btn { width: 100%; }
}

/* ===========================================
   PRINT
   =========================================== */
@media print {
    body { background: #fff; padding: 0; }
    .form-container { box-shadow: none; border-radius: 0; border: none; max-width: 100%; }
    .actions, .form-footer { display: none; }
    .section, .greeting-section, .receipt-section { page-break-inside: avoid; padding: 10px 18px; }
    .form-header { background: #003e7e !important; -webkit-print-color-adjust: exact; color-adjust: exact; }
    .section-title { background: #0066b3 !important; -webkit-print-color-adjust: exact; color-adjust: exact; }
    input, select { border-color: #475569 !important; }
}
