/* ==================== GLOBAL RESET (THE FIX) ==================== */
/* Ye line sabse jaruri hai - Isi se Right Side ka Gap hat jayega */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root { --primary: #0056b3; --secondary: #1a1a2e; --bg: #f0f2f5; --white: #ffffff; }

body { 
    background: var(--bg); 
    font-family: 'Segoe UI', sans-serif; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    -webkit-user-select: none; 
    user-select: none;
    overflow-x: hidden; /* Extra safety for mobile */
    width: 100%;
}

a { cursor: pointer; text-decoration: none; } img { pointer-events: none; }
input, textarea, select { -webkit-user-select: text; user-select: text; }

/* LOADING OVERLAY */
#loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); z-index: 10000; display: none; flex-direction: column; justify-content: center; align-items: center; }
.spinner { border: 8px solid #f3f3f3; border-top: 8px solid var(--primary); border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* NAVBAR */
.navbar { 
    background: var(--white); 
    height: 60px; /* Thoda height badhaya taaki mobile me ghut-ghut ke na dikhe */
    padding: 0 5%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    width: 100%;
}
.logo { font-size: 22px; font-weight: 800; color: var(--primary); } .logo span { color: var(--secondary); }
.nav-links { display: flex; gap: 25px; height: 100%; align-items: center; } 
.nav-links a { color: #555; font-weight: 600; font-size: 13px; height: 100%; display: flex; align-items: center; transition: 0.3s; border-bottom: 3px solid transparent; } 
.nav-links a:hover, .nav-links a.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-buttons { display: flex; gap: 10px; }
.btn-nav { padding: 5px 15px; border-radius: 50px; font-weight: bold; cursor: pointer; border: none; font-size: 12px; }
.btn-login { border: 2px solid var(--primary); color: var(--primary); background: transparent; } .btn-signup { background: var(--primary); color: white; }
#user-profile { display: none; align-items: center; gap: 10px; font-size: 13px; }
.btn-logout { background: #333; color: white; padding: 4px 10px; border-radius: 4px; cursor: pointer; border:none; }

/* FOOTER */
footer { 
    background-color: var(--secondary); 
    color: #bdc3c7; 
    padding: 20px 5%; /* Thoda space badhaya */
    margin-top: auto; 
    border-top: 3px solid var(--primary); 
    font-size: 12px; 
    width: 100%;
}
.footer-content { display: flex; justify-content: space-between; gap: 20px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.footer-col h4 { color: white; margin-bottom: 8px; font-size: 14px; border-bottom: 1px solid var(--primary); display: inline-block; }
.footer-col ul { list-style: none; padding: 0; margin: 0; } .footer-col li { margin-bottom: 4px; display: inline-block; margin-right: 15px; } 
.footer-col a { color: #bdc3c7; transition: 0.3s; } .footer-col a:hover { color: white; }
.copyright { text-align: center; margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; }

/* PAGE LAYOUT */
.page-section { display: none; width: 100%; flex: 1; animation: fadeIn 0.4s ease; }
.page-section.active-page { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.selection-wrapper { padding: 50px; text-align: center; display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.choice-card { background: white; width: 250px; padding: 40px; border-radius: 12px; cursor: pointer; box-shadow: 0 5px 20px rgba(0,0,0,0.05); border: 2px solid transparent; transition: 0.3s; }
.choice-card:hover { border-color: var(--primary); transform: translateY(-5px); }
.choice-card i { font-size: 40px; color: var(--primary); margin-bottom: 15px; }

.generator-wrapper { display: flex; flex-direction: row; padding: 20px 5%; gap: 30px; align-items: flex-start; }
.form-area { flex: 1; background: var(--white); padding: 25px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); min-width: 300px; }
.preview-area { flex: 1.3; position: sticky; top: 70px; display: flex; justify-content: center; background: #eef2f7; padding: 20px; border-radius: 10px; border: 1px dashed #ccc; }

.sec-head { font-size: 13px; font-weight: 700; color: var(--primary); margin: 15px 0 10px 0; border-left: 3px solid var(--primary); padding-left: 8px; text-transform: uppercase; }
.ig { margin-bottom: 10px; position: relative; }
.ig label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #444; }
.ig input, .ig select, .ig textarea { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; box-sizing: border-box; }
.ig textarea { resize: none; height: 50px; }

.action-buttons-row { display: flex; gap: 15px; margin-top: 20px; }
.action-btn { flex: 1; padding: 12px; border: none; border-radius: 5px; font-size: 14px; font-weight: bold; cursor: pointer; color: white; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; }
.btn-print { background: #0056b3; } .btn-print:hover { background: #004494; }
.btn-download { background: #e94560; } .btn-download:hover { background: #c0394d; }

.static-wrapper { padding: 40px; text-align: center; background: #eef2f7; min-height: 80vh; }
.static-box { padding: 2cm; background: white; display: inline-block; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.static-img { max-width: 100%; height: auto; display: block; }
.back-btn { padding: 8px 15px; border: 1px solid #ccc; background: white; border-radius: 4px; cursor: pointer; font-weight: bold; display: flex; align-items: center; gap: 5px; }

/* MODALS & INFO */
.paper-bg { background: #eef2f7; min-height: 80vh; padding: 40px; display: flex; justify-content: center; align-items: flex-start; }
.white-paper { background: white; width: 800px; padding: 50px; box-shadow: 0 5px 25px rgba(0,0,0,0.08); border-radius: 2px; min-height: 60vh; }
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal.show { display: flex; }
.modal-content { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(15px); padding: 30px; border-radius: 15px; width: 350px; position: relative; text-align: center; border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); }
.close-modal { position: absolute; top: 10px; right: 15px; font-size: 22px; cursor: pointer; color: #555; }
.auth-card-btn { background: var(--primary); color: white; border: none; padding: 12px; width: 100%; border-radius: 50px; font-size: 16px; font-weight: bold; cursor: pointer; margin-top: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.pass-icon { position: absolute; right: 10px; top: 32px; color: #777; cursor: pointer; font-size: 14px; }

/* ==================== ID CARD ENGINE ==================== */
.page-container, .page-container-print { width: 17.7cm; height: 5.6cm; background: white; display: flex; justify-content: center; align-items: center; border-radius: 2px; overflow: hidden; transform-origin: top center; }
.page-container { box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.page-container-print { box-shadow: none; border: none; }

.id-card-box { width: 8.6cm; height: 5.4cm; border: 1px solid black; border-top: 1px dashed black; position: relative; box-sizing: border-box; background: white; z-index: 1; }
.logo-container { width: 7.894cm; height: 0.892cm; position: absolute; top: 0.1cm; left: 50%; transform: translateX(-50%); display: flex; justify-content: center; align-items: center; } .logo-container img { max-width: 100%; max-height: 100%; }
.gap-filler { width: 3mm; height: 5.4cm; position: relative; } .gap-center-dash { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 0.5px dashed black; transform: translateX(-50%); } .gap-scissors { position: absolute; width: 4.919mm; height: 1.483mm; bottom: 6mm; left: 50%; transform: translateX(-50%) rotate(90deg); z-index: 30; } .scissors-container { position: absolute; width: 4.919mm; height: 1.483mm; right: 3.2mm; top: -0.9mm; z-index: 50; } .sci-img { width: 100%; height: 100%; display: block; } .bottom-image-container { height: 4mm; width: 100%; position: absolute; bottom: 0; left: 0; display: flex; justify-content: center; align-items: center; } .bottom-image-container img { width: 50.52mm; height: 3.106mm; object-fit: contain; } .back-bottom-logo-container { position: absolute; bottom: 0; left: 0; width: 100%; height: 4mm; display: flex; justify-content: center; align-items: center; z-index: 6; } .back-bottom-logo-container img { width: 7.543cm; height: 0.207cm; object-fit: fill; } .address-box { width: 54mm; height: 17.3mm; position: absolute; top: 2.7cm; left: 2.9cm; overflow: hidden; } .address-box img { width: 100%; height: 100%; object-fit: fill; }
.photo-container { width: 1.735cm; height: 2.125cm; position: absolute; top: 1.2cm; left: 0.85cm; overflow: hidden; z-index: 5; background: #f0f0f0; border: 0.5px solid #ccc; display: flex; justify-content: center; align-items: center; text-align: center; } .photo-hint { font-size: 6px; color: #777; font-weight: bold; padding: 2px; } .photo-container img { width: 100%; height: 100%; object-fit: cover; display: none; }
.qr-container { position: absolute; width: 30.5mm; height: 30.5mm; top: 10.7mm; right: 4.3mm; border: 0px solid #ddd; display: flex; justify-content: center; align-items: center; background: white; overflow: hidden; } #qr-placeholder-img, #qr-placeholder-img_print { width: 100%; height: 100%; object-fit: fill; image-rendering: pixelated; }
.details-container { position: absolute; left: 2.835cm; top: 1.35cm; text-align: left; line-height: 1; white-space: nowrap; } .line-1, .line-3 { font-family: sans-serif; font-size: 6pt; color: #000; margin-bottom: 1.2mm; display: block; min-height: 6pt; } .line-2, .line-4 { font-family: 'Bookman Old Style', serif; font-size: 6pt; color: #000; display: block; min-height: 6pt; } .line-2 { font-weight: 300; margin-bottom: 1.2mm; } .dob-value { font-family: 'Calibri', sans-serif; font-size: 7.38pt; font-weight: normal; } .bottom-red-line { width: 100%; height: 1px; background-color: red !important; border-top: 1px solid red; position: absolute; bottom: 4mm; left: 0; z-index: 5; } .id-number-text { font-family: 'Calibri', sans-serif; font-weight: bold; font-size: 12.1pt; color: #000; position: absolute; left: 2.75cm; top: 4.38cm; line-height: 1; z-index: 10; } .vertical-text-container { position: absolute; left: 0.47cm; top: 1.1cm; writing-mode: vertical-rl; transform: rotate(-180deg); white-space: nowrap; z-index: 20; } .v-label { font-family: Arial, sans-serif; font-weight: bold; font-size: 5.1545pt; color: #000; } .v-date { font-family: 'Calibri', sans-serif; font-weight: bold; font-size: 5.1545pt; color: #000; margin-top: 2px; } .back-address-text { position: absolute; left: 3.5mm; top: 10mm; width: 47mm; text-align: left; line-height: 1.1; } .addr-hindi, .addr-english { display: block; margin-bottom: 2mm; min-height: 10pt; color: #000; font-size: 5.5pt; } .addr-hindi { font-family: sans-serif; } .addr-english { font-family: 'Bookman Old Style', serif; } .addr-head { font-weight: bold; } .pincode-style { font-family: 'Calibri', sans-serif; font-weight: normal; font-size: 6.38pt; } .back-vertical-text-container { position: absolute; left: -0.6mm; top: 1.4cm; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; z-index: 20; } .id-number-back { font-family: 'Calibri', sans-serif; font-weight: bold; font-size: 12.1pt; color: #000; position: absolute; top: 41.7mm; width: 100%; text-align: center; left: 0; line-height: 1; z-index: 10; } .grey-dashed-line { width: 43mm; height: 0.5px; border-top: 1px dashed grey; position: absolute; bottom: 6.7mm; left: 50%; transform: translateX(-50%); z-index: 5; } .vip-text { font-family: 'Calibri', sans-serif; font-weight: bold; font-size: 7.8pt; color: #000; position: absolute; left: 29mm; bottom: 4.5mm; line-height: 1; z-index: 10; white-space: nowrap; }

/* HIDDEN A4 CONTAINER */
#hidden-print-container { position: absolute; top: 0; left: -9999px; width: 210mm; min-height: 297mm; padding-top: 50mm; background: white; display: flex; justify-content: center; align-items: flex-start; z-index: -1; }

/* PRINT SETTINGS */
.btn-download { display: flex; } /* Show in normal mode */
@media print {
    @page { size: A4; margin: 0; }
    body > *:not(#hidden-print-container) { display: none !important; }
    #hidden-print-container { display: flex !important; visibility: visible !important; position: absolute; top: 0; left: 0; margin: 0; padding-top: 50mm; width: 100%; height: 100%; justify-content: center; background: white; z-index: 9999; }
    #hidden-print-container * { visibility: visible !important; }
    .id-card-box { isolation: isolate !important; border: 1px solid black !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; background: white !important; }
    .details-container, .id-number-text, .vertical-text-container, .back-address-text, .back-vertical-text-container, .id-number-back, .vip-text { position: absolute !important; z-index: 9999 !important; transform: translateZ(0.1px) !important; text-rendering: geometricPrecision !important; -webkit-font-smoothing: antialiased !important; text-shadow: none !important; }
    .logo-container, .photo-container, .bottom-image-container, .address-box { z-index: 1 !important; }
    #pdf-controls { display: none !important; }
    .show-on-screen { background: white !important; top: 0 !important; }
}

/* PDF PREVIEW STYLES */
#pdf-controls { position: fixed; top: 0; left: 0; width: 100%; height: 60px; background: #333; display: flex; justify-content: space-between; align-items: center; padding: 0 5%; box-sizing: border-box; z-index: 20000; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.msg-text { color: white; font-weight: bold; font-family: sans-serif; }
.ctrl-btn { padding: 10px 20px; border: none; border-radius: 5px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.back-red { background: #e74c3c; color: white; }
.save-green { background: #2ecc71; color: white; }
.show-on-screen { left: 0 !important; top: 60px !important; position: absolute !important; z-index: 10000 !important; visibility: visible !important; height: auto !important; min-height: 100vh; padding-bottom: 50px; background: #555 !important; overflow-y: auto; }

/* ==================== MOBILE RESPONSIVE FIXES ==================== */
@media (max-width: 900px) {
    /* 1. Navbar Mobile Fix */
    .navbar { 
        padding: 0 15px; /* Kam padding taaki cut na ho */
        width: 100%;
        overflow-x: hidden;
    }
    .nav-links { gap: 10px; } /* Links ke beech kam gap */
    .nav-links a { font-size: 12px; }
    .logo { font-size: 18px; } /* Logo thoda chhota */

    /* 2. Content Stack */
    .generator-wrapper { flex-direction: column; }
    .preview-area { width: 100%; top: 0; order: 1; /* Preview upar */ margin-bottom: 20px; }
    .form-area { width: 100%; order: 2; /* Form neeche */ min-width: auto; }
    
    /* 3. Card Size Mobile */
    .page-container { transform: scale(0.45); margin: -110px 0; }

    /* 4. Footer Mobile Fix */
    footer { 
        padding: 20px 15px; 
        text-align: center; 
    }
    .footer-content { 
        flex-direction: column; 
        gap: 20px; 
    }
    .footer-col li { 
        display: block; 
        margin: 5px 0; 
    }
    .action-buttons-row { flex-direction: column; }
}
/* GOOGLE LOGIN BUTTON STYLE */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    background: white;
    color: #555;
    font-weight: bold;
    font-size: 14px;
    border-radius: 50px; /* Gol Button */
    cursor: pointer;
    transition: 0.3s;
    margin-top: 5px;
}

.btn-google:hover {
    background: #f1f1f1;
    border-color: #bbb;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

