.diploma-builder-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    box-sizing: border-box;
}

.diploma-builder-container * {
    box-sizing: border-box;
}

/* 2-Column Layout */
.diploma-builder-container .builder-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.diploma-builder-container .builder-form-col {
    width: 380px;
    flex-shrink: 0;
}

.diploma-builder-container .builder-preview-col {
    flex: 1;
    min-width: 0;
}

.diploma-builder-container .preview-sticky-wrapper {
    position: sticky;
    top: 20px;
    display: flex;
    justify-content: center;
}

/* Outer box that can resize responsively */
.diploma-builder-container .diploma-preview-wrap {
    width: 100%;
    max-width: 720px;
    flex-shrink: 0;
    min-width: 0;
    padding: 100px 0;
    /* Expansion room for shadows */
    overflow: visible !important;
}

/* This container will visually scale the fixed canvas */
.diploma-builder-container .diploma-preview-stage {
    width: 100%;
    overflow: visible !important;
    /* CRITICAL: Prevent frame clipping */
    background: transparent;
    /* Clean look for frame */
    position: relative;
}

@media (max-width: 1100px) {
    .diploma-builder-container .builder-layout {
        flex-direction: column;
    }

    .diploma-builder-container .builder-form-col {
        width: 100%;
    }

    .diploma-builder-container .preview-sticky-wrapper {
        position: static;
    }
}

/* Form Styles */
.diploma-builder-container .builder-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 25px;
}

.diploma-builder-container h3 {
    margin-top: 0;
    color: #1a202c;
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

.diploma-builder-container .form-group {
    margin-bottom: 20px;
}

.diploma-builder-container label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8em;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
}

.diploma-builder-container input[type="text"],
.diploma-builder-container select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 15px;
    background: #fff;
    font-family: inherit;
}

.diploma-builder-container .form-row {
    display: flex;
    gap: 15px;
}

.diploma-builder-container .form-group.half {
    flex: 1;
}

.diploma-builder-container .date-row {
    display: flex;
    gap: 8px;
}

.diploma-builder-container .date-row select {
    flex: 1;
}

.diploma-builder-container .form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
}

.nav-buttons {
    display: flex;
    gap: 12px;
}

.diploma-builder-container .btn-primary {
    background: #1e4d77;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.diploma-builder-container .btn-secondary {
    background: #718096;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: 600;
}

.diploma-builder-container .btn-link {
    color: #e53e3e;
    background: none;
    border: none;
    cursor: pointer;
}

.diploma-builder-container .hidden {
    display: none;
}

.diploma-builder-container .step-indicator {
    margin-bottom: 25px;
}

.diploma-builder-container .progress-bar {
    height: 8px;
    background: #edf2f7;
    border-radius: 4px;
    overflow: hidden;
}

.diploma-builder-container .progress-fill {
    height: 100%;
    background: #1e4d77;
    transition: width 0.4s ease;
}

/* Radio Group Horizontal */
.diploma-builder-container .radio-group-horizontal {
    display: flex;
    gap: 20px;
    padding: 10px 0;
}

.diploma-builder-container .radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-transform: none;
    font-size: 14px;
    color: #333;
}

.diploma-builder-container .radio-label input {
    margin: 0;
}

/* Custom Font Loading */
@font-face {
    font-family: 'Canterbury';
    src: url('../fonts/Canterbury.ttf') format('truetype');
}

@font-face {
    font-family: 'OriginalScript';
    src: url('../fonts/OriginalScript.ttf') format('truetype');
}

/* Form Step Visibility */
.form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.form-step.active-step {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* DIPLOMA PAPER */
.diploma-builder-container .preview-card {
    padding: 0;
    border: none;
    background: transparent;
}

.diploma-builder-container .preview-header {
    display: none;
}

.diploma-builder-container .diploma-paper {
    position: relative !important;
    display: block !important;
    width: 1100px !important;
    min-width: 1100px !important;
    max-width: none !important;
    height: 850px !important;
    min-height: 850px !important;
    max-height: none !important;
    flex-shrink: 0 !important;
    background: linear-gradient(135deg, #fdfbf7 0%, #f4eacc 100%);
    box-shadow: 5px 10px 30px rgba(0, 0, 0, 0.15);
    margin: 0 !important;
    border: 1px solid #d4c5a0 !important;
    font-size: 20px !important;
    overflow: hidden !important;
    transform-origin: center center !important;
}


/* Container for content */
.diploma-content {
    position: absolute;
    top: 60px;
    bottom: 60px;
    left: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    color: #1a1a1a;
    font-family: 'OriginalScript', cursive;
    line-height: 1.2 !important;
    z-index: 100;
    /* Ensure content is ALWAYS on top */
}

.diploma-content>* {
    margin: 0 !important;
}

/* -- Typography Helper Classes -- */
.font-blackletter {
    font-family: 'Canterbury', serif;
}

.font-script {
    font-family: 'OriginalScript', cursive;
}

/* -- Header Section -- */
.pv-header-small {
    font-family: 'Canterbury', serif;
    font-size: 1.8em;
    margin: 0;
    line-height: 1.2;
    align-self: center;
}

.pv-label-script {
    font-family: 'OriginalScript', cursive;
    font-size: 1.9em !important;
    color: #444;
    line-height: 1.2 !important;
}

#pv-degree-label {
    margin: 0;
    line-height: 1.2;
}

#pv-university {
    font-family: 'Canterbury', serif;
    font-size: 2.8em !important;
    color: #000;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
    line-height: 1.2 !important;
}

/* -- Student Name -- */
#pv-name {
    font-family: 'Canterbury', serif;
    font-size: 2.0em !important;
    color: #000;
    line-height: 1.2 !important;
}

/* -- Degree Details -- */
#pv-degree {
    font-family: 'Canterbury', serif;
    font-size: 2.0em;
    margin: 0;
    line-height: 1.2;
}

#pv-honors {
    font-family: 'Canterbury', serif;
    font-size: 1.4em;
    margin: 0;
}

/* -- Body Text Block -- */
.pv-body-text {
    font-family: 'OriginalScript', cursive !important;
    font-size: 1.65em;
    color: #333;
    max-width: 85%;
    margin: 0;
    line-height: 1.25;
    align-self: center;
}

/* -- Date Block -- */
.pv-date-block {
    font-family: 'OriginalScript', cursive;
    font-size: 1.3em;
    /* Increased from 1.4em */
    margin: 0.2em 0;
}

/* -- Footer Grid -- */
.pv-footer-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 0.6fr 1fr;
    grid-template-rows: auto auto;
    /* Reduced to 2 rows */
    gap: 0.8em 1em;
    /* Good vertical gap */
    align-items: end;
    margin-bottom: 0;
    align-self: end;
}

/* Signature Alignment - Center text over lines for both sides */
.pv-sig-left {
    grid-column: 1;
    text-align: left;
}

.pv-sig-right {
    grid-column: 3;
    text-align: right;
}

/* Explicit Row Assignments to guarantee vertical alignment */
.pv-sig-left:nth-child(1) {
    grid-row: 1;
}

.pv-sig-left:nth-child(2) {
    grid-row: 2;
}

.pv-sig-right:nth-child(4) {
    grid-row: 1;
}

.pv-sig-right:nth-child(5) {
    grid-row: 2;
}

.pv-seal-center {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: center;
    margin-bottom: 1em;
    z-index: 10;
    position: relative;
}

/* Ensure secretary is centered and doesn't overlap seal */
.pv-sig-bottom-center {
    grid-column: 2;
    grid-row: 3;
    /* Move to Row 3 */
    text-align: center;
    margin-top: 0.5em;
    position: relative;
}

.cis-sig {
    font-family: 'Great Vibes', cursive;
    font-size: 1.4em;
    /* Reduced signature size */
    border-bottom: 1px solid #555;
    padding-bottom: 0;
    margin-bottom: 0.1em;
    color: #000;
    white-space: nowrap;
    width: 100%;
}

.cis-title {
    font-family: 'Canterbury', serif;
    /* Matches reference photo titles which are blocky/blackletter-ish */
    font-size: 0.65em;
    /* Slightly smaller to prevent wrap */
    color: #444;
    white-space: nowrap;
}

/* Seal Slider */
.seal-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    padding: 0 5px;
}

.seal-slider-track {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px;
    width: 100%;
    /* Hide scrollbar */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
    cursor: grab;
    /* Indicate draggable */
}

/* Hide scrollbar for Chrome/Safari/Opera */
.seal-slider-track::-webkit-scrollbar {
    display: none;
}

.seal-slider-track.active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
    user-select: none;
}

.seal-option {
    flex: 0 0 auto;
    /* Don't shrink */
    cursor: pointer;
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #f7fafc;
}

.seal-option input {
    display: none;
}

.seal-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    /* Prevent image drag interfering with slider drag */
}

.seal-option:has(input:checked) {
    border-color: #1e4d77;
    box-shadow: 0 0 0 3px rgba(30, 77, 119, 0.2);
    transform: scale(1.05);
}

.slider-arrow {
    background: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1e4d77;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    z-index: 2;
}

.slider-arrow:hover {
    background: #edf2f7;
    border-color: #1e4d77;
}

.slider-arrow:active {
    transform: scale(0.95);
}

/* Step 4 Config Rows */
.sig-config-row {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.sig-config-row:last-child {
    border-bottom: none;
}

.sig-label {
    font-weight: 700;
    font-size: 0.85em;
    color: #2d3748;
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Updated Seal Preview (Image Based) */
.seal-img-element {
    width: 6em;
    height: 6em;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

/* Remove old seal-inner styles if they conflict, but grid placement remains */

/* Updated Signature Preview (Image Based) */
.cis-sig-container {
    height: 2.2em;
    /* Fixed height for alignment */
    display: flex;
    align-items: flex-end;
    /* Bottom align signature on the line */
    width: 100%;
    border-bottom: 1px solid #555;
    /* The line itself */
    margin-bottom: 0.2em;
}

.pv-sig-left .cis-sig-container {
    justify-content: flex-start;
}

.pv-sig-right .cis-sig-container {
    justify-content: flex-end;
}

.cis-sig-img {
    height: 90%;
    /* Fit within container */
    width: auto;
    object-fit: contain;
    padding-bottom: 2px;
}

/* -- Layout Toggle Utilities -- */
.pv-footer-grid.layout-2-sigs .pv-sig-left:nth-child(2),
.pv-footer-grid.layout-2-sigs .pv-sig-right:nth-child(5) {
    display: none;
}

/* Container-First Framing Architecture */
#diploma-scaling-box {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 1100px;
    height: 850px;
    transition: none;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.is-framed-mode #diploma-scaling-box {
    width: 1250px;
    height: 1000px;
    background-image: url("../images/frame-wood-v2.png");
}

/* The diploma paper is the CORE design element */
.diploma-paper {
    width: 1100px;
    height: 850px;
    background: url("../images/parchment.png") repeat !important;
    background-color: #fcf8e3 !important;
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}

/* When framed, we ensure the paper sits elegantly inside the window */
.is-framed-mode .diploma-paper {
    transform: scale(0.78);
    /* Fits perfectly within the new frame's window */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: none !important;
}

.frame-image-layer {
    display: none !important;
    /* Retired legacy approach */
}

.is-framed-mode .diploma-content {
    /* Ensure content is perfectly proportional inside the paper */
    transform: none !important;
    z-index: 30;
    position: absolute;
    top: 60px;
    bottom: 60px;
    left: 40px;
    right: 40px;
}

/* Step 3: Product Choice & Proofing */
.step-desc {
    font-size: 0.9em;
    color: #64748b;
    margin-bottom: 20px;
}

.product-selection-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.product-option-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.product-option-card:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
}

.product-option-card:has(input:checked) {
    border-color: #1e4d77;
    background: #f0f7ff;
}

.product-info {
    display: flex;
    flex-direction: column;
}

.product-name {
    font-weight: 700;
    font-size: 1.05em;
    color: #1e293b;
}

.product-price {
    color: #1e4d77;
    font-weight: 600;
    font-size: 0.95em;
}

.proof-section {
    border-top: 2px dashed #e2e8f0;
    padding-top: 20px;
    margin-top: 20px;
}

.proof-section h4 {
    margin-top: 0;
    font-size: 1.1em;
    color: #1e293b;
}

.proof-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 15px;
}

.proof-status {
    font-size: 0.85em;
    color: #1e4d77;
    font-weight: 600;
}

.view-proof-link {
    color: #1e4d77;
    text-decoration: underline;
    font-weight: 600;
    font-size: 0.95em;
}

.btn-primary:disabled {
    background: #cbd5e0 !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

/* Proof Modal Styles */
.proof-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.proof-modal-overlay.active {
    display: flex !important;
}

.proof-modal-container {
    background: #fff;
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.proof-modal-header {
    padding: 15px 20px;
    background: #1e4d77;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.proof-modal-header h5 {
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.proof-modal-body {
    overflow: auto;
    padding: 20px;
    background: #f0f0f0;
}

.proof-modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}