/* ============================================
   KISHAN BHANU UNION ID CARD TOOL
   Complete CSS — Fixed 2026×1276 card layout
   All card element positions in absolute pixels
   ============================================ */

/* === FONT FACES === */
@font-face {
    font-family: 'Noto Sans';
    src: url('https://oneclickpvccard.com/ashim/Kishan_bhanu/font/NotoSans-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Yatra One';
    src: url('https://oneclickpvccard.com/ashim/Kishan_bhanu/font/YatraOne-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    min-height: 100vh;
    color: #e2e8f0;
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 24px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    backdrop-filter: blur(12px);
    max-width: 380px;
}

.toast.success {
    background: linear-gradient(135deg, #059669, #10b981);
    border-left: 4px solid #34d399;
}

.toast.error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-left: 4px solid #f87171;
}

.toast.info {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-left: 4px solid #60a5fa;
}

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px) scale(0.8); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(100px) scale(0.8); }
}

/* === LOADING OVERLAY === */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#loading-overlay.active {
    display: flex;
}

#loading-overlay p {
    color: #94a3b8;
    font-size: 16px;
    font-weight: 500;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === NAVBAR === */
.navbar {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    padding: 16px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s;
}

.navbar-brand:hover {
    color: #38bdf8;
}

.brand-icon {
    font-size: 1.6rem;
}

/* === MAIN CONTENT === */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    text-align: center;
    margin-bottom: 36px;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: #94a3b8;
    font-size: 1rem;
}

/* === APP LAYOUT === */
.app-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 32px;
    align-items: start;
}

/* === PANEL CARDS === */
.panel-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.panel-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    font-size: 1.3rem;
}

/* === FORM STYLES === */
#card-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

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

.form-group input[type="text"],
.form-group input[type="date"] {
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: 'Noto Sans', sans-serif;
    transition: all 0.25s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.form-group input::placeholder {
    color: #475569;
}

/* File upload */
.file-upload-wrapper {
    position: relative;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 2px dashed rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.file-upload-wrapper:hover .file-upload-label {
    border-color: #3b82f6;
    color: #94a3b8;
}

.file-upload-label.has-file {
    border-color: #10b981;
    color: #34d399;
    border-style: solid;
}

.upload-icon {
    font-size: 1.2rem;
}

/* === BUTTONS === */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.97);
}

.btn-save {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-save:hover {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-download {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-download:hover {
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-load {
    background: rgba(30, 41, 59, 0.8);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 10px 18px;
    flex-shrink: 0;
}

.btn-load:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #e2e8f0;
}

.btn-icon {
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* === LOAD SECTION === */
.load-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.load-controls {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

#name-selector {
    flex: 1;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 14px;
    font-family: 'Noto Sans', sans-serif;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

#name-selector:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#name-selector option {
    background: #1e293b;
    color: #e2e8f0;
}

/* === PREVIEW PANEL === */
.preview-panel .panel-card {
    position: sticky;
    top: 80px;
}

.preview-info {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 16px;
    text-align: center;
}

.preview-container {
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-radius: 14px;
    background: #111827;
    padding: 16px;
}

/* === THE ID CARD WRAPPER ===
   This wraps the 2026×1276 card and scales it down for display.
   The card itself is always rendered at full resolution in the DOM. */

.card-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    /* Display dimensions will be set by JavaScript based on container width */
}

/* === THE ID CARD: Fixed 2026 × 1276 px ===
   ALL positions below are absolute pixels at this exact resolution.
   CSS transform scales it for display; html2canvas captures at full size. */

.card-preview {
    width: 2026px;
    height: 1276px;
    position: relative;
    overflow: hidden;
    background-color: #4ba553; /* Matched green color */
    transform-origin: top left;
    /* transform: scale() is set by JavaScript */
}

/* When capturing for download, remove the transform */
.card-wrapper.capturing {
    width: 2026px !important;
    height: 1276px !important;
    overflow: visible !important;
    box-shadow: none !important;
}

.card-wrapper.capturing .card-preview {
    transform: none !important;
}

/* === CARD LAYERS === */
.bg-layer,
.content-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 2026px;
    height: 1276px;
    pointer-events: none;
}

.content-layer {
    z-index: 2;
}

.bg-layer {
    z-index: 1;
}


/* =============================================
   BACKGROUND LAYER — Static text & logos
   All positions in absolute px at 2026×1276
   ============================================= */

/* --- Top slogans (yellow bar) --- */
#jinda,
#radhe,
#jaban {
    position: absolute;
    top: 40px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 40px;
    font-weight: 700;
    color: #f7e651;
    white-space: nowrap;
}

#jinda {
    left: 60px;
    word-spacing: 2px;
}

#radhe {
    left: 50%;
    transform: translateX(-50%);
}

#jaban {
    left: auto;
    right: 60px;
}

/* --- Main heading --- */
#union {
    position: absolute;
    top: 100px;
    left: 0;
    width: 2026px;
    text-align: center;
    font-family: 'Noto Sans', sans-serif;
    font-size: 110px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}


/* --- Logos --- */
#logo2-preview {
    position: absolute;
    top: 90px;
    left: 60px;
    width: 220px;
    height: 220px;
    object-fit: contain;
    border: none;
    box-shadow: none;
}

#logo1-preview {
    position: absolute;
    top: 90px;
    right: 60px;
    width: 220px;
    height: 220px;
    object-fit: contain;
    border: none;
    box-shadow: none;
}

/* --- Sub-headings (centered) --- */
#sangathan,
#mathura,
#up,
#regis {
    position: absolute;
    left: 0;
    width: 2026px;
    text-align: center;
    font-family: 'Noto Sans', sans-serif;
    font-size: 44px;
    font-weight: 600;
    white-space: nowrap;
}

#sangathan {
    top: 250px;
    color: #f7e651;
}

#mathura {
    top: 310px;
    color: #f7e651;
}

#up {
    top: 360px;
    color: #f7e651;
}

#regis {
    top: 420px;
    color: #e31c23;
    font-weight: 700;
}

/* --- Signature image --- */
#sign-preview {
    position: absolute;
    top: 997px;
    left: 1290px;
    width: 200px;
    height: 200px;
    object-fit: contain;
    border: none;
    box-shadow: none;
    z-index: 4;
}


/* --- Signature text --- */
#sign-text {
    position: absolute;
    top: 1160px;
    left: 976px;
    width: 550px;
    text-align: center;
    font-family: 'Noto Sans', sans-serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 40px;
    color: #000000;
    white-space: pre-wrap;
    z-index: 4;
}


/* =============================================
   CONTENT LAYER — White box, user data, photo, QR
   All positions in absolute px at 2026×1276
   ============================================= */

/* --- White background box --- */
.white-box {
    position: absolute;
    top: 724px;
    left: 40px;
    width: 1440px;
    height: 522px;
    background-color: #ffffff;
    border-radius: 30px;
}

/* --- Bhanu ID badge --- */
.bhanu-id-container {
    position: absolute;
    top: 480px;
    left: 0;
    width: 2026px;
    text-align: center;
    z-index: 3;
}

#bhanu_id-preview {
    display: inline-block;
    font-family: 'Noto Sans', sans-serif;
    font-size: 96px;
    font-weight: 700;
    color: #ffffff;
    border: 8px solid #ffffff;
    border-radius: 30px;
    padding: 10px 60px;
    background: transparent;
    white-space: nowrap;
}

/* --- User data text fields --- */
#name-preview,
#father-name-preview,
#post-preview,
#address-preview,
#aadhar-preview,
#mobile-preview,
#date-preview {
    position: absolute;
    font-family: 'Noto Sans', sans-serif;
    font-size: 46px;
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
    left: 90px;
    z-index: 3;
}

#name-preview         { top: 730px; }
#father-name-preview  { top: 800px; }
#post-preview         { top: 870px; }
#address-preview      { top: 940px; }
#aadhar-preview       { top: 1010px; }
#mobile-preview       { top: 1080px; }
#date-preview         { top: 1150px; }

/* --- Member photo --- */
#photo-preview {
    position: absolute;
    top: 730px;
    left: 1074px;
    width: 320px;
    height: 400px;
    object-fit: cover;
    border: 2px solid #ddd;
    background-color: #e5e7eb;
    z-index: 3;
}


/* Hide photo if no src */
#photo-preview[src=""],
#photo-preview:not([src]) {
    display: none;
}

/* --- QR Code --- */
#qrcode {
    position: absolute;
    top: 790px;
    left: 1520px;
    width: 400px;
    height: 400px;
    background: white;
    padding: 20px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}


/* =============================================
   RESPONSIVE DESIGN
   ============================================= */
@media (max-width: 1100px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .preview-panel .panel-card {
        position: static;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 16px;
    }

    .panel-card {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }

    .load-controls {
        flex-direction: column;
    }
}

/* === SELECT2 DARK THEME === */
.select2-container--default .select2-selection--single {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    border-radius: 10px !important;
    height: 40px !important;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e2e8f0 !important;
    line-height: normal !important;
    padding-left: 14px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
    right: 6px !important;
}
.select2-dropdown {
    background-color: #1e293b !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}
.select2-search--dropdown .select2-search__field {
    background-color: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    color: #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    outline: none !important;
}
.select2-search--dropdown .select2-search__field:focus {
    border-color: #3b82f6 !important;
}
.select2-results__option {
    color: #e2e8f0 !important;
    padding: 8px 14px !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #3b82f6 !important;
    color: white !important;
}
.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: rgba(59, 130, 246, 0.2) !important;
}