/* Template Picker, Steps & Biodata Designs */

/* ---- Step Indicator ---- */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.step {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
}

.step em {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-style: normal;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--color-cream-dark);
    color: var(--color-text-muted);
}

.step.active {
    color: var(--color-primary);
}

.step.active em {
    background: var(--color-primary);
    color: white;
}

.step.done {
    color: var(--color-success);
}

.step.done em {
    background: var(--color-success);
    color: white;
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--color-border);
    margin: 0 0.5rem;
}

/* ---- Template Picker ---- */
.page-header-templates {
    padding-bottom: 2rem;
}

.page-header-templates-choose {
    padding: 1.25rem 0 1rem;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
}

.templates-step-bar {
    max-width: 42rem;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    background: var(--color-cream);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.templates-step-indicator {
    margin-bottom: 0;
}

.templates-step-indicator .step {
    font-size: 0.82rem;
    font-weight: 600;
}

.templates-step-indicator .step em {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
}

.templates-step-indicator .step-line {
    width: 2.5rem;
    margin: 0 0.4rem;
    background: rgba(12, 74, 110, 0.15);
}

.templates-return-hint-choose {
    margin: 0.85rem auto 0;
    max-width: 42rem;
    text-align: center;
}

@media (max-width: 576px) {
    .page-header-templates-choose {
        padding: 1rem 0 0.75rem;
    }

    .templates-step-bar {
        padding: 0.75rem 0.85rem;
        border-radius: var(--radius-lg);
    }

    .templates-step-indicator .step {
        font-size: 0.75rem;
    }

    .templates-step-indicator .step em {
        width: 26px;
        height: 26px;
        font-size: 0.72rem;
    }

    .templates-step-indicator .step-line {
        width: 1.25rem;
        margin: 0 0.25rem;
    }
}

.page-header-templates-browse {
    padding: 2.25rem 0 1rem;
    background: linear-gradient(180deg, var(--color-cream) 0%, var(--color-white) 100%);
    border-bottom: 1px solid var(--color-border);
}

.templates-choose-hero {
    max-width: 42rem;
    margin: 0 auto;
    text-align: center;
}

.page-header-templates-browse h1 {
    font-family: var(--font-display);
    font-size: clamp(1.85rem, 4vw, 2.35rem);
    line-height: 1.15;
    margin: 0;
    color: var(--color-text);
}

.template-picker-choose {
    padding-top: 2rem;
}

.template-picker-choose .template-browse-featured-head,
.template-picker-choose .template-browse-toolbar-text {
    text-align: left;
}

.template-picker-choose .template-section-title {
    font-family: var(--font-display);
    font-size: 1.45rem;
    margin: 0 0 0.35rem;
}

.template-picker-choose .template-section-desc {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.template-picker-choose .template-browse-toolbar {
    align-items: flex-end;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.template-picker-choose .template-filters {
    margin-bottom: 0;
    justify-content: flex-end;
}

.template-picker-choose .template-carousel-card,
.template-picker-choose .template-grid-browse-card {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.template-picker-choose .template-grid-browse {
    gap: 1.5rem;
}

.biodata-export-iframe {
    position: fixed !important;
    left: -10000px !important;
    top: 0 !important;
    border: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.biodata-export-source-wrap {
    position: absolute;
    left: -10000px;
    top: 0;
    width: 900px;
    pointer-events: none;
    z-index: -1;
    overflow: visible;
}

.template-picker-section {
    padding: 0 0 4rem;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.75rem;
}

.template-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s, box-shadow 0.25s;
}

.template-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.template-card-current {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(139, 41, 66, 0.18), var(--shadow-md);
}

.templates-return-hint {
    margin-top: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius);
    background: #eef8f2;
    border: 1px solid #c8e8d4;
    color: #1f6b43;
    font-size: 0.9rem;
}

.template-preview-wrap {
    position: relative;
    padding: 1.25rem;
    background: var(--color-cream);
}

.template-tag {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--color-gold);
    color: var(--color-text);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.template-card-info {
    padding: 1.25rem 1.5rem 1.5rem;
}

.template-card-info h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--color-primary);
    margin-bottom: 0.35rem;
}

.template-card-info p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* ---- Browse: horizontal carousel (2–3 cards visible) ---- */
.template-picker-carousel {
    padding-bottom: 3rem;
}

.template-carousel {
    display: flex;
    align-items: stretch;
    gap: 0.65rem;
}

.template-carousel-viewport {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.template-carousel-track {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0.35rem 0.25rem 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) transparent;
}

.template-carousel-track::-webkit-scrollbar {
    height: 6px;
}

.template-carousel-track::-webkit-scrollbar-thumb {
    background: rgba(139, 41, 66, 0.35);
    border-radius: 999px;
}

.template-carousel-nav {
    flex-shrink: 0;
    align-self: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-primary);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.template-carousel-nav:hover {
    background: var(--color-primary);
    color: #fff;
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.template-carousel-card {
    flex: 0 0 calc((100% - 3rem) / 2.5);
    min-width: 300px;
    max-width: 400px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s, transform 0.25s;
}

.template-carousel-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.template-carousel-preview {
    position: relative;
    padding: 1rem;
    background: linear-gradient(165deg, #ebe6e0 0%, #f7f4f0 100%);
}

.template-carousel-preview .template-live-preview-wrap {
    height: 480px;
    margin: 0;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.1);
}

.template-carousel-preview .template-live-preview-scaler {
    transform: scale(0.46);
}

.template-carousel-hover {
    position: absolute;
    inset: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    background: rgba(30, 18, 22, 0.62);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    z-index: 4;
}

.template-carousel-card:hover .template-carousel-hover,
.template-carousel-card:focus-within .template-carousel-hover {
    opacity: 1;
    visibility: visible;
}

.template-carousel-hover .btn {
    min-width: 180px;
    justify-content: center;
}

.template-carousel-hover .btn-outline {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-primary);
    border-color: transparent;
}

.template-carousel-details {
    padding: 1.15rem 1.35rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.template-details-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.template-carousel-details h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.25;
}

.template-details-desc {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    margin: 0;
}

.template-details-specs {
    margin: 0.35rem 0 0;
    padding: 0.75rem 0 0;
    border-top: 1px solid var(--color-border);
    display: grid;
    gap: 0.55rem;
}

.template-details-spec {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.template-details-spec dt {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin: 0;
}

.template-details-spec dd {
    margin: 0;
    font-size: 0.86rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.template-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
    display: inline-block;
}

.template-details-print {
    font-size: 0.75rem;
    color: var(--color-success);
    font-weight: 600;
}

.template-carousel-hint {
    text-align: center;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: 0.75rem;
}

@media (max-width: 1100px) {
    .template-carousel-card {
        flex: 0 0 calc((100% - 1.5rem) / 2);
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .template-carousel {
        gap: 0.35rem;
    }

    .template-carousel-nav {
        width: 36px;
        height: 36px;
        font-size: 1.35rem;
    }

    .template-carousel-card {
        flex: 0 0 88%;
        min-width: 0;
        max-width: none;
    }

    .template-carousel-preview .template-live-preview-wrap {
        height: 400px;
    }

    .template-carousel-preview .template-live-preview-scaler {
        transform: scale(0.44);
    }

    .template-carousel-hover {
        opacity: 1;
        visibility: visible;
        background: rgba(30, 18, 22, 0.45);
    }
}

/* Mini preview mockups */
.template-preview {
    aspect-ratio: 3/4;
    max-height: 280px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.template-preview-sm {
    max-height: 160px;
    margin-bottom: 1rem;
}

.preview-header {
    height: 28%;
    flex-shrink: 0;
}

.preview-body {
    flex: 1;
    padding: 10px;
    display: flex;
    gap: 8px;
}

.preview-photo {
    width: 32%;
    border-radius: 4px;
    flex-shrink: 0;
}

.preview-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 4px;
}

.preview-lines span {
    height: 6px;
    border-radius: 3px;
    opacity: 0.5;
}

.preview-lines span:nth-child(1) { width: 90%; }
.preview-lines span:nth-child(2) { width: 70%; }
.preview-lines span:nth-child(3) { width: 85%; }
.preview-lines span:nth-child(4) { width: 60%; }

.tpl-preview-classic .preview-header { background: linear-gradient(135deg, #8B2942, #6B1F33); }
.tpl-preview-classic .preview-body { background: #FFFDF9; }
.tpl-preview-classic .preview-photo { background: #C9A227; }
.tpl-preview-classic .preview-lines span { background: #8B2942; }

.tpl-preview-modern .preview-header { background: #1B3A4B; }
.tpl-preview-modern .preview-body { background: #F4F8FA; }
.tpl-preview-modern .preview-photo { background: #2D6A7E; border-radius: 50%; }
.tpl-preview-modern .preview-lines span { background: #1B3A4B; }

.tpl-preview-royal .preview-header { background: linear-gradient(180deg, #2C0A1A, #4A1028); }
.tpl-preview-royal .preview-body { background: #1A0810; }
.tpl-preview-royal .preview-photo { background: #D4AF37; border: 2px solid #D4AF37; border-radius: 50%; }
.tpl-preview-royal .preview-lines span { background: #D4AF37; }

.tpl-preview-floral .preview-header { background: linear-gradient(135deg, #E8B4B8, #F5D0C5); }
.tpl-preview-floral .preview-body { background: #FFFAF8; }
.tpl-preview-floral .preview-photo { background: #D4848A; border-radius: 50%; }
.tpl-preview-floral .preview-lines span { background: #C97B84; }

.tpl-preview-minimal .preview-header { background: #111; }
.tpl-preview-minimal .preview-body { background: #fff; }
.tpl-preview-minimal .preview-photo { background: #ddd; }
.tpl-preview-minimal .preview-lines span { background: #333; }

/* Create layout sidebar */
.create-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

.form-sidebar {
    position: sticky;
    top: 90px;
}

.selected-template-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.selected-template-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--color-primary);
    margin-bottom: 0.35rem;
}

.selected-template-card p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.form-main {
    min-width: 0;
}

/* View page — download & share */
.view-download-page {
    padding: 2rem 0 4rem;
    min-height: 50vh;
}

.view-download-container {
    max-width: 560px;
    margin: 0 auto;
}

.view-download-steps {
    margin-bottom: 1.75rem;
}

.view-success-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    text-align: center;
}

.view-success-card-header {
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(180deg, var(--color-cream) 0%, var(--color-white) 100%);
    border-bottom: 1px solid var(--color-border);
}

.view-success-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #e6f6ee;
    color: #0d7a4d;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 52px;
}

.view-success-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}

.view-success-name {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

.view-success-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.view-template-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    background: rgba(12, 74, 110, 0.08);
    color: var(--color-primary);
}

.view-success-note {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    max-width: 28rem;
    line-height: 1.5;
    margin: 0;
}

.view-success-card-body {
    padding: 1.75rem 2rem;
}

.view-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 260px;
    padding: 0.9rem 1.75rem;
    font-size: 1.05rem;
}

.view-download-btn-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.view-download-hint {
    margin: 0.85rem 0 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.view-download-locked {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.view-success-card-footer {
    padding: 1.5rem 2rem;
    background: var(--color-cream);
    border-top: 1px solid var(--color-border);
    text-align: left;
}

.view-share-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 0.35rem;
}

.view-share-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0 0 1rem;
    line-height: 1.5;
}

.view-share-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.view-share-input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    background: #fff;
    color: var(--color-text);
    font-family: ui-monospace, 'Cascadia Code', monospace;
}

.view-copy-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.view-share-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.view-share-meta code {
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.view-share-meta-sep {
    opacity: 0.5;
}

.view-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    padding: 1.25rem 2rem 1.75rem;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 576px) {
    .view-success-card-header,
    .view-success-card-body,
    .view-success-card-footer,
    .view-secondary-actions {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .view-share-box {
        flex-direction: column;
    }

    .view-copy-btn {
        width: 100%;
    }

    .view-download-btn {
        width: 100%;
        min-width: 0;
    }
}

/* Sharable biodata preview page */
.biodata-share-page {
    padding: 2.5rem 0 4rem;
    background: linear-gradient(180deg, var(--color-cream) 0%, var(--color-bg, #f8f6f3) 45%);
    min-height: 55vh;
}

.biodata-share-container {
    max-width: 920px;
    margin: 0 auto;
}

.biodata-share-document {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.biodata-share-document .bio-custom-wrap,
.biodata-share-document .bio-tpl {
    margin: 0;
}

.biodata-share-brand {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    .biodata-share-page {
        padding: 1.25rem 0 3rem;
    }

    .biodata-share-document {
        border-radius: var(--radius-lg);
    }
}

/* View page */
.view-section-templates {
    padding: 2rem 0 4rem;
}

.view-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem 1.25rem;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.view-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.view-template-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-cream);
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

.biodata-render-wrap {
    max-width: 900px;
    margin: 0 auto;
}

/* Shared template utilities */
.bio-tpl {
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}

.tpl-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tpl-photo:not(.tpl-photo-placeholder) {
    position: relative;
    overflow: hidden;
}

.tpl-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
}

.tpl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.tpl-table th,
.tpl-table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tpl-table th {
    width: 40%;
    font-weight: 600;
    color: inherit;
    opacity: 0.75;
}

.tpl-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.92rem;
}

.tpl-row:last-child {
    border-bottom: none;
}

.tpl-label {
    font-weight: 600;
    opacity: 0.75;
    flex-shrink: 0;
}

.tpl-value {
    text-align: right;
}

.tpl-row-block {
    flex-direction: column;
    gap: 0.25rem;
}

.tpl-row-block .tpl-value {
    text-align: left;
}

/* ---- CLASSIC TEMPLATE ---- */
.bio-tpl-classic {
    border: 3px solid #C9A227;
    background: #FFFDF9;
}

.bio-classic-top {
    background: linear-gradient(135deg, #8B2942 0%, #6B1F33 100%);
    color: white;
    text-align: center;
    padding: 2rem 1.5rem 1.75rem;
}

.bio-classic-ornament {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.bio-classic-name {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.bio-classic-sub {
    opacity: 0.9;
    font-size: 1rem;
}

.bio-classic-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    padding: 2rem;
}

.bio-classic-photo-col {
    text-align: center;
    padding-right: 1.5rem;
    border-right: 2px solid #E8D48B;
}

.bio-classic-photo {
    width: 180px;
    height: 220px;
    margin: 0 auto 1rem;
    border: 4px solid #C9A227;
    border-radius: 4px;
    overflow: hidden;
    background: #f0e6dc;
}

.bio-classic-photo.tpl-photo-placeholder {
    font-size: 3rem;
    color: #8B2942;
    background: linear-gradient(135deg, #f5ebe0, #e8d5c4);
}

.bio-classic-badge {
    display: inline-block;
    background: #8B2942;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 1rem;
    border-radius: 20px;
}

.bio-classic-content {
    padding-left: 2rem;
}

.bio-classic-section {
    margin-bottom: 1.75rem;
}

.bio-classic-section h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: #8B2942;
    margin-bottom: 0.75rem;
}

.bio-classic-section h2 span {
    border-bottom: 2px solid #C9A227;
    padding-bottom: 0.2rem;
}

.bio-classic-section .tpl-table th {
    color: #6B5344;
    background: #FDF8F3;
}

.bio-classic-text-block {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #2C1810;
}

.bio-classic-text-block strong {
    display: block;
    color: #8B2942;
    margin-bottom: 0.25rem;
}

.bio-classic-footer {
    text-align: center;
    padding: 1rem;
    background: #FDF8F3;
    border-top: 1px solid #E8D48B;
    font-size: 0.8rem;
    color: #6B5344;
}

/* ---- MODERN TEMPLATE ---- */
.bio-tpl-modern {
    background: #F4F8FA;
    padding: 0;
}

.bio-modern-header {
    background: linear-gradient(135deg, #1B3A4B, #2D6A7E);
    color: white;
    padding: 2.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.bio-modern-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.bio-modern-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 0.35rem;
}

.bio-modern-meta {
    opacity: 0.9;
    font-size: 0.95rem;
}

.bio-modern-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
}

.bio-modern-photo.tpl-photo-placeholder {
    font-size: 2.5rem;
    color: white;
}

.bio-modern-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 2rem;
}

.bio-modern-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 12px rgba(27, 58, 75, 0.08);
}

.bio-modern-card-wide {
    grid-column: 1 / -1;
}

.bio-modern-card h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #2D6A7E;
    margin-bottom: 0.85rem;
    font-weight: 700;
}

.bio-modern-card .tpl-label {
    color: #1B3A4B;
}

.bio-modern-para {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #2C3E50;
}

/* ---- ROYAL TEMPLATE ---- */
.bio-tpl-royal {
    background: #1A0810;
    padding: 1.5rem;
}

.bio-royal-frame {
    border: 3px double #D4AF37;
    padding: 6px;
}

.bio-royal-inner {
    border: 1px solid #D4AF37;
    background: linear-gradient(180deg, #2C0A1A 0%, #1A0810 100%);
    color: #F5E6C8;
    padding: 2rem;
}

.bio-royal-header {
    text-align: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    margin-bottom: 2rem;
}

.bio-royal-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid #D4AF37;
    margin: 0 auto 1rem;
    overflow: hidden;
    background: rgba(212, 175, 55, 0.15);
}

.bio-royal-photo.tpl-photo-placeholder {
    font-size: 2.75rem;
    color: #D4AF37;
}

.bio-royal-crown {
    font-size: 1.5rem;
    color: #D4AF37;
    margin-bottom: 0.5rem;
}

.bio-royal-header h1 {
    font-family: var(--font-display);
    font-size: 2.25rem;
    color: #D4AF37;
    margin-bottom: 0.35rem;
}

.bio-royal-header p {
    opacity: 0.85;
}

.bio-royal-place {
    color: #D4AF37;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.bio-royal-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.bio-royal-block h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: #D4AF37;
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.bio-royal-block .tpl-table th {
    color: #C9A227;
    background: rgba(212, 175, 55, 0.08);
}

.bio-royal-block .tpl-table td {
    color: #F5E6C8;
}

.bio-royal-note {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    line-height: 1.6;
}

.bio-royal-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    display: grid;
    gap: 1.5rem;
}

.bio-royal-bottom h2 {
    font-family: var(--font-display);
    color: #D4AF37;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.bio-royal-bottom p {
    line-height: 1.7;
    opacity: 0.9;
}

/* ---- FLORAL TEMPLATE ---- */
.bio-tpl-floral {
    background: #FFFAF8;
    position: relative;
    padding: 2.5rem 2rem;
    border: 1px solid #F0D5D0;
}

.bio-floral-deco {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0.15;
    background: radial-gradient(circle, #D4848A 30%, transparent 70%);
    border-radius: 50%;
}

.bio-floral-deco-tl { top: 1rem; left: 1rem; }
.bio-floral-deco-br { bottom: 1rem; right: 1rem; }

.bio-floral-header {
    text-align: center;
    margin-bottom: 2rem;
}

.bio-floral-tag {
    font-size: 0.85rem;
    color: #C97B84;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.bio-floral-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid #E8B4B8;
    margin: 0 auto 1.25rem;
    overflow: hidden;
    background: #F5E0DC;
}

.bio-floral-photo.tpl-photo-placeholder {
    font-size: 3rem;
    color: #C97B84;
}

.bio-floral-header h1 {
    font-family: var(--font-display);
    font-size: 2.1rem;
    color: #8B4A52;
    margin-bottom: 0.25rem;
}

.bio-floral-header p {
    color: #A66B72;
}

.bio-floral-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #F5E0DC;
}

.bio-floral-section h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: #C97B84;
    margin-bottom: 0.85rem;
}

.bio-floral-section .tpl-label {
    color: #A66B72;
}

.bio-floral-para {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #5C3D42;
}

/* ---- MINIMAL TEMPLATE ---- */
.bio-tpl-minimal {
    padding: 3rem;
    background: white;
    border: 1px solid #e0e0e0;
}

.bio-minimal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
}

.bio-minimal-eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #888;
    margin-bottom: 0.5rem;
}

.bio-minimal-header h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    color: #111;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.bio-minimal-sub {
    color: #666;
    font-size: 0.95rem;
}

.bio-minimal-photo {
    width: 100px;
    height: 100px;
    border-radius: 2px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}

.bio-minimal-photo.tpl-photo-placeholder {
    font-size: 2rem;
    color: #999;
}

.bio-minimal-divider {
    height: 3px;
    background: #111;
    margin-bottom: 2rem;
}

.bio-minimal-group {
    margin-bottom: 2rem;
}

.bio-minimal-group h2 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #111;
    margin-bottom: 1rem;
    font-weight: 700;
}

.bio-minimal-dl-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}

.bio-minimal-dl-row dt {
    font-weight: 600;
    color: #888;
}

.bio-minimal-dl-row dd {
    color: #222;
    margin: 0;
}

.bio-minimal-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #333;
    max-width: 65ch;
}

/* Same-page print mode */
@media print {
    html.is-biodata-printing .site-header,
    html.is-biodata-printing .site-footer,
    html.is-biodata-printing .no-print,
    html.is-biodata-printing .view-toolbar,
    html.is-biodata-printing .alert,
    html.is-biodata-printing .step-indicator,
    html.is-biodata-printing .preview-panel,
    html.is-biodata-printing .preview-panel-header,
    html.is-biodata-printing .preview-template-bar,
    html.is-biodata-printing .preview-quick-edit,
    html.is-biodata-printing .preview-watermark,
    html.is-biodata-printing .preview-loading,
    html.is-biodata-printing .preview-score-overlay,
    html.is-biodata-printing .preview-frame-wrap::before,
    html.is-biodata-printing .editor-form-col,
    html.is-biodata-printing .editor-mobile-actions,
    html.is-biodata-printing .mobile-preview-modal,
    html.is-biodata-printing .preview-fullscreen-modal,
    html.is-biodata-printing .preview-template-modal,
    html.is-biodata-printing .photo-modal {
        display: none !important;
    }

    html.is-biodata-printing .editor-preview-col,
    html.is-biodata-printing .editor-section {
        display: block !important;
    }

    html.is-biodata-printing .editor-form-col,
    html.is-biodata-printing .page-header {
        display: none !important;
    }

    html.is-biodata-printing .editor-grid {
        display: block !important;
    }

    html.is-biodata-printing .preview-frame-wrap,
    html.is-biodata-printing .preview-doc-shadow,
    html.is-biodata-printing .preview-phone-screen,
    html.is-biodata-printing .preview-stage {
        min-height: 0 !important;
        max-height: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        overflow: visible !important;
        filter: none !important;
        box-shadow: none !important;
    }

    html.is-biodata-printing .preview-frame {
        overflow: visible !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
}

.biodata-export-clone-holder {
    display: none !important;
}

/* ---- Print ---- */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .site-header,
    .site-footer,
    .no-print,
    .view-toolbar,
    .view-toolbar-actions,
    .alert,
    .step-indicator,
    .preview-watermark,
    .preview-loading,
    .preview-panel,
    .preview-frame-wrap::before,
    .editor-section,
    .editor-form-col,
    .editor-mobile-actions,
    .mobile-preview-modal,
    .preview-fullscreen-modal,
    .preview-template-modal,
    .photo-modal {
        display: none !important;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .view-section,
    .view-section-templates,
    .container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    .biodata-render-wrap,
    .bio-custom-wrap {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .bio-custom-wrap,
    .bio-tpl {
        overflow: visible !important;
        max-height: none !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .bio-tpl {
        border-radius: 0;
    }

    .bio-classic-body {
        grid-template-columns: 220px 1fr !important;
    }

    .bio-modern-grid,
    .bio-royal-columns {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .bio-punjabi-body,
    .bio-marathi-body {
        grid-template-columns: 200px 1fr !important;
    }

    .bio-classic-photo-col {
        border-right: 2px solid #E8D48B !important;
        border-bottom: none !important;
        padding-right: 1.5rem !important;
        margin-bottom: 0 !important;
    }

    .bio-tpl-royal {
        background: white !important;
        padding: 0;
    }

    .bio-royal-inner {
        background: white !important;
        color: #111 !important;
    }

    .bio-royal-header h1,
    .bio-royal-block h2,
    .bio-royal-bottom h2 {
        color: #333 !important;
    }

    .bio-royal-block .tpl-table td {
        color: #111 !important;
    }

    .bio-layout-two .bio-classic-section:nth-child(n+3),
    .bio-layout-two .bio-modern-card:nth-child(n+3),
    .bio-layout-two .bio-punjabi-section:nth-child(n+3),
    .bio-layout-two .bio-tamil-block:nth-child(n+3) {
        page-break-before: always;
    }
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .create-layout {
        grid-template-columns: 1fr;
    }

    .form-sidebar {
        position: static;
    }

    .bio-classic-body {
        grid-template-columns: 1fr;
    }

    .bio-classic-photo-col {
        border-right: none;
        border-bottom: 2px solid #E8D48B;
        padding-right: 0;
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .bio-classic-content {
        padding-left: 0;
    }

    .bio-modern-header {
        flex-direction: column;
        text-align: center;
    }

    .bio-royal-columns,
    .bio-modern-grid {
        grid-template-columns: 1fr;
    }

    .bio-minimal-header {
        flex-direction: column;
    }

    .bio-minimal-dl-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}

@media (max-width: 768px) {
    .view-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toolbar-actions {
        justify-content: center;
    }

    .bio-tpl-minimal,
    .bio-classic-body,
    .bio-modern-grid,
    .bio-royal-inner,
    .bio-tpl-floral {
        padding: 1.25rem;
    }

    .bio-classic-name,
    .bio-minimal-header h1 {
        font-size: 1.75rem;
    }
}

/* ---- Custom colors, fonts & layout ---- */
.bio-custom-wrap {
    font-family: var(--bio-font, 'Cormorant Garamond', Georgia, serif);
}

.bio-custom-wrap .bio-classic-top,
.bio-custom-wrap .bio-modern-header,
.bio-custom-wrap .bio-punjabi-header,
.bio-custom-wrap .bio-tamil-header,
.bio-custom-wrap .bio-marathi-header,
.bio-custom-wrap .bio-gujarati-header .bio-gujarati-border > .bio-gujarati-header {
    background: linear-gradient(135deg, var(--bio-primary), color-mix(in srgb, var(--bio-primary) 70%, #000)) !important;
}

.bio-custom-wrap .bio-classic-section h2 span,
.bio-custom-wrap .bio-classic-badge,
.bio-custom-wrap .bio-punjabi-section h2,
.bio-custom-wrap .bio-tamil-block h2,
.bio-custom-wrap .bio-marathi-sections h2,
.bio-custom-wrap .bio-gujarati-section h2 span {
    border-color: var(--bio-accent) !important;
    color: var(--bio-primary) !important;
}

.bio-custom-wrap .bio-classic-badge,
.bio-custom-wrap .bio-modern-card h2,
.bio-custom-wrap .bio-punjabi-icon {
    color: var(--bio-accent) !important;
}

.bio-custom-wrap .bio-classic-badge {
    background: var(--bio-primary) !important;
    color: #fff !important;
}

.bio-layout-two .bio-classic-content,
.bio-layout-two .bio-modern-grid,
.bio-layout-two .bio-punjabi-content,
.bio-layout-two .bio-tamil-body,
.bio-layout-two .bio-marathi-sections,
.bio-layout-two .bio-gujarati-content {
    column-count: 1;
}

.bio-layout-two .bio-classic-section:nth-child(n+3),
.bio-layout-two .bio-modern-card:nth-child(n+3),
.bio-layout-two .bio-punjabi-section:nth-child(n+3),
.bio-layout-two .bio-tamil-block:nth-child(n+3) {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--bio-accent);
}

/* Community template previews */
.tpl-preview-punjabi .preview-header { background: linear-gradient(135deg, #FF6B00, #1B8B3D); }
.tpl-preview-punjabi .preview-body { background: #FFF8F0; }
.tpl-preview-punjabi .preview-photo { background: #FF6B00; }
.tpl-preview-punjabi .preview-lines span { background: #1B8B3D; }

.tpl-preview-tamil .preview-header { background: linear-gradient(180deg, #B71C1C, #880E0E); }
.tpl-preview-tamil .preview-body { background: #FFFDE7; }
.tpl-preview-tamil .preview-photo { background: #FFD700; border-radius: 50%; }
.tpl-preview-tamil .preview-lines span { background: #B71C1C; }

.tpl-preview-marathi .preview-header { background: linear-gradient(135deg, #E65100, #FF8F00); }
.tpl-preview-marathi .preview-body { background: #FFF8E1; }
.tpl-preview-marathi .preview-photo { background: #E65100; }
.tpl-preview-marathi .preview-lines span { background: #FF8F00; }

.tpl-preview-gujarati .preview-header { background: linear-gradient(135deg, #C62828, #F9A825); }
.tpl-preview-gujarati .preview-body { background: #FFF8F0; }
.tpl-preview-gujarati .preview-photo { background: #C62828; border-radius: 50%; }
.tpl-preview-gujarati .preview-lines span { background: #F9A825; }

/* ---- PUNJABI ---- */
.bio-tpl-punjabi { background: #FFF8F0; border: 3px solid var(--bio-accent, #1B8B3D); }
.bio-punjabi-header { background: linear-gradient(135deg, #FF6B00, #1B8B3D); color: #fff; text-align: center; padding: 1.75rem; }
.bio-punjabi-icon { font-size: 2rem; color: #FFD700; }
.bio-punjabi-header h1 { font-family: var(--bio-font); font-size: 2rem; margin: 0.5rem 0; }
.bio-punjabi-body { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; padding: 1.5rem; }
.bio-punjabi-photo { width: 180px; height: 220px; border: 4px solid #FF6B00; overflow: hidden; margin: 0 auto; }
.bio-punjabi-photo.tpl-photo-placeholder { font-size: 3rem; background: #ffe0b2; color: #FF6B00; }
.bio-punjabi-section { margin-bottom: 1.25rem; }
.bio-punjabi-section h2 { color: #1B8B3D; font-size: 1.1rem; border-bottom: 2px solid #FF6B00; padding-bottom: 0.25rem; margin-bottom: 0.5rem; }
.bio-punjabi-text { font-size: 0.92rem; line-height: 1.6; }

/* ---- TAMIL ---- */
.bio-tpl-tamil { background: #FFFDE7; border: 2px solid #B71C1C; }
.bio-tamil-header { background: linear-gradient(180deg, #B71C1C, #880E0E); color: #FFD700; text-align: center; padding: 2rem 1.5rem; }
.bio-tamil-kolam { font-size: 1.5rem; opacity: 0.8; }
.bio-tamil-header h1 { font-family: var(--bio-font); font-size: 2rem; color: #fff; margin: 0.5rem 0; }
.bio-tamil-header p { color: #FFECB3; }
.bio-tamil-body { padding: 1.5rem; }
.bio-tamil-photo-wrap { text-align: center; margin-bottom: 1.5rem; }
.bio-tamil-photo { width: 140px; height: 140px; border-radius: 50%; border: 4px solid #FFD700; margin: 0 auto; overflow: hidden; display: inline-flex; }
.bio-tamil-photo.tpl-photo-placeholder { font-size: 2.5rem; background: #FFCDD2; color: #B71C1C; }
.bio-tamil-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.bio-tamil-block h2 { color: #B71C1C; font-size: 1rem; margin-bottom: 0.5rem; }
.bio-tamil-full { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #FFCDD2; }
.bio-tamil-full h2 { color: #B71C1C; margin-bottom: 0.35rem; }

/* ---- MARATHI ---- */
.bio-tpl-marathi { background: #FFF8E1; }
.bio-marathi-header { background: linear-gradient(135deg, #E65100, #FF8F00); color: #fff; text-align: center; padding: 1.75rem; }
.bio-marathi-tag { font-size: 0.9rem; letter-spacing: 0.1em; opacity: 0.9; }
.bio-marathi-header h1 { font-family: var(--bio-font); font-size: 2rem; margin: 0.35rem 0; }
.bio-marathi-layout { display: grid; grid-template-columns: 180px 1fr; gap: 1.5rem; padding: 1.5rem; }
.bio-marathi-photo { width: 160px; height: 200px; border: 3px solid #E65100; overflow: hidden; }
.bio-marathi-photo.tpl-photo-placeholder { font-size: 2.5rem; background: #FFE0B2; color: #E65100; }
.bio-marathi-sections section { margin-bottom: 1.25rem; }
.bio-marathi-sections h2 { color: #E65100; font-size: 1.05rem; margin-bottom: 0.5rem; }

/* ---- GUJARATI ---- */
.bio-tpl-gujarati { padding: 1rem; background: #FFF8F0; }
.bio-gujarati-border { border: 3px double #C62828; padding: 4px; }
.bio-gujarati-header { background: linear-gradient(135deg, #C62828, #F9A825); color: #fff; text-align: center; padding: 1.75rem; }
.bio-gujarati-photo { width: 130px; height: 130px; border-radius: 50%; border: 4px solid #F9A825; margin: 0 auto 1rem; overflow: hidden; }
.bio-gujarati-photo.tpl-photo-placeholder { font-size: 2.5rem; background: rgba(255,255,255,0.2); color: #fff; }
.bio-gujarati-header h1 { font-family: var(--bio-font); font-size: 1.85rem; }
.bio-gujarati-content { padding: 1.25rem; }
.bio-gujarati-section { margin-bottom: 1.25rem; }
.bio-gujarati-section h2 span { color: #C62828; border-bottom: 2px solid #F9A825; padding-bottom: 0.2rem; }
.bio-gujarati-note { font-size: 0.92rem; margin-top: 0.5rem; }

@media (max-width: 768px) {
    .bio-punjabi-body, .bio-marathi-layout, .bio-tamil-grid { grid-template-columns: 1fr; }
}

/* ---- Template picker: live HTML previews with sample data ---- */
.template-live-preview-wrap {
    position: relative;
    height: 340px;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(165deg, #e8e4df 0%, #f5f2ee 100%);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.template-live-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.72);
    z-index: 2;
    transition: opacity 0.2s;
}

.template-live-preview-loading[hidden],
.template-live-preview-wrap.is-loaded .template-live-preview-loading {
    display: none !important;
}

.template-live-preview-scaler {
    width: 794px;
    flex-shrink: 0;
    margin: 0;
    transform: scale(0.38);
    transform-origin: top center;
    pointer-events: none;
    user-select: none;
    will-change: transform;
}

.template-live-preview-wrap.is-loaded .template-live-preview-scaler {
    position: relative;
    z-index: 1;
}

.template-live-preview-scaler .bio-custom-wrap,
.template-live-preview-scaler .bio-tpl {
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

/* Keep profile photos visible inside scaled previews */
.template-live-preview-scaler .tpl-photo img,
.template-live-preview-scaler [class*="-photo"] img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.template-live-preview-scaler .tpl-photo:not(.tpl-photo-placeholder),
.template-live-preview-scaler [class*="-photo"]:not(.tpl-photo-placeholder) {
    position: relative;
    overflow: hidden;
    background-color: #f0e6dc;
}

.template-picker-browse {
    padding-top: 1.25rem;
}

.templates-return-hint-inline {
    margin: 0 0 1.25rem;
}

.template-browse-featured {
    margin-bottom: 2rem;
}

.template-browse-featured-head {
    margin-bottom: 0.85rem;
}

.template-browse-featured .template-section-title {
    margin: 0;
}

.template-browse-more {
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.template-browse-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 1.25rem;
}

.template-browse-toolbar-text {
    flex: 1;
    min-width: 200px;
}

.template-browse-toolbar .template-filters {
    margin: 0;
    flex-shrink: 0;
}

.template-browse-toolbar .template-section-desc {
    margin-bottom: 0;
}

.template-filter-empty {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    padding: 2rem 1rem;
    background: var(--color-cream);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--color-border);
}

.template-grid-browse-card .template-card-info-compact p {
    margin-bottom: 0;
}

.template-grid-browse-card .template-card-info .template-use-btn {
    display: none;
}

.template-grid-browse-card .template-zoom-btn {
    display: none;
}

.template-grid-hover {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    background: rgba(30, 18, 22, 0.62);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    z-index: 4;
}

.template-grid-browse-card:hover .template-grid-hover,
.template-grid-browse-card:focus-within .template-grid-hover {
    opacity: 1;
    visibility: visible;
}

.template-grid-hover .btn {
    min-width: 168px;
    justify-content: center;
}

.template-grid-hover .btn-outline {
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-primary);
    border-color: transparent;
}

.template-carousel-autoplay .template-carousel-track {
    scroll-behavior: smooth;
}

@media (max-width: 768px) {
    .template-browse-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .template-browse-toolbar .template-filters {
        justify-content: flex-start;
    }

    .template-grid-hover {
        opacity: 1;
        visibility: visible;
        background: rgba(30, 18, 22, 0.45);
    }
}

.template-section-title {
    font-family: var(--font-display);
    font-size: 1.65rem;
    color: var(--color-primary);
    margin: 0 0 0.35rem;
}

.template-section-desc {
    font-size: 0.92rem;
    color: var(--color-text-muted);
    margin: 0 0 1.25rem;
}

.template-grid-browse {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.template-grid-browse .template-preview-wrap {
    padding: 1rem;
}

.template-grid-browse .template-live-preview-wrap {
    height: 360px;
}

.template-grid-browse .template-live-preview-scaler {
    transform: scale(0.4);
}

.template-live-preview-scaler .bio-classic-body,
.template-live-preview-scaler .bio-modern-grid,
.template-live-preview-scaler .bio-punjabi-body,
.template-live-preview-scaler .bio-marathi-body {
    font-size: 0.92rem;
}

.template-modal-content {
    max-width: 760px;
    width: 100%;
}

.template-modal-preview-wrap {
    margin: 1rem 0;
    max-height: 62vh;
    overflow: auto;
    background: #f3f0eb;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 1rem;
}

.template-modal-preview-scaler {
    width: 820px;
    max-width: 100%;
    margin: 0 auto;
    transform-origin: top center;
}

.template-modal-preview-scaler .bio-custom-wrap {
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .template-live-preview-wrap {
        height: 300px;
    }

    .template-live-preview-scaler {
        transform: scale(0.34);
    }

    .template-modal-content {
        max-width: 100%;
    }
}

/* Legacy SVG previews (small thumbs) */
.template-preview-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    aspect-ratio: 280 / 380;
    object-fit: cover;
    background: #f0ebe4;
    transition: opacity 0.2s;
}

.template-preview-wrap {
    position: relative;
}

.template-zoom-btn {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transition: opacity 0.2s;
}

.template-card:hover .template-zoom-btn {
    opacity: 1;
}

.template-cat-badge {
    font-size: 0.7rem;
    background: var(--color-cream-dark);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    color: var(--color-text-muted);
}

/* Template preview modal */
.template-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.template-modal[hidden] { display: none; }

.template-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.template-modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 760px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.template-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.template-modal-img {
    width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: var(--shadow-md);
}

/* Biodata template frame */
.bio-custom-wrap .bio-tpl {
    border: var(--bio-border, 2px solid var(--bio-accent));
    border-radius: var(--bio-radius, 12px);
    overflow: hidden;
}

/* Modern template variants */
.bio-variant-modern_ocean .bio-modern-header { background: linear-gradient(135deg, #0077B6, #00B4D8) !important; }
.bio-variant-modern_slate .bio-modern-header { background: linear-gradient(135deg, #334155, #64748B) !important; }
.bio-variant-modern_gradient .bio-modern-header { background: linear-gradient(135deg, #6366F1, #A855F7) !important; }
.bio-variant-modern_card .bio-modern-header { background: linear-gradient(135deg, #0F172A, #3B82F6) !important; }
.bio-variant-modern_bold .bio-minimal-header h1 { color: #0A0A0A; }
.bio-variant-modern_bold .bio-minimal-divider { background: #FACC15; }
.bio-variant-modern_rose .bio-modern-header { background: linear-gradient(135deg, #9D174D, #F472B6) !important; }

/* Community / heritage variants on classic base */
.bio-variant-bengali .bio-classic-top { background: linear-gradient(135deg, #D32F2F, #B71C1C) !important; }
.bio-variant-kerala .bio-classic-top { background: linear-gradient(135deg, #1B5E20, #2E7D32) !important; }
.bio-variant-odia .bio-classic-top { background: linear-gradient(135deg, #BF360C, #E64A19) !important; }
.bio-variant-bihari .bio-classic-top { background: linear-gradient(135deg, #5D4037, #795548) !important; }
.bio-variant-heritage .bio-classic-top { background: linear-gradient(135deg, #5C3317, #8B4513) !important; }
.bio-variant-telugu .bio-tamil-header { background: linear-gradient(180deg, #F9A825, #C62828) !important; }
.bio-variant-rajasthani .bio-royal-inner { background: linear-gradient(180deg, #E91E63, #FF9800) !important; color: #fff; }
.bio-variant-assamese .bio-floral-header { background: linear-gradient(135deg, #C62828, #fff) !important; }

@media (max-width: 768px) {
    .template-zoom-btn { opacity: 1; }
}
