/* Common Styles */
:root {
    --primary-color: #004D40; /* For form buttons/highlights */
    --secondary-color: #f4f4f9; /* Body background */
    --text-color: #333;
    --template-bg: #fff8e1; /* Default A4 background (Light Beige) */
    --template-accent: #d8572a; /* Default A4 accent/border color (Saffron/Orange) */
}

body {
    font-family: 'Arial', sans-serif;
    background-color:linear-gradient(45deg, #D82B93, #4F35A6);
    margin: 0;
    padding: 20px;
    color: var(--text-color);
}

.container {
    max-width: 1400px; 
    margin: auto;
    background: white;
    padding: 30px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    display: flex; 
    flex-wrap: nowrap; /* Prevent wrapping in desktop view */
    gap: 30px; 
    align-items: flex-start; 
    position: relative; 
}

/* --- Watermark Gap Container --- */
.watermark-gap {
    flex-grow: 1; /* यह खाली जगह को ले लेगा */
    position: relative;
    min-width: 30px; 
    max-width: 100px; 
    align-self: stretch; /* Stretch to the full height of the container */
}

/* Watermark as a pseudo-element inside the new gap container */
.watermark-gap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    
    /* Apple Laptop with 'tools24' text */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 350'><rect x='50' y='100' width='400' height='200' rx='15' ry='15' fill='#cccccc'/><rect x='180' y='300' width='140' height='10' rx='3' ry='3' fill='#aaaaaa'/><path d='M 100 100 L 400 100 L 400 300 L 100 300 Z' fill='#999999'/><rect x='65' y='115' width='370' height='170' rx='5' ry='5' fill='#111111'/><text x='250' y='200' font-family='Arial, sans-serif' font-weight='bold' font-size='50' fill='#00ff00' text-anchor='middle' dominant-baseline='middle'>tools24</text></svg>");
    
    background-size: contain; 
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15; 
    pointer-events: none; 
    z-index: 0; 
}

/* Hide watermark when input-area is hidden */
.container.biodata-finalized .watermark-gap {
    display: none;
}


/* --- Input and Customization Area --- */
.input-area {
    /* Fixed width for input area */
    flex: 0 0 550px; 
    min-width: 550px; 
    z-index: 1; 
}

.customization-panel {
    background: #e0f2f1; /* Lighter background for customization */
    border: 1px solid #b2dfdb;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.customization-panel h3 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}

.template-section, .color-selectors {
    margin-bottom: 15px;
}

.form-group-inline {
    display: inline-block;
    margin-right: 20px;
}
.form-group-inline label {
    font-weight: bold;
    color: #444;
}

/* Template Cards */
.template-preview-container { 
    display: flex; 
    gap: 15px; 
    margin-top: 10px; 
}
.template-card { 
    border: 2px solid #ccc; 
    border-radius: 8px; 
    padding: 10px; 
    cursor: pointer; 
    transition: all 0.2s; 
    width: 100px; 
    text-align: center; 
    font-size: 0.8em; 
}
.template-card.selected { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 8px var(--primary-color); 
    background-color: #c8e6c9; /* Light green highlight */
}
.template-card .preview-box { width: 80px; height: 60px; border: 1px solid #aaa; margin: 0 auto 5px auto; border-radius: 4px; overflow: hidden; position: relative; }
.template-card .preview-box::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 8px; }
.template-card .preview-box::after { content: ''; position: absolute; top: 8px; left: 0; width: 100%; height: calc(100% - 8px); }

/* Template Colors for Previews */
.template-card.hindu-beige .preview-box::before { background: #d8572a; }
.template-card.hindu-beige .preview-box::after { background: #fff8e1; }
.template-card.muslim-green .preview-box::before { background: #004D40; }
.template-card.muslim-green .preview-box::after { background: #e8f5e9; }
.template-card.muslim-blue .preview-box::before { background: #1565C0; }
.template-card.muslim-blue .preview-box::after { background: #e3f2fd; }

/* Form Styles */
.input-form h1 {
    color: var(--primary-color); /* Added primary color for consistency */
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-size: 1.8em;
}
.input-form h2 {
    color: #4CAF50; /* Section title color */
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    margin-top: 25px;
    font-size: 1.2em;
}

.form-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-section.full-width {
    grid-template-columns: 1fr;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Hindu specific fields will be shown/hidden by JS, maintaining grid on 'show' */
.hindu-specific {
    display: grid; 
}


/* Buttons */
.button-group {
    text-align: center;
    margin-top: 30px;
    z-index: 1; 
}

.button-group button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.button-group button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#generate-btn {
    background-color: var(--primary-color);
    color: white;
    margin-right: 15px;
}

#download-btn {
    background-color: #2196F3;
    color: white;
    display: none; /* Hidden by default */
}


/* =======================================
    A4 Biodata Output Presentation
    ======================================= */
#biodata-output {
    flex-shrink: 0; 
    /* A4 Size (210mm x 297mm) */
    width: 210mm; 
    min-height: 297mm; 
    
    padding: 25mm 20mm; 
    border: 5mm solid var(--template-accent);
    background: var(--template-bg);
    box-sizing: border-box;
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
    display: block; 
    
    margin: 0; 
    z-index: 1; 
}

.top-color-bar {
    height: 10px;
    background-color: var(--template-accent);
    margin: -25mm -20mm 25px -20mm; /* Cover full width of A4 top */
}

.biodata-header {
    text-align: center;
    padding: 10px 0 20px 0;
}

.biodata-header h2 {
    margin: 0;
    font-size: 1.5em; /* Mantra size */
    color: var(--template-accent);
    font-family: 'Georgia', serif;
}
.biodata-header h1 {
    font-size: 2.2em; /* Main title size */
    margin: 5px 0 0 0;
    color: #333;
    letter-spacing: 2px;
    border-bottom: 3px double #ccc;
    display: inline-block;
    padding-bottom: 5px;
}

.biodata-content {
    display: flex;
    padding: 15px 0;
    align-items: flex-start;
}

.details-section {
    flex-grow: 1;
    padding-right: 30px; 
}

.details-section h3 {
    color: var(--template-accent);
    font-size: 1.3em; 
    border-bottom: 2px solid var(--template-accent);
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 15px;
    font-weight: 700;
}
.details-section h3:first-child {
    margin-top: 0;
}

.detail-row {
    display: flex;
    margin-bottom: 6px;
    line-height: 1.4;
    font-size: 0.95em; 
}

.detail-row span:first-child {
    font-weight: bold;
    width: 170px; 
    min-width: 170px;
    color: #555;
}

/* Photo Section */
.photo-section {
    width: 200px; 
    min-width: 200px;
    text-align: center;
}

#biodata-photo {
    width: 180px; 
    height: 220px; 
    border: 5px solid var(--template-accent);
    border-radius: 8px; /* Square photo for better A4 presentation */
    object-fit: cover;
    margin-top: 10px;
    background-color: #f0f0f0;
}

/* Mobile Responsiveness */
@media (max-width: 1300px) {
    .container {
        flex-direction: column; /* Stacks items vertically on smaller screens */
        align-items: center;
        max-width: 794px; /* Approx A4 width */
    }

    .input-area {
        flex: 1 1 auto;
        min-width: 90%; 
        width: 100%;
    }

    .watermark-gap {
        display: none; /* Hide watermark on mobile view */
    }

    #biodata-output {
        min-width: 210mm; 
        margin-top: 20px;
    }
}
