/* ═══════════════════════════════════════════════
   CertifID PDF Builder — UI Stylesheet
   All styles for the builder interface (sidebar,
   top bar, preview area, modals, controls).
   Separate from styles.css which handles A4 PDF
   template rendering.
   ═══════════════════════════════════════════════ */


/* ── 1. Design Tokens ── */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand base — shared with Hub */
    --brand-h: 216;
    --brand-s: 79%;
    --brand-l: 48%;

    --primary-blue: hsl(var(--brand-h), var(--brand-s), var(--brand-l));
    --primary-blue-hover: hsl(var(--brand-h), var(--brand-s), 40%);
    --light-blue: hsl(var(--brand-h), 50%, 72%);
    --lighter-blue: hsl(var(--brand-h), 50%, 96%);
    --text-dark: hsl(var(--brand-h), 28%, 16%);
    --text-medium: hsl(var(--brand-h), 7%, 34%);
    --text-light: hsl(var(--brand-h), 7%, 46%);
    --border-light: hsl(var(--brand-h), 10%, 91%);
    --bg-white: #ffffff;
    --bg-light: hsl(var(--brand-h), 12%, 97%);

    /* Typography */
    --font-h: 'Thicccboi', system-ui, sans-serif;
    --font-b: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}


/* ── 2. Reset & Base ── */

body {
    font-family: var(--font-b);
    background: var(--bg-white);
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}


/* ── 3. Layout — Control Panel (Sidebar) ── */

.control-panel {
    width: 360px !important;
    height: 100vh;
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    padding: 0 !important;
    box-shadow: 8px 0 25px rgba(0, 0, 0, 0.05) !important;
    border-radius: 0 !important;
    transform: none !important;
}


/* ── 4. Layout — Top Bar ── */

.top-bar {
    height: 60px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: var(--bg-white);
    animation: slideDown 0.4s ease-out;
    animation-fill-mode: backwards;
    flex-shrink: 0;
}

.file-info {
    display: flex;
    align-items: center;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}


/* ── 5. Layout — Preview Area ── */

.main-content {
    flex: 1;
    margin-left: 340px;
    margin-right: -20px;
    margin-top: -20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: calc(100% - 340px);
}

.preview-area {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    background: var(--bg-light);
    animation: slideDown 0.5s ease-out;
    animation-fill-mode: backwards;
    overflow: auto;
    position: relative;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.preview-area::-webkit-scrollbar { display: none; }

/* Template container + zoom levels */
#template-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100%;
    padding: 80px 0;
}

#template-container.zoom-50,
#template-container.zoom-70,
#template-container.zoom-100 {
    align-items: center;
    min-height: 100%;
}

#template-container .a4-container {
    transform: scale(1);
    transform-origin: top center;
    margin: 0;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

#template-container.zoom-50  .a4-container { transform: scale(0.5); }
#template-container.zoom-70  .a4-container { transform: scale(0.7); }
#template-container.zoom-100 .a4-container { transform: scale(1); }
#template-container.zoom-125 .a4-container { transform: scale(1.25); }
#template-container.zoom-150 .a4-container { transform: scale(1.5); }


/* ── 6. Panel Header & Scrollable ── */

.panel-header {
    padding: 36px 32px 32px;
    animation: slideDown 0.1s ease-out;
    border-bottom: 1px solid var(--border-light);
}

.panel-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.panel-back-link:hover {
    color: var(--primary-blue-hover);
}

.logo-mark {
    width: 32px;
    height: 32px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-mark img {
    width: 100%;
    height: 100%;
}

.panel-title {
    font-family: var(--font-h);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 400;
    letter-spacing: -0.01em;
}

.panel-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}
.panel-scrollable::-webkit-scrollbar { display: none; }

.panel-content {
    padding: 0 32px 32px;
}


/* ── 7. Sections & Form Fields ── */

.section {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-light);
    animation: slideDown 0.2s ease-out;
    animation-fill-mode: backwards;
}

.section:nth-child(1) { animation-delay: 0.1s; }
.section:nth-child(2) { animation-delay: 0.15s; }
.section:nth-child(3) { animation-delay: 0.2s; }
.section:last-child    { border-bottom: none; }

.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

.form-field {
    margin-bottom: 16px;
}
.form-field:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 8px;
}

.field-label-row {
    min-height: 21px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.field-label-row .field-label {
    margin-bottom: 0;
}

.field-usage-helper {
    position: relative;
    display: none;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.field-usage-helper.is-visible {
    display: inline-flex;
}

.field-usage-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
    color: var(--text-light);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: default;
    transition: color 0.15s;
}

.field-usage-trigger:hover,
.field-usage-helper:focus-within .field-usage-trigger {
    color: var(--primary-blue);
}

.field-usage-trigger i {
    font-size: 13px;
}

.field-usage-tooltip,
.export-disabled-tooltip {
    position: absolute;
    z-index: 1000;
    width: 248px;
    padding: 10px 11px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    background: var(--bg-white);
    color: var(--text-medium);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.field-usage-tooltip {
    right: 0;
    bottom: calc(100% + 8px);
    transform: translateY(-2px);
}

.field-usage-helper:hover .field-usage-tooltip,
.field-usage-helper:focus-within .field-usage-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    background: var(--bg-white);
}

.form-input:hover {
    border-color: var(--light-blue);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px hsl(var(--brand-h), var(--brand-s), 92%);
    background: var(--bg-white);
}


/* ── 8. Radio Groups (Ghost Glow) ── */

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-option {
    flex: 1;
    position: relative;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-label {
    display: block;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
    color: var(--text-medium);
}

.radio-option input[type="radio"]:checked + .radio-label {
    border-color: hsl(var(--brand-h), 50%, 82%);
    color: var(--primary-blue);
    box-shadow: 0 0 0 3px hsl(var(--brand-h), var(--brand-s), 94%);
}

.radio-label:hover {
    border-color: hsl(var(--brand-h), 50%, 82%);
}


/* ── 9. Custom Dropdown (Format) ── */

.custom-select {
    position: relative;
}

.custom-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    background: var(--bg-white);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select-trigger:hover {
    border-color: hsl(var(--brand-h), 50%, 82%);
}

.custom-select.open .custom-select-trigger {
    border-color: hsl(var(--brand-h), 50%, 82%);
    box-shadow: 0 0 0 3px hsl(var(--brand-h), var(--brand-s), 94%);
}

.custom-select-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--lighter-blue);
    color: var(--primary-blue);
    font-size: 14px;
    flex-shrink: 0;
}

.custom-select-text {
    flex: 1;
    text-align: left;
}

.custom-select-arrow {
    font-size: 16px;
    color: var(--text-light);
    transition: transform 0.2s;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 200;
    padding: 4px;
    animation: dropdownFadeIn 0.15s ease;
}

.custom-select.open .custom-select-options {
    display: block;
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-medium);
    transition: background 0.12s;
}

.custom-select-option i:first-child {
    font-size: 16px;
    color: var(--text-light);
    width: 20px;
    text-align: center;
}

.custom-select-option span {
    flex: 1;
    text-align: left;
}

.custom-select-check {
    font-size: 16px;
    color: var(--primary-blue);
    opacity: 0;
}

.custom-select-option.selected .custom-select-check { opacity: 1; }

.custom-select-option.selected {
    color: var(--primary-blue);
    background: var(--lighter-blue);
}

.custom-select-option.selected i:first-child {
    color: var(--primary-blue);
}

.custom-select-option:hover:not(.selected) {
    background: var(--bg-light);
}


/* ── 10. Color Picker ── */

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.color-button:hover {
    border-color: var(--primary-blue);
    transform: scale(1.05);
}

.color-picker-input {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    cursor: pointer;
    border: none;
}


/* ── 11. File Upload ── */

.file-upload {
    position: relative;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 16px;
    border: 1px dashed var(--border-light);
    border-radius: var(--r-sm);
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    background: var(--bg-white);
}

.file-upload:hover .file-upload-label {
    border-color: var(--primary-blue);
    background: var(--lighter-blue);
    color: var(--primary-blue);
}

.file-upload-label i {
    font-size: 18px;
    vertical-align: -3px;
    margin-right: 6px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.file-upload:hover .file-upload-label i {
    opacity: 1;
}


/* ── 12. Export Options & Footer ── */

.action-footer {
    padding: 32px;
    border-top: 1px solid var(--border-light);
    animation: slideDown 0.35s ease-out;
    animation-fill-mode: backwards;
    flex-shrink: 0;
}

.export-options {
    border-bottom: none;
}

/* Hide legacy control-group from old UI */
.control-group {
    display: none;
}


/* ── 13. Primary Button ── */

.primary-button {
    width: 100%;
    padding: 13px 24px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-button:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px hsl(var(--brand-h), var(--brand-s), 70%, 0.3);
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.export-button-wrap {
    position: relative;
    width: 100%;
    display: flex;
}

.export-disabled-tooltip {
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translate(-50%, -2px);
}

.export-button-wrap.is-disabled:hover .export-disabled-tooltip,
.export-button-wrap.is-disabled:focus-within .export-disabled-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.primary-button:disabled,
.primary-button.is-disabled {
    background: hsl(var(--brand-h), 10%, 86%);
    color: hsl(var(--brand-h), 7%, 50%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.primary-button:disabled:hover,
.primary-button.is-disabled:hover {
    background: hsl(var(--brand-h), 10%, 84%);
    box-shadow: none;
    transform: none;
}

.export-button-wrap.is-disabled .primary-button {
    pointer-events: none;
}


/* ── 14. Zoom Controls (Floating Pill) ── */

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 4px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.zoom-button {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 16px;
    transition: all 0.15s ease;
}

.zoom-button:hover {
    background: var(--lighter-blue);
    color: var(--primary-blue);
}

.zoom-button:active {
    transform: scale(0.92);
}

.zoom-button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    color: var(--text-light);
}

.zoom-button:disabled:hover {
    background: transparent;
    color: var(--text-light);
}

.zoom-value {
    font-size: 12px;
    color: var(--text-medium);
    min-width: 38px;
    text-align: center;
}


/* ── 15. File Badge (Soft Fill) ── */

.file-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--lighter-blue);
    border: 1px solid hsl(var(--brand-h), 30%, 86%);
    border-radius: 6px;
    font-size: 11px;
    color: var(--primary-blue);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
}

.file-badge i { font-size: 13px; }


/* ── 16. Custom Scrollbar (Sidebar + Preview) ── */

/* Sidebar scrollbar track */
.custom-scrollbar-track {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 3px;
    width: 4px;
    z-index: 10;
    pointer-events: none;
}

/* Sidebar scrollbar thumb */
.custom-scrollbar-thumb {
    position: absolute;
    right: 0;
    width: 100%;
    border-radius: 2px;
    background: hsla(var(--brand-h), 10%, 78%, 0.3);
    opacity: 0;
    transition: opacity 0.35s ease;
    min-height: 20px;
}
.custom-scrollbar-thumb.visible { opacity: 1; }

/* Preview scrollbar track */
.preview-scrollbar-track {
    position: absolute;
    top: 4px;
    bottom: 4px;
    right: 3px;
    width: 4px;
    z-index: 10;
    pointer-events: none;
}

/* Preview scrollbar thumb */
.preview-scrollbar-thumb {
    position: absolute;
    right: 0;
    width: 100%;
    border-radius: 2px;
    background: hsla(var(--brand-h), 10%, 78%, 0.3);
    opacity: 0;
    transition: opacity 0.35s ease;
    min-height: 20px;
}
.preview-scrollbar-thumb.visible { opacity: 1; }


/* ── 17. Modals (Export + Logo) ── */

/* Export modal overlay */
.export-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}

.export-modal {
    background: var(--bg-white);
    border-radius: var(--r-lg);
    width: 520px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    animation: modalSlideUp 0.3s ease;
    overflow: hidden;
}

.export-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border-light);
}

.export-icon {
    width: 48px;
    height: 48px;
    background: var(--lighter-blue);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.export-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary-blue);
    stroke-width: 2;
}

.export-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.export-subtitle {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
}

.export-content {
    padding: 24px 32px;
}

.instruction-list {
    list-style: none;
    counter-reset: step-counter;
    margin: 0;
    padding: 0;
}

.instruction-item {
    position: relative;
    padding-left: 36px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-medium);
    line-height: 1.6;
    counter-increment: step-counter;
}

.instruction-item::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 2px;
    width: 24px;
    height: 24px;
    background: var(--lighter-blue);
    color: var(--primary-blue);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.instruction-item strong {
    color: var(--text-dark);
    font-weight: 500;
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.checkbox-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    margin-right: 10px;
    transition: all 0.15s ease;
    position: relative;
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkbox-custom {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: 13px;
    color: var(--text-medium);
    user-select: none;
}

.export-actions {
    padding: 24px 32px;
    background: var(--bg-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Shared modal button base */
.modal-btn {
    padding: 10px 20px;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    border: none;
}

.modal-btn-secondary {
    background: var(--bg-white);
    color: var(--text-medium);
    border: 1px solid var(--border-light);
}

.modal-btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--light-blue);
}

.modal-btn-primary {
    background: var(--primary-blue);
    color: white;
}

.modal-btn-primary:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px hsl(var(--brand-h), var(--brand-s), 70%, 0.3);
}

/* Logo container transition */
.logo-container {
    transition: opacity 0.1s ease-in-out;
}

/* Logo modal */
.logo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.logo-modal.active {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

.logo-modal-content {
    background: var(--bg-white);
    border-radius: var(--r-lg);
    width: 640px;
    max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: modalSlideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.logo-modal-header {
    padding: 28px 32px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.logo-modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.logo-modal-header p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.logo-modal-body {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.logo-modal-body::-webkit-scrollbar { width: 2px; }
.logo-modal-body::-webkit-scrollbar-track { background: transparent; }
.logo-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 1px;
}

.logo-section {
    margin-bottom: 24px;
}

.logo-section-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.logo-aspect-buttons {
    display: flex;
    gap: 12px;
}

.logo-aspect-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    background: var(--bg-white);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-medium);
}

.logo-aspect-btn:hover {
    border-color: var(--light-blue);
    background: var(--bg-light);
}

.logo-aspect-btn.active {
    background: var(--lighter-blue);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.logo-aspect-btn small {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.logo-aspect-btn.active small {
    color: var(--primary-blue);
    opacity: 0.8;
}

.logo-zoom-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-zoom-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-medium);
    font-size: 18px;
}

.logo-zoom-btn:hover {
    border-color: var(--light-blue);
    background: var(--bg-light);
    color: var(--primary-blue);
}

#logo-zoom-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-light);
    border-radius: 2px;
    outline: none;
}

#logo-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

#logo-zoom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(21, 111, 190, 0.3);
}

.logo-zoom-value {
    min-width: 45px;
    text-align: right;
    font-size: 13px;
    color: var(--text-medium);
    font-weight: 500;
}

.logo-canvas-container {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-sm);
    min-height: 200px;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

#logo-crop-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.logo-modal-actions {
    padding: 24px 32px;
    background: var(--bg-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Shared logo button base */
.logo-btn {
    padding: 10px 20px;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    border: none;
}

.logo-btn-secondary {
    background: var(--bg-white);
    color: var(--text-medium);
    border: 1px solid var(--border-light);
}

.logo-btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--light-blue);
}

.logo-btn-primary {
    background: var(--primary-blue);
    color: white;
}

.logo-btn-primary:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px hsl(var(--brand-h), var(--brand-s), 70%, 0.3);
}


/* ── 18. Animations ── */

@keyframes slideDown {
    0%   { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── 19. Print Styles ── */

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    body * {
        visibility: hidden;
    }

    #template-container,
    #template-container *,
    .a4-container,
    .a4-container * {
        visibility: visible;
    }

    .control-panel { display: none !important; }
    .top-bar       { display: none !important; }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .preview-area {
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }

    #template-container {
        margin: 0 !important;
        padding: 0 !important;
    }

    .a4-container,
    #template-container .a4-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        transform-origin: top left !important;
    }

    @page agent-protection-page {
        size: 8.5in 11in;
        margin: 0;
    }

    .agent-protection-theme {
        page: agent-protection-page;
    }

    .a4-container.agent-protection-theme,
    #template-container .a4-container.agent-protection-theme {
        width: 8.5in !important;
        height: 11in !important;
        overflow: visible !important;
    }

    @page one-pager-letter-page {
        size: 8.5in 11in;
        margin: 0;
    }

    .one-pager-letter {
        page: one-pager-letter-page;
    }

    .a4-container.one-pager-letter,
    #template-container .a4-container.one-pager-letter {
        width: 8.5in !important;
        height: 11in !important;
        overflow: hidden !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    .logo-container {
        box-shadow: none !important;
    }
}
