/* styles.css - Complete Stylesheet */
/* Bengali font (Tiro Bangla) */
@import url('https://fonts.googleapis.com/css2?family=Tiro+Bangla:ital@0;1&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* Include Tiro Bangla so Bengali glyphs render crisply; Latin uses Nunito first */
    font-family: 'Nunito', 'Tiro Bangla', 'Noto Sans Bengali', 'SolaimanLipi', 'Vrinda', 'Nirmala UI', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #7f1d1d 0%, #f5f0e6 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    width: 96%;               /* use more horizontal space */
    max-width: 1400px;        /* was 1200px */
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.1);
}

/* Header Styles */
/* Compact Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(90deg, #5b0f0f, #7f1d1d);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.brand-logo { font-size: 20px; }
.brand-name { font-weight: 700; letter-spacing: .3px; font-family: 'Playfair Display', serif; display:flex; flex-direction:column; line-height:1; }
.brand-main { font-size: 22px; font-weight: 800; }
.brand-sub { font-size: 11px; font-weight: 600; opacity: 0.8; margin-top: 2px; color: #ffe4e6; }
.nav-links { display: inline-flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.nav-link { color: #e9f0ff; text-decoration: none; padding: 8px 12px; border-radius: 8px; transition: background .2s, color .2s; font-weight:600; }
.nav-link:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.22); color:#fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25); }

/* Bengali text helper class */
.bn { font-family: 'Tiro Bangla', 'Noto Sans Bengali', 'SolaimanLipi', 'Vrinda', sans-serif; }
.nav-right { display: inline-flex; gap: 10px; align-items: center; }
.status-pill { background: rgba(255,255,255,0.2); color:#fff; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.status-pill.ok { background: rgba(46, 204, 113, 0.35); }
.btn-ghost, .btn-primary-ghost { color:#fff; text-decoration:none; padding:6px 12px; border-radius:6px; border:1px solid rgba(255,255,255,0.4); transition:all .2s; }
.btn-ghost:hover, .btn-primary-ghost:hover { background: rgba(255,255,255,0.15); }

/* Main Content */
.main-content {
    padding: 28px; /* compact */
    max-width: 100%;
    width: 100%;
}

.form-section {
    background: #f8f9fa;
    padding: 22px; /* compact */
    border-radius: 12px;
    border-left: 4px solid #d4af37; /* gold */
    width: 100%;
    max-width: none;
}

.preview-section {
    display: none; /* Hidden - will use modal instead */
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem; /* compact */
    color: #1f2937;
    margin-bottom: 12px;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 6px;
    letter-spacing: .2px;
}

/* Form Styles */
.form-group { margin-bottom: 14px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px; /* tighter gap */
    margin-bottom: 8px;
}

/* Ensure Select2 fills the control width */
.select2-container { width: 100% !important; }

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #0f172a;
    font-size: 13px;
}

input, select, textarea {
    width: 100%;
    padding: 9px 10px; /* more compact */
    border: 1.4px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.2;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.file-input {
    border: 2px dashed #d4af37;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.file-input:hover {
    background-color: rgba(212, 175, 55, 0.08);
}

/* Section Styles */
.personal-info-section,
.education-section,
.professional-section,
.experience-section,
.custom-fields-section {
    margin-bottom: 22px; /* tighter sections */
    padding: 16px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #27ae60;
}

/* Compact form tweaks */
.personal-info-section .form-group,
.education-section .form-group,
.professional-section .form-group,
.experience-section .form-group { margin-bottom: 12px; }

/* Modern photo upload card */
.photo-upload-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 14px;
    align-items: center;
}
.photo-upload-thumb {
    width: 120px;
    height: 168px; /* 25x35 mm ratio */
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.photo-upload-thumb img { width: 100%; height: 100%; object-fit: cover; display:block; }
.photo-upload-body { display:flex; flex-direction: column; gap:8px; }
.photo-dropzone {
    border: 2px dashed #d4af37;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    background: #f5f0e6; /* beige */
    cursor: pointer;
    transition: border-color .2s, background-color .2s;
}
.photo-dropzone:hover { background: #f7f2e7; }
.photo-dropzone.highlight { border-color: #d4af37; background: #fbf4dc; }
.photo-upload-help { font-size: 12px; color:#64748b; }
.photo-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.btn-ghost-blue { background: #f5f0e6; color:#5b0f0f; border:1px solid #d4af37; }
.btn-ghost-blue:hover { background:#f7f2e7; }

/* Smaller buttons inside sections */
.btn { padding: 8px 12px; }
.form-actions .btn { padding: 12px 20px; }

.custom-fields-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.personal-info-section h3,
.education-section h3,
.professional-section h3,
.experience-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

/* Dynamic Rows */
.education-row,
.professional-row,
.experience-row,
.personal-field-row {
    display: grid;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.education-row {
    grid-template-columns: repeat(6, 1fr) auto;
}

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

.experience-row {
    grid-template-columns: 1.2fr 1fr 1fr 0.9fr 0.9fr 1fr 1fr auto;
}

.personal-field-row {
    grid-template-columns: 1fr 1fr auto;
}


.form-control {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(45deg, #6b0f0f, #7f1d1d);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #27ae60, #229954);
    color: white;
}

.btn-info {
    background: linear-gradient(45deg, #d4af37, #b8860b);
    color: #1f2937;
}

.btn-add {
    background: #27ae60;
    color: white;
    padding: 8px 15px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    font-size: 11px;
}

.btn-add .emoji { display: inline-block; }

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.form-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.form-actions .btn {
    margin: 0 10px;
    padding: 15px 30px;
    font-size: 16px;
}

/* View Section Styles */
.view-section {
    padding: 20px;
    background: #f5f5f5;
}

.action-buttons {
    text-align: center;
    margin: 20px 0;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.action-buttons .btn {
    margin: 0 10px;
    padding: 12px 24px;
    font-size: 16px;
}

.biodata-display {
    background: white;
    padding: 25px; /* Added padding for border */
    margin: 20px auto;
    max-width: 800px; /* Approx A4 width for screen */
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    line-height: 1.4;
    position: relative;
    color: #000;
    border: 1px solid #666; /* Page Border */
}

.biodata-header {
    text-align: center;
    font-size: 18pt;
    font-weight: bold;
    margin-bottom: 20px;
    text-decoration: underline;
    letter-spacing: 2px;
}

.biodata-content {
    position: relative;
}

.personal-section {
    position: relative;
    margin-bottom: 20px;
}

.photo-section {
    position: absolute;
    right: 0;
    top: 50px; /* Adjusted position */
    width: 115px;
    text-align: center;
    border: 1px solid #000;
    padding: 2px;
}

.photo-section img {
    width: 100%;
    height: auto;
    aspect-ratio: 25 / 35;
    object-fit: cover;
    display: block;
}

.respect-text {
    margin-bottom: 15px;
    font-size: 12pt;
}

.respect-text p {
    margin: 5px 0;
}

.info-table {
    width: calc(100% - 130px); /* Leave space for photo */
    margin-bottom: 20px;
    font-size: 12pt;
}

.info-table td {
    padding: 2px 0;
    vertical-align: top;
}

.info-label {
    font-weight: bold;
    width: 170px;
    text-transform: uppercase;
}

.info-table td:nth-child(2) {
    width: 15px;
    text-align: center;
}

.section-header {
    font-weight: bold;
    font-size: 14pt;
    margin: 20px 0 10px 0;
    text-decoration: underline;
    text-align: center;
    clear: both;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 11pt;
}

.data-table th,
.data-table td {
    border: 1px solid #000;
    padding: 4px;
    text-align: center;
    vertical-align: middle;
}

.data-table th {
    background-color: #f0f0f0;
    font-weight: bold;
}

.declaration {
    margin-top: 25px;
    margin-bottom: 20px;
    font-size: 11pt;
    text-align: justify;
}

.signature-section {
    margin-top: 40px;
    clear: both;
}

.signature-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.date-place div {
    margin-bottom: 10px;
}

.signature {
    text-align: center;
    margin-right: 30px;
}

.signature div:first-child {
    border-top: 1px solid #000;
    padding-top: 5px;
}


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content-large {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 900px;
    border-radius: 10px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.modal-header h2 { color: #2c3e50; }
.close { color: #aaa; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover, .close:focus { color: black; }

.modal-body {
    padding: 20px 0;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding-top: 15px;
    border-top: 1px solid #ddd;
    text-align: right;
}

.modal-footer .btn { margin-left: 10px; }

#biodata-preview .biodata-display {
    margin: 0;
    box-shadow: none;
    max-width: 100%;
    min-height: auto;
    font-size: 10pt; /* Smaller font for preview modal */
}

/* Footer Styles */
.footer {
    background: #1f2937; /* slate */
    color: #cbd5e1;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* Template previews for on-screen view */
.tpl-elegant .biodata-header {
    border-bottom: 3px solid #2c3e50;
    padding-bottom: 6px;
    margin-bottom: 10px;
}
.tpl-elegant .photo-section { float: left; margin: 0 12px 10px 0; }
.tpl-elegant .elg-layout{ display:grid; grid-template-columns: 28% 1fr; gap:12px; }
.tpl-elegant .elg-left{ background:#f7f9fc; border:1px solid #cbd5e1; padding:10px; border-radius:6px; }
.tpl-elegant .elg-left .photo{ width:130px; height:160px; border:1px solid #000; margin:0 auto 8px; }
.tpl-elegant .elg-left .photo img{ width:130px; height:160px; object-fit:cover; }
.tpl-elegant .elg-chip{ display:block; margin:2px 0; font-size:10.5pt; }
.tpl-elegant .elg-name{ font-size:18pt; font-weight:700; letter-spacing:1px; margin-bottom:6px; }

.tpl-vibrant .biodata-header {
    background: linear-gradient(90deg, #0ea5e9, #22c55e);
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
}
.tpl-vibrant { position: relative; }
.tpl-vibrant .photo-section {
    position: absolute;
    right: 12px;
    top: 70px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

/* Professional (maroon + gold) preview */
.tpl-professional .pro-banner { background: linear-gradient(90deg,#5b0f0f,#7f1d1d); color:#fff; padding:12px 14px; border-radius:6px; display:flex; align-items:center; gap:12px; }
.tpl-professional .pro-photo { width:80px; height:80px; border-radius:50%; overflow:hidden; border:3px solid #fff; background:#fff; }
.tpl-professional .pro-photo img { width:80px; height:80px; object-fit:cover; }
.tpl-professional .pro-name { font-size:20pt; font-weight:800; letter-spacing:1px; }
.tpl-professional .pro-role { font-size:11pt; opacity:.9; }
.tpl-professional .pro-grid { display:grid; grid-template-columns: 30% 1fr; gap:14px; margin-top:12px; }
.tpl-professional .pro-left { background:#f5f0e6; border:1px solid #eadbb8; border-radius:6px; padding:10px; }
.tpl-professional .pro-section-title { color:#0f172a; font-weight:800; text-transform:uppercase; font-size:11pt; border-left:4px solid #d4af37; padding-left:6px; margin:10px 0 6px; }
.tpl-professional .pro-chip { display:block; margin:2px 0; font-size:10.5pt; }
.tpl-professional .pro-right { border-left:3px solid #e2e8f0; padding-left:12px; }
.tpl-professional .pro-bullets { list-style: none; padding-left:0; }
.tpl-professional .pro-bullets li { position:relative; padding-left:14px; margin:4px 0; }
.tpl-professional .pro-bullets li:before { content:''; width:7px; height:7px; background:#10b981; border-radius:50%; position:absolute; left:0; top:7px; }

/* Minimal CSS tweaks when viewing classic DOM with 'professional' selected */
.tpl-professional .biodata-header {
    background: linear-gradient(90deg,#5b0f0f,#7f1d1d);
    color:#fff;
    padding:8px 10px;
    border-radius:6px;
}
.sample-resume { background:#fff; border-radius:14px; box-shadow:0 10px 30px rgba(0,0,0,.08); border:1px solid #e2e8f0; padding:0; overflow:hidden; }
.sample-header { background:linear-gradient(135deg, #5b0f0f, #d4af37); color:#fff; padding:14px; display:flex; align-items:center; gap:12px; }
.sample-header .ph { width:80px; height:80px; border-radius:50%; overflow:hidden; border:3px solid #fff; }
.sample-header .ph img { width:80px; height:80px; object-fit:cover; }
.sample-header .nm { font-size:20pt; font-weight:800; letter-spacing:1px; }
.sample-header .rl { font-size:11pt; opacity:.95; }
.sample-grid { display:grid; grid-template-columns: 32% 1fr; gap:14px; padding:14px; }
.sample-left { border-right:2px solid #e2e8f0; padding-right:12px; }
.sample-section { font-weight:800; text-transform:uppercase; color:#0f172a; font-size:11pt; margin:10px 0 6px; }
.sample-chip { display:block; margin:2px 0; font-size:10.5pt; }
.sample-right .section-header { text-align:left; border-left:4px solid #d4af37; padding-left:8px; }
.tpl-professional .photo-section {
    position:absolute;
    right:12px;
    top:70px;
    width:90px; height:90px;
    border-radius:50%; overflow:hidden;
    border:3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.tpl-professional .photo-section img { width:100%; height:100%; object-fit:cover; }
.tpl-professional .section-header { border-left:4px solid #d4af37; padding-left:8px; }
.tpl-vibrant .chip{ display:inline-block; background:#f5f0e6; border:1px solid #eadbb8; color:#5b0f0f; border-radius:14px; padding:2px 8px; margin:2px 4px; font-size:10pt; }
.tpl-vibrant .v-section{ border-left:4px solid #d4af37; padding-left:8px; margin-top:12px; font-weight:700; text-transform:uppercase; }
.tpl-vibrant .data-table th{ background:#d4af37; color:#5b0f0f; }
.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.footer small { opacity: .8; }
.footer-links a { color: #94a3b8; text-decoration: none; margin: 0 8px; }
.footer-links a:hover { color: #e2e8f0 !important; }

/* Alert Messages */
.alert { padding: 15px; margin: 20px 0; border-radius: 5px; font-weight: 500; }
.alert-success { background-color: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.alert-error { background-color: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }
.alert-info { background-color: #d1ecf1; border: 1px solid #bee5eb; color: #0c5460; }

/* Current Photo Display */
.current-photo { margin-bottom: 15px; text-align: left; }
.current-photo img { border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); width: 100px; height: auto; }

/* Responsive Design */
@media (max-width: 768px) {
    .main-content { padding: 20px; }
    .form-row, .education-row, .professional-row, .experience-row, .personal-field-row { grid-template-columns: 1fr; gap: 10px; }
    .topbar-inner { grid-template-columns: 1fr auto; }
    .nav-links { display: none; }
}

/* Print Styles for A4 */
@media print {
    body {
        background: white !important;
        color: #000;
        margin: 0;
        padding: 0;
        font-size: 11pt; /* Base font size for print */
    }
    
    .container {
        box-shadow: none;
        max-width: none;
        width: 100%;
        background: white;
        margin: 0;
        padding: 0;
    }
    
    .header, .topbar, .footer, .action-buttons, .form-section, .main-content, .modal, .btn-remove {
        display: none !important;
    }
    
    .view-section {
        display: block !important;
        padding: 0;
        background: none;
    }
    
    .biodata-display {
        margin: 0 auto;
        padding: 1cm; /* Padding for the border */
        box-shadow: none;
        width: 100%;
        border: 1px solid #000; /* Ensure border prints */
        font-family: 'Times New Roman', Times, serif;
    }

    .biodata-header { font-size: 16pt; margin-bottom: 15px; }
    .section-header { font-size: 12pt; margin: 15px 0 8px 0; }
    .respect-text { font-size: 11pt; }
    .info-table { font-size: 11pt; }
    .data-table { font-size: 10pt; }
    .data-table th, .data-table td { padding: 3px; }
    .declaration { font-size: 10pt; margin-top: 15px; }
    .signature-section { margin-top: 25px; page-break-inside: avoid; }
    .photo-section { border: 1px solid #000 !important; }

    @page {
        size: A4;
        margin: 20mm; /* Standard A4 margins */
    }
}
.form-edu-table th, .form-edu-table td { padding: 6px; border-bottom: 1px solid #eee; vertical-align: middle; }
table .education-row { display: table-row; }
.tpl-creative .cr-banner { background: linear-gradient(135deg,#5b0f0f,#d4af37); color:#fff; padding:14px; border-radius:8px; display:flex; align-items:center; gap:12px; }
.tpl-creative .cr-name { font-size:20pt; font-weight:800; letter-spacing:1px; }
.tpl-creative .cr-role { font-size:11pt; opacity:.95; }
.tpl-creative .cr-photo { width:80px; height:80px; border-radius:12px; overflow:hidden; border:3px solid #fff; }
.tpl-creative .cr-photo img { width:80px; height:80px; object-fit:cover; }
.tpl-creative .cr-grid { display:grid; grid-template-columns: 32% 1fr; gap:14px; margin-top:12px; }
.tpl-creative .cr-left { background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; padding:10px; }
.tpl-creative .cr-title { color:#0f172a; font-weight:800; text-transform:uppercase; font-size:11pt; border-bottom:2px solid #e2e8f0; padding-bottom:4px; margin:8px 0; }
.tpl-creative .cr-chip { display:block; margin:2px 0; font-size:10.5pt; }
.tpl-creative .cr-right .section-header{ text-align:left; border-left:4px solid #d4af37; padding-left:8px; }
