/* Marriage Biodata Specific Styles */

/* Layout */
.biodata-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.biodata-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .biodata-layout {
        grid-template-columns: 450px 1fr;
    }
}

/* Panels */
.biodata-form-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    height: 100%;
    min-width: 0; /* CRITICAL: prevents flex/grid children from forcing container to stretch beyond viewport */
    position: relative;
    z-index: 10; /* CRITICAL: Elevate panel above any transparent sibling overlays */
}

.biodata-preview-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 2rem;
    height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-main);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.action-buttons-mobile {
    display: none;
}

@media (max-width: 1023px) {
    .biodata-preview-panel {
        display: none;
    }
    .action-buttons-mobile {
        display: block;
    }
}

/* Floating Mobile Preview Button */
.floating-preview-btn {
    display: none;
}

@media (max-width: 1023px) {
    .floating-preview-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--primary, #2563eb);
        color: white;
        padding: 14px 28px;
        border-radius: 50px;
        font-weight: 600;
        font-size: 1rem;
        box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
        z-index: 990;
        border: none;
        cursor: pointer;
        white-space: nowrap;
        transition: transform 0.2s, box-shadow 0.2s;
    }
    
    .floating-preview-btn:active {
        transform: translateX(-50%) scale(0.95);
    }
}

/* Form Styles */
.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 1.25rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-weight: 500;
}

.optional-badge {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: normal;
    opacity: 0.8;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

select.form-control {
    padding-right: 2.5rem !important; /* Space for the dropdown arrow, overrides inline padding */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23475569%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
}

/* Professional Photo Upload Dropzone */
.photo-upload-group {
    margin-bottom: 1.5rem;
}
.photo-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 2rem 1rem;
    border: 2px dashed #6366f1 !important;
    border-radius: 12px;
    background-color: rgba(99, 102, 241, 0.06) !important;
    color: #6366f1 !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.photo-upload-label span {
    color: #6366f1 !important;
    font-size: 1.05rem;
    margin-bottom: 4px;
}
.photo-upload-label svg {
    stroke: #6366f1 !important;
    margin-bottom: 0.75rem;
    width: 32px;
    height: 32px;
    opacity: 1 !important;
}
.photo-upload-label:hover {
    background-color: rgba(99, 102, 241, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}
.photo-upload-label svg {
    margin-bottom: 0.5rem;
    width: 28px;
    height: 28px;
    opacity: 0.9;
}

/* Wizard Progress Styles */
.wizard-progress {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    gap: 15px;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    z-index: 50; /* Force it to the top */
}

.wizard-progress::-webkit-scrollbar {
    display: none;
}

.progress-step {
    flex: 1 0 auto;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    position: relative;
    padding-bottom: 0.75rem;
    cursor: pointer;
    transition: color 0.3s;
}

.progress-step::after {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-step.active {
    color: var(--primary);
    font-weight: 600;
}

.progress-step.active::after {
    width: 100%;
}

/* Wizard Step Display */
.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Template Slider Styles */
.template-slider {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    position: relative;
    z-index: 50; /* Force it to the top */
}

.template-slider::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

.template-card {
    flex: 0 0 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.2s;
}

.template-card:hover {
    transform: translateY(-2px);
}

.template-card-visual {
    width: 80px;
    height: 110px;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.template-card.active .template-card-visual {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.template-card span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
}

.template-card.active span {
    color: var(--primary);
    font-weight: 700;
}

/* Template Card Visual Variations (CSS-only thumbnails) */
.minimalist-visual { background: #fff; font-family: 'Inter', sans-serif; color: #111827; }
.royal-visual { background: #fffdf5; font-family: 'Playfair Display', serif; color: #8b0000; border-color: #bd9e5b; }
.pastel-visual { background: linear-gradient(135deg, #fdf2f8 35%, #fff 35%); font-family: 'Outfit', sans-serif; color: #be185d; }
.classic-visual { background: #fff; border: 2px solid #2c3e50; font-family: 'Merriweather', serif; color: #2c3e50; }
.floral-visual { background: #fdfbf7; font-family: 'Playfair Display', serif; color: #d4a373; }
.corporate-visual { background: linear-gradient(to bottom, #1e3a8a 20%, #fff 20%); font-family: 'Inter', sans-serif; color: #1e3a8a; }
.vintage-visual { background: #f4ecd8; font-family: 'Courier New', monospace; color: #5c4d4d; border-style: dashed; }
.dark-visual { background: #111827; font-family: 'Inter', sans-serif; color: #f3f4f6; border-color: #374151; }
.geometric-visual { background: linear-gradient(45deg, #f0fdf4 50%, #eff6ff 50%); font-family: 'Outfit', sans-serif; color: #0f172a; }
.gold-visual { background: #050505; font-family: 'Playfair Display', serif; color: #d4af37; border-color: #d4af37; }

/* Photo Upload */
.photo-upload-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.photo-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    background: var(--primary);
    color: white !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    margin-bottom: 0 !important;
}

.btn-text.danger {
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Preview Area */
.preview-container-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.preview-scaler {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

#biodataPreview {
    width: 794px; /* A4 width in px at 96dpi */
    min-height: 1123px; /* A4 height */
    height: auto;
    background: white;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform-origin: top center;
    position: relative;
    box-sizing: border-box;
    display: flow-root; /* Fixes margin collapse so scrollHeight includes bottom margins natively */
}

.hidden {
    display: none !important;
}

/* Basic Layout resets for templates */
.biodata-template * {
    box-sizing: border-box;
}

/* Shared Premium Classes */
.bio-pill-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.bio-pill {
    padding: 4px 12px;
    background: rgba(0,0,0,0.05);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    opacity: 0.9;
}
.bio-about {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* =========================================
   TEMPLATE 1: MINIMALIST MODERN
   ========================================= */
.biodata-template.minimalist {
    padding: 40px 50px;
    font-family: 'Inter', sans-serif;
    color: #1a1a1a;
    background: #fff;
}
.biodata-template.minimalist .bio-header { display: flex; align-items: center; border-bottom: 2px solid #2563eb; padding-bottom: 20px; margin-bottom: 30px; }
.biodata-template.minimalist .bio-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin-right: 30px; border: 3px solid #f3f4f6; }
.biodata-template.minimalist .bio-title h1 { font-size: 32px; font-weight: 700; margin: 0 0 5px 0; color: #111827; }
.biodata-template.minimalist .bio-title p { font-size: 15px; color: #6b7280; margin: 0; }
.biodata-template.minimalist .bio-pill { background: #f3f4f6; border: 1px solid #e5e7eb; color: #374151; }
.biodata-template.minimalist .bio-section { margin-bottom: 30px; }
.biodata-template.minimalist .bio-section-title { font-size: 18px; font-weight: 600; color: #2563eb; margin-bottom: 15px; text-transform: uppercase; display: flex; align-items: center; }
.biodata-template.minimalist .bio-section-title::after { content: ''; flex: 1; height: 1px; background: #e5e7eb; margin-left: 15px; }
.biodata-template.minimalist .bio-grid { display: grid; grid-template-columns: 180px 1fr; gap: 12px 20px; font-size: 15px; }
.biodata-template.minimalist .bio-label { font-weight: 600; color: #4b5563; }
.biodata-template.minimalist .bio-value { color: #1f2937; }

/* =========================================
   TEMPLATE 2: ROYAL TRADITIONAL
   ========================================= */
.biodata-template.royal {
    padding: 50px; 
    font-family: 'Playfair Display', serif; 
    background-color: #fffdf5; 
    color: #4a2c2a; 
    border: 15px solid #bd9e5b; 
    position: relative;
    /* Subtle mandala background base64 */
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIiBvcGFjaXR5PSIwLjA1Ij48Y2lyY2xlIGN4PSIxMDAiIGN5PSIxMDAiIHI9IjkwIiBmaWxsPSJub25lIiBzdHJva2U9IiNiZDllNWIiIHN0cm9rZS13aWR0aD0iMiIvPjxjaXJjbGUgY3g9IjEwMCIgY3k9IjEwMCIgcj0iODAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2JkOWU1YiIgc3Ryb2tlLXdpZHRoPSIwLjUiLz48L3N2Zz4=');
    background-position: center;
    background-repeat: repeat;
}
.biodata-template.royal::before { content: ''; position: absolute; top: 5px; left: 5px; right: 5px; bottom: 5px; border: 1px solid #bd9e5b; }
.biodata-template.royal .bio-header { text-align: center; margin-bottom: 30px; position: relative; z-index: 2; }
.biodata-template.royal .bio-title h1 { font-size: 38px; color: #8b0000; margin: 0 0 10px 0; font-weight: 700; }
.biodata-template.royal .om-symbol { font-size: 40px; color: #bd9e5b; margin-bottom: 10px; font-family: sans-serif; }
.biodata-template.royal .bio-photo { width: 140px; height: 140px; border-radius: 8px; object-fit: cover; border: 4px solid #bd9e5b; margin: 20px auto; display: block; }
.biodata-template.royal .bio-section { margin-bottom: 30px; padding: 0 20px; position: relative; z-index: 2; }
.biodata-template.royal .bio-about { text-align: center; font-style: italic; color: #8b0000; font-size: 16px; margin: -10px 20px 30px; }
.biodata-template.royal .bio-section-title { text-align: center; font-size: 22px; color: #8b0000; border-bottom: 2px dashed #bd9e5b; padding-bottom: 5px; margin-bottom: 20px; font-weight: 600; }
.biodata-template.royal .bio-grid { display: grid; grid-template-columns: 200px 1fr; gap: 15px; font-size: 16px; }
.biodata-template.royal .bio-label { font-weight: bold; color: #bd9e5b; }

/* =========================================
   TEMPLATE 3: MODERN PASTEL
   ========================================= */
.biodata-template.pastel { padding: 0; font-family: 'Outfit', sans-serif; background: #ffffff; display: flex; }
.biodata-template.pastel .pastel-sidebar { width: 35%; background: #fdf2f8; padding: 50px 30px; border-right: 1px solid #fbcfe8; }
.biodata-template.pastel .pastel-main { width: 65%; padding: 50px 40px; }
.biodata-template.pastel .bio-photo { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 5px solid white; box-shadow: 0 4px 10px rgba(0,0,0,0.1); margin: 0 auto 30px auto; display: block; }
.biodata-template.pastel .pastel-sidebar h1 { text-align: center; font-size: 28px; margin: 0 0 5px 0; color: #831843; font-weight: 700; }
.biodata-template.pastel .bio-section { margin-bottom: 35px; }
.biodata-template.pastel .bio-section-title { font-size: 20px; font-weight: bold; color: #be185d; margin-bottom: 15px; border-bottom: 2px solid #fbcfe8; padding-bottom: 5px; }
.biodata-template.pastel .pastel-sidebar .bio-section-title { border-bottom-color: #f9a8d4; color: #831843; }
.biodata-template.pastel .bio-grid { display: flex; flex-direction: column; gap: 12px; }
.biodata-template.pastel .bio-grid-item { display: flex; flex-direction: column; }
.biodata-template.pastel .bio-label { font-size: 13px; font-weight: 600; color: #db2777; text-transform: uppercase; letter-spacing: 0.5px; }
.biodata-template.pastel .pastel-sidebar .bio-label { color: #9d174d; }
.biodata-template.pastel .bio-value { font-size: 15px; color: #374151; margin-top: 2px; }
.biodata-template.pastel .pastel-sidebar .bio-value { color: #831843; }

/* =========================================
   TEMPLATE 4: CLASSIC ELEGANT
   ========================================= */
.biodata-template.classic { padding: 40px 50px; font-family: 'Merriweather', serif; background: #fff; border: 2px solid #2c3e50; margin: 20px; width: calc(100% - 40px); min-height: calc(1123px - 40px); }
.biodata-template.classic .bio-header { text-align: center; border-bottom: 1px solid #2c3e50; padding-bottom: 20px; margin-bottom: 30px; }
.biodata-template.classic .bio-photo { width: 130px; height: 130px; object-fit: cover; border: 2px solid #2c3e50; padding: 3px; display: inline-block; }
.biodata-template.classic .bio-title h1 { font-size: 34px; text-transform: uppercase; letter-spacing: 2px; color: #2c3e50; margin: 15px 0 5px 0; }
.biodata-template.classic .bio-section { margin-bottom: 25px; }
.biodata-template.classic .bio-section-title { font-size: 18px; color: #2c3e50; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; background: #f8f9fa; padding: 6px 10px; border-left: 4px solid #2c3e50; font-weight: 700; }
.biodata-template.classic .bio-grid { display: grid; grid-template-columns: 200px 1fr; gap: 10px; font-size: 15px; }
.biodata-template.classic .bio-label { font-weight: 700; color: #34495e; }

/* =========================================
   TEMPLATE 5: FLORAL GARDEN
   ========================================= */
.biodata-template.floral { padding: 50px; font-family: 'Playfair Display', serif; background-color: #fdfbf7; background-image: radial-gradient(#e5e7eb 1px, transparent 1px); background-size: 20px 20px; color: #2d3748; }
.biodata-template.floral .bio-header { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 30px; }
.biodata-template.floral .bio-photo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 5px solid #d4a373; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-bottom: 20px; }
.biodata-template.floral .bio-title h1 { font-size: 36px; color: #d4a373; margin: 0; font-style: italic; }
.biodata-template.floral .bio-section { margin-bottom: 30px; background: rgba(255, 255, 255, 0.85); padding: 20px; border-radius: 12px; border: 1px solid #faedcd; }
.biodata-template.floral .bio-section-title { font-size: 22px; color: #a3b18a; border-bottom: 2px solid #e9edc9; padding-bottom: 8px; margin-bottom: 15px; text-align: center; font-weight: 600; }
.biodata-template.floral .bio-grid { display: grid; grid-template-columns: 180px 1fr; gap: 15px; font-size: 16px; font-family: 'Inter', sans-serif; }
.biodata-template.floral .bio-label { color: #d4a373; font-weight: 600; }

/* =========================================
   TEMPLATE 6: PROFESSIONAL CORPORATE
   ========================================= */
.biodata-template.corporate { padding: 0; font-family: 'Inter', sans-serif; background: #fff; display: flex; flex-direction: column; }
.biodata-template.corporate .top-bar { background: #1e3a8a; height: 120px; width: 100%; position: absolute; top: 0; z-index: 1; }
.biodata-template.corporate .content-wrapper { position: relative; z-index: 2; padding: 40px 50px; display: flex; gap: 40px; margin-top: 40px; }
.biodata-template.corporate .left-col { width: 30%; }
.biodata-template.corporate .right-col { width: 70%; }
.biodata-template.corporate .bio-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border: 4px solid #fff; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-bottom: 20px; border-radius: 4px; }
.biodata-template.corporate .bio-title h1 { font-size: 32px; color: #1e3a8a; margin: 0; font-weight: 700; }
.biodata-template.corporate .bio-pill { background: rgba(30, 58, 138, 0.08); color: #1e3a8a; }
.biodata-template.corporate .bio-pill-container { border-bottom: 2px solid #bfdbfe; padding-bottom: 15px; margin-bottom: 20px; }
.biodata-template.corporate .bio-section { margin-bottom: 25px; }
.biodata-template.corporate .bio-section-title { font-size: 15px; text-transform: uppercase; color: #1e3a8a; font-weight: 700; margin-bottom: 15px; letter-spacing: 1px; }
.biodata-template.corporate .bio-grid { display: grid; grid-template-columns: 1fr; gap: 10px; font-size: 14px; }
.biodata-template.corporate .right-col .bio-grid { grid-template-columns: 150px 1fr; }
.biodata-template.corporate .bio-label { font-weight: 600; color: #475569; }
.biodata-template.corporate .bio-value { color: #1e293b; }

/* =========================================
   TEMPLATE 7: VINTAGE RETRO
   ========================================= */
.biodata-template.vintage { padding: 40px; font-family: 'Courier New', Courier, monospace; background-color: #f4ecd8; color: #3b2f2f; border: 10px double #5c4d4d; }
.biodata-template.vintage .bio-header { text-align: center; border-bottom: 2px dashed #5c4d4d; padding-bottom: 20px; margin-bottom: 30px; }
.biodata-template.vintage .bio-photo { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; filter: sepia(0.6); border: 3px solid #5c4d4d; margin-bottom: 15px; }
.biodata-template.vintage .bio-title h1 { font-size: 32px; font-weight: bold; text-transform: uppercase; margin: 0; }
.biodata-template.vintage .bio-section { margin-bottom: 25px; }
.biodata-template.vintage .bio-section-title { font-size: 20px; font-weight: bold; text-decoration: underline; margin-bottom: 15px; text-align: center; }
.biodata-template.vintage .bio-grid { display: grid; grid-template-columns: 220px 1fr; gap: 10px; font-size: 16px; }
.biodata-template.vintage .bio-label { font-weight: bold; }

/* =========================================
   TEMPLATE 8: MINIMALIST DARK
   ========================================= */
.biodata-template.dark { padding: 50px; font-family: 'Inter', sans-serif; background-color: #111827; color: #f3f4f6; }
.biodata-template.dark .bio-header { display: flex; align-items: center; border-bottom: 1px solid #374151; padding-bottom: 30px; margin-bottom: 30px; }
.biodata-template.dark .bio-photo { width: 130px; height: 130px; border-radius: 12px; object-fit: cover; margin-right: 30px; border: 2px solid #4b5563; }
.biodata-template.dark .bio-title h1 { font-size: 36px; font-weight: 500; margin: 0 0 10px 0; color: #fff; letter-spacing: 1px; }
.biodata-template.dark .bio-pill { background: #374151; color: #f3f4f6; border: 1px solid #4b5563; }
.biodata-template.dark .bio-section { margin-bottom: 35px; }
.biodata-template.dark .bio-section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 2px; color: #9ca3af; margin-bottom: 20px; }
.biodata-template.dark .bio-grid { display: grid; grid-template-columns: 180px 1fr; gap: 15px; font-size: 15px; font-weight: 300; }
.biodata-template.dark .bio-label { color: #9ca3af; font-weight: 500; }

/* =========================================
   TEMPLATE 9: MODERN GEOMETRIC
   ========================================= */
.biodata-template.geometric { padding: 0; font-family: 'Outfit', sans-serif; background: #fff; position: relative; overflow: hidden; }
.biodata-template.geometric::before { content: ''; position: absolute; top: -100px; right: -100px; width: 400px; height: 400px; background: #f0fdf4; border-radius: 50%; z-index: 1; }
.biodata-template.geometric::after { content: ''; position: absolute; bottom: -50px; left: -50px; width: 300px; height: 300px; background: #eff6ff; transform: rotate(45deg); z-index: 1; }
.biodata-template.geometric .content-container { position: relative; z-index: 2; padding: 50px; }
.biodata-template.geometric .bio-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.biodata-template.geometric .bio-title h1 { font-size: 40px; font-weight: 700; color: #0f172a; margin: 0; line-height: 1.1; }
.biodata-template.geometric .bio-pill { background: #eff6ff; color: #2563eb; font-weight: 600; }
.biodata-template.geometric .bio-photo { width: 150px; height: 150px; border-radius: 20px 0 20px 0; object-fit: cover; border: 4px solid #3b82f6; }
.biodata-template.geometric .bio-section { margin-bottom: 30px; background: rgba(255,255,255,0.9); padding: 20px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.biodata-template.geometric .bio-section-title { font-size: 18px; font-weight: 700; color: #3b82f6; text-transform: uppercase; margin-bottom: 15px; }
.biodata-template.geometric .bio-grid { display: grid; grid-template-columns: 200px 1fr; gap: 15px; font-size: 15px; }
.biodata-template.geometric .bio-label { font-weight: 600; color: #334155; }

/* =========================================
   TEMPLATE 10: PREMIUM GOLD
   ========================================= */
.biodata-template.gold { padding: 40px 50px; font-family: 'Playfair Display', serif; background-color: #050505; color: #f8f9fa; position: relative; border: 12px solid #d4af37; }
.biodata-template.gold::before { content: ''; position: absolute; top: 5px; left: 5px; right: 5px; bottom: 5px; border: 1px solid rgba(212, 175, 55, 0.5); pointer-events: none; }
.biodata-template.gold .bio-header { text-align: center; margin-bottom: 40px; border-bottom: 1px solid rgba(212, 175, 55, 0.4); padding-bottom: 30px; }
.biodata-template.gold .bio-photo { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; border: 3px solid #d4af37; padding: 5px; margin-bottom: 20px; }
.biodata-template.gold .bio-title h1 { font-size: 38px; color: #d4af37; margin: 0; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.biodata-template.gold .bio-section { margin-bottom: 30px; }
.biodata-template.gold .bio-section-title { font-size: 20px; color: #d4af37; text-align: center; text-transform: uppercase; margin-bottom: 20px; letter-spacing: 3px; font-weight: 600; }
.biodata-template.gold .bio-grid { display: grid; grid-template-columns: 200px 1fr; gap: 15px; font-size: 16px; font-family: 'Inter', sans-serif; font-weight: 300; }
.biodata-template.gold .bio-label { font-weight: 600; color: #d4af37; letter-spacing: 0.5px; }


/* Mobile Modal Styles */
.mobile-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    flex-direction: column;
}

.mobile-modal.active {
    display: flex;
}

.mobile-modal-content {
    background: var(--bg-color);
    width: 100%;
    flex: 1;
    min-height: 0; /* CRITICAL: Prevents flex child from overflowing viewport */
    display: flex;
    flex-direction: column;
}

.mobile-modal-header {
    padding: 15px;
    background: var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-main);
    cursor: pointer;
}

.mobile-modal-body {
    flex: 1;
    min-height: 0; /* CRITICAL: Forces scrollbar instead of viewport overflow */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    background: #e5e7eb;
    display: block; /* Block is much safer for scroll containers than flex */
}

/* Responsive adjustments for mobile screens */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    select.form-control,
    input.form-control,
    .btn {
        max-width: 100%;
    }
}

.floating-preview-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    width: auto !important;
    z-index: 9999 !important;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    cursor: pointer;
}

@media (max-width: 768px) {
    .floating-preview-btn {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
        text-align: center;
        bottom: 15px !important;
    }
    .biodata-form-panel {
        padding-bottom: 80px !important; /* Ensure space to scroll past the floating button */
    }
}

@media print {
    /* Prevent sections or grid containers from breaking in half */
    .pdf-section, 
    .info-group, 
    .grid-row,
    tr {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        webkit-column-break-inside: avoid !important;
    }

    /* Ensure headings stay attached to their following content blocks */
    h2, h3, .section-heading {
        break-after: avoid !important;
        page-break-after: avoid !important;
    }
}
