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

/* ========== प्रिंट स्टाइल (यहीं पर हाइट/चौड़ाई कंट्रोल करें) ========== */

/* 🔧 यहाँ पेज का ओरिएंटेशन बदलें - landscape या portrait */
@page {
    size: A4 landscape;
    /* landscape → चौड़ा, portrait → लंबा */
    margin: 1mm;
}

.print-page {
    font-family: 'Mukta', 'Noto Sans Devanagari', 'Nirmala UI', sans-serif !important;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "liga" on, "clig" on;
    position: relative;
    background: white;
    color: #000;
    width: 100%;
    max-width: 1200px;
    /* 🔧 चौड़ाई घटाने/बढ़ाने के लिए यहाँ बदलें (कम = ज्यादा लंबा दिखेगा) */
    min-height: 700px;
    /* 🔧 पेज की हाइट बढ़ाने/घटाने के लिए यहाँ बदलें */
    margin: 0 auto 20px auto;
    padding: 10px 20px 20px 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    page-break-after: always;
    border-radius: 4px;
}

/* 🔧 टेबल के हर सेल (row) की ऊंचाई यहाँ बदलें */
.print-table td {
    border: 0.5px solid #000;
    padding: 4px 5px;
    text-align: center;
    vertical-align: middle;
    font-size: 11px;
    height: 140px;
    /* 🔧 row की न्यूनतम ऊंचाई (बढ़ाओ तो और लंबी) */
}

/* 🔧 फोटो वाले सेल की हाइट और चौड़ाई यहाँ बदलें */
.photo-cell {
    width: 130px !important;
    /* 🔧 फोटो बॉक्स की चौड़ाई (GP कॉलम के बराबर - portrait फ़ोटो हेतु) */
    height: 140px !important;
    /* 🔧 फोटो बॉक्स की ऊंचाई (बढ़ाओ तो फोटो बड़ी) */
    padding: 0px !important;
    text-align: center;
    vertical-align: middle;
}

/* sr */
.print-table th:nth-child(1),
.print-table td:nth-child(1) {
    width: 70px;
    word-break: break-all;
}

/* block */
.print-table th:nth-child(2),
.print-table td:nth-child(2) {
    width: 130px;
    word-break: break-all;
}

/* gp */
.print-table th:nth-child(3),
.print-table td:nth-child(3) {
    width: 140px;
    word-break: break-all;
}

/* name */
.print-table th:nth-child(4),
.print-table td:nth-child(4) {
    width: 140px;
    word-break: break-all;
}

/* father */
.print-table th:nth-child(5),
.print-table td:nth-child(5) {
    width: 140px;
    word-break: break-all;
}

/* id */
.print-table th:nth-child(6),
.print-table td:nth-child(6) {
    width: 150px;
    word-break: break-all;
}

/* accunt */
.print-table th:nth-child(7),
.print-table td:nth-child(7) {
    width: 140px;
    word-break: break-all;
}

/* gender */
.print-table th:nth-child(8),
.print-table td:nth-child(8) {
    width: 75px;
}

/* status */
.print-table th:nth-child(9),
.print-table td:nth-child(9) {
    width: 85px;
    word-break: break-all;
}

/* photo */
.print-table th:nth-child(10),
.print-table td:nth-child(10) {
    width: 120px !important;
    vertical-align: middle;
}

.print-table {
    font-family: 'Mukta', 'Noto Sans Devanagari', 'Nirmala UI', sans-serif !important;
    text-rendering: optimizeLegibility;
    border-collapse: collapse;
    width: 100%;
}

.print-table td {
    padding-left: 5px !important;
}

.photo-cell img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

/* 🔧 टेबल हेडर की ऊंचाई */
.print-table th {
    border: 1px solid #000;
    padding: 6px 2px;
    /* 🔧 हेडर की ऊंचाई */
    background-color: #f0f0f0;
    font-size: 12px;
    white-space: normal;
    word-wrap: break-word;
}

/* सिग्नेचर सेक्शन - नीचे का स्पेस */
.signature-section {
    margin-top: 20px;
    /* 🔧 ऊपर से दूरी (बढ़ाओ तो सिग्नेचर नीचे जाएगा) */
    border-top: 1px dashed #aaa;
    padding-top: 10px;
}

/* बाकी स्टाइल (कोई बदलाव नहीं) */
:root {
    --indigo-dark: #a5b4fc;
    --indigo-mid: #6366f1;
    --indigo: #818cf8;
    --indigo-light: #c7d2fe;
    --indigo-pale: rgba(99, 102, 241, 0.1);
    --indigo-bg: rgba(15, 23, 42, 0.4);
    --slate-dark: #f1f5f9;
    --slate-muted: #94a3b8;
    --slate-light: rgba(30, 41, 59, 0.4);
    --white: rgba(30, 41, 59, 0.4);
    --success: #10b981;
    --success-dark: #059669;
    --border: rgba(255, 255, 255, 0.05);
    --shadow: rgba(99, 102, 241, 0.05);
}

body {
    font-family: 'Inter', 'Mukta', 'Noto Sans Devanagari', sans-serif;
    background: radial-gradient(circle at top, #1e1b4b 0%, #0f172a 100%);
    min-height: 100vh;
    color: #cbd5e1;
    padding-top: 75px;
    /* space for topbar */
}

/* Topbar styling */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
}

.topbar-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-center {
    flex: 2;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-title {
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
}

.back-btn {
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 16px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.03);
    color: #fff;
}

.topbar-logo-group {
    display: flex;
    flex-direction: column;
}

.topbar-logo-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #818cf8;
    display: flex;
    align-items: center;
    line-height: 1;
}

.topbar-logo-subtitle {
    font-size: 7px;
    font-weight: bold;
    color: #64748b;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.topbar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.user-badge,
.balance-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a5b4fc;
}

.header {
    background: #4f46e5;
    color: white;
    padding: 15px;
    text-align: center;
}

.toolbar {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 15px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.03);
}

button {
    padding: 8px 18px;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tab-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-color: #6366f1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.3);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.content-area {
    padding: 0;
    display: none;
}

.content-area.active {
    display: block;
}

.editor-section {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 30px;
    border-radius: 24px;
    margin-bottom: 25px;
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.05);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12.5px;
    font-weight: 700;
    color: #94a3b8;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #f1f5f9;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', 'Mukta', 'Noto Sans Devanagari', sans-serif;
}

.form-group select option {
    background: #0f172a;
    color: #f1f5f9;
    font-family: 'Mukta', 'Noto Sans Devanagari', sans-serif;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #6366f1;
}

.photo-upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.2);
    padding: 25px;
    text-align: center;
    cursor: pointer;
    border-radius: 14px;
    color: #94a3b8;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
}

.photo-upload-area:hover {
    border-color: #6366f1;
    background: rgba(15, 23, 42, 0.4);
    color: #fff;
}

.photo-preview {
    width: 100%;
    height: 150px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    color: #64748b;
    font-weight: 600;
    font-size: 13px;
}

.photo-preview img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background-color: rgba(15, 23, 42, 0.6);
    color: #f1f5f9;
    font-weight: 700;
}

.data-table td {
    color: #cbd5e1;
}

.stats-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    flex: 1;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.03);
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #818cf8;
    margin-bottom: 4px;
}

.filter-section {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 15px 20px;
    border-radius: 16px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.03);
}

.filter-section input,
.filter-section select {
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 13px;
    outline: none;
    font-family: 'Inter', 'Mukta', 'Noto Sans Devanagari', sans-serif;
}

.filter-section button {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 13px;
    padding: 8px 16px;
}

.filter-section button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.alert {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 600;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Side-by-side Editor Layout & Mobile Responsiveness */
.editor-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.photo-section-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding-left: 25px;
}

.photo-section-wrapper h4 {
    font-size: 13.5px;
    font-weight: 700;
    color: #94a3b8;
}

/* FAQ Section styling */
.faq-section {
    margin-top: 40px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.03);
}

.faq-title {
    font-size: 16px;
    color: #fff;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 15px 0;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-q {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    font-size: 13.5px;
    font-weight: 600;
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    transition: color 0.2s;
}

.faq-q:hover {
    color: #818cf8;
}

.faq-q span {
    font-size: 13px;
    transition: transform 0.2s;
}

.faq-item.open .faq-q span {
    transform: rotate(180deg);
}

.faq-a {
    display: none;
    padding-top: 12px;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

.faq-item.open .faq-a {
    display: block;
}

/* Responsive Mobile Overrides */
@media (max-width: 768px) {
    body {
        padding-top: 155px;
        /* More padding for wrapped header on mobile */
    }

    .topbar-wrapper {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .topbar-left {
        width: 100%;
        justify-content: space-between;
        flex-direction: row;
        gap: 10px;
        order: 1;
    }

    .topbar-center {
        width: 100%;
        margin: 5px 0;
        order: 2;
    }

    .topbar-right {
        width: 100%;
        justify-content: center;
        order: 3;
    }

    .editor-container {
        grid-template-columns: 1fr;
    }

    .photo-section-wrapper {
        border-left: none !important;
        padding-left: 0 !important;
        margin-top: 15px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }

    .filter-section {
        flex-direction: column;
        gap: 10px;
    }

    .toolbar {
        justify-content: center;
    }

    .content-area {
        padding: 10px;
    }

    .container {
        padding: 0 10px;
    }
}

@media print {
    /* Reset body styles for print */
    body {
        background: white !important;
        color: black !important;
        padding-top: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
    }

    /* Hide all elements that are not part of the print layout */
    .topbar,
    .toolbar,
    .header,
    .alert,
    .editor-section,
    .filter-section,
    .faq-section,
    #editor-tab,
    #table-tab,
    .loading-overlay {
        display: none !important;
    }

    /* Force show the print-tab and print-preview-container */
    .container,
    #print-tab,
    .print-preview-container {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Style the print page specifically for printer paper */
    .print-page {
        visibility: visible !important;
        display: block !important;
        margin: 0 !important;
        padding: 2mm 5mm !important; /* Reduced padding to fit more content horizontally */
        width: 100% !important;
        max-width: none !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        page-break-after: always;
        page-break-inside: avoid;
    }

    .print-page * {
        visibility: visible !important;
    }
}

/* ========== Loading Overlay Styles ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    animation: fadeInOverlay 0.3s ease-out;
}

.loading-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: scaleInCard 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    margin: 0 auto 20px auto;
    animation: spin 1s linear infinite;
}

.loading-title {
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Mukta', 'Noto Sans Devanagari', sans-serif;
}

.loading-desc {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.5;
    font-family: 'Mukta', 'Noto Sans Devanagari', sans-serif;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleInCard {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
