/* ============================================================
   HOMEPAGE PRINT EDITOR STYLES
   ============================================================ */

/* Main Editor Section */
.he-section {
    max-width: 2000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.he-section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.he-section-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 32px;
    font-size: 1.1rem;
}

/* Drop Zone */
#heDropSection {
    width: 100%;
}

.he-drop-zone {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
    margin-bottom: 32px;
}

.he-drop-zone:hover,
.he-drop-zone.drag-over {
    border-color: var(--primary-color, #007bff);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.12);
}

.he-drop-zone .drop-icon {
    font-size: 3rem;
    color: #aaa;
    margin-bottom: 16px;
    display: block;
}

.he-drop-zone:hover .drop-icon,
.he-drop-zone.drag-over .drop-icon {
    color: var(--primary-color, #007bff);
}

.he-drop-zone .drop-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.he-drop-zone .drop-subtitle {
    color: #888;
    font-size: 0.95rem;
}

.he-drop-zone .drop-formats {
    margin-top: 12px;
    color: #aaa;
    font-size: 0.85rem;
}

/* File loaded state - compact drop zone */
#heDropSection.file-loaded .he-drop-zone {
    padding: 16px;
    border-style: solid;
    border-color: #28a745;
    background: #f0fff4;
}

#heDropSection.file-loaded .he-drop-zone .drop-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: #28a745;
}

#heDropSection.file-loaded .he-drop-zone .drop-title {
    font-size: 1rem;
    margin-bottom: 4px;
}

#heDropSection.file-loaded .he-drop-zone .drop-subtitle,
#heDropSection.file-loaded .he-drop-zone .drop-formats {
    display: none;
}

/* Editor Panel (hidden until file loaded) */
.he-editor-panel {
    display: none;
    gap: 24px;
    margin-top: 24px;
}

.he-editor-panel.active {
    display: grid;
    grid-template-columns: 1fr 340px;
}

/* Preview Area */
.he-preview-area {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 16px;
    position: relative;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.he-preview-container {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

.he-preview-container canvas#hePreviewCanvas {
    display: block;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.he-preview-container canvas#heFabricCanvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Format Badge */
.he-format-badge {
    display: inline-block;
    padding: 6px 16px;
    background: #e8e8e8;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
}

.he-format-badge.detected {
    background: var(--primary-color, #007bff);
    color: white;
}

/* Page Navigation */
.he-page-nav {
    display: none;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 6px 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.he-page-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.he-page-nav button:hover:not(:disabled) {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
}

.he-page-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.he-page-info {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    min-width: 80px;
    text-align: center;
}

/* Editor Toolbar */
.he-editor-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    flex-wrap: wrap;
    align-items: center;
}



.he-toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0 6px;
    border-right: 1px solid #e0e0e0;
}

.he-toolbar-group:last-child {
    border-right: none;
}

.he-btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.he-btn-icon:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #bbb;
    color: #222;
}

.he-btn-icon:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.he-btn-icon.he-btn-danger:hover:not(:disabled) {
    background: #fee;
    border-color: #e53935;
    color: #e53935;
}

/* Font controls in toolbar */
.he-font-controls select {
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 8px;
    font-size: 0.82rem;
    max-width: 140px;
    background: white;
}

.he-font-controls input[type="number"] {
    width: 52px;
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 6px;
    font-size: 0.82rem;
    text-align: center;
}

.he-font-controls input[type="color"] {
    width: 34px;
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    background: white;
}

/* File List */
.he-file-list {
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #eee;
}

.he-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    border-bottom: 1px solid #eee;
}

.he-file-item:last-child {
    border-bottom: none;
}

.he-file-item i {
    color: #888;
}

.he-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.he-file-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 0.7rem;
}

.he-file-remove:hover {
    background: #fee;
    color: #e53935;
}

.he-file-item.active-page {
    background: #e8f4fd;
    border-left: 3px solid #1976d2;
}

.he-file-add-page {
    padding: 6px 10px;
    border-top: 1px dashed #ddd;
}

.he-btn-add-page {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 5px 8px;
    border: 1px dashed #1976d2;
    background: transparent;
    color: #1976d2;
    border-radius: 4px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}

.he-btn-add-page:hover {
    background: #e3f2fd;
}

/* Modal */
.he-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.he-modal {
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.he-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.he-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.he-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #888;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.he-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.he-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.he-modal-empty {
    text-align: center;
    color: #888;
    padding: 30px 0;
}

/* Project Items */
.he-project-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.he-project-item:hover {
    border-color: #bbb;
}

.he-project-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.he-project-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.he-project-thumb i {
    font-size: 1.5rem;
    color: #ccc;
}

.he-project-info {
    flex: 1;
    min-width: 0;
}

.he-project-info strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.he-project-info span {
    font-size: 0.8rem;
    color: #888;
}

.he-project-actions {
    display: flex;
    gap: 6px;
}

.he-project-actions button,
.he-order-actions button {
    width: 34px;
    height: 34px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #555;
}

.he-btn-load:hover {
    background: #e3f2fd;
    border-color: #42a5f5;
    color: #1976d2;
}

.he-btn-delete:hover {
    background: #fee;
    border-color: #e53935;
    color: #e53935;
}

/* Order Items */
.he-order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
}

.he-order-item:hover {
    border-color: #bbb;
}

.he-order-info {
    flex: 1;
}

.he-order-info strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.he-order-info span {
    display: block;
    font-size: 0.8rem;
    color: #888;
}

.he-order-date {
    font-size: 0.75rem !important;
    color: #aaa !important;
}

.he-order-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.he-btn-reorder,
.he-btn-reorder-new {
    width: auto !important;
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    gap: 4px;
}

.he-btn-reorder:hover,
.he-btn-reorder-new:hover {
    background: #e8f5e9 !important;
    border-color: #4caf50 !important;
    color: #2e7d32 !important;
}

/* Config Panel (right sidebar) */
.he-config-panel {
    display: none;
}

.he-config-panel.active {
    display: block;
}

.he-config-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 24px;
    position: sticky;
    top: 20px;
}

.he-config-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 20px;
    color: #1a1a1a;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

/* Form Groups */
.he-form-group {
    margin-bottom: 16px;
}

.he-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.he-form-group select,
.he-form-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.he-form-group select:focus,
.he-form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Price Display */
.he-price-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #f0f0f0;
}

.he-price-total {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color, #007bff);
    margin: 0 0 4px;
    text-align: center;
}

.he-price-unit {
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    margin-bottom: 12px;
}

.he-price-details {
    font-size: 0.85rem;
    color: #666;
}

.he-price-details .price-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.he-price-details .price-line.total {
    border-top: 1px solid #eee;
    margin-top: 4px;
    padding-top: 8px;
    font-weight: 700;
    color: #333;
}

/* Add to Cart Button */
.he-add-to-cart {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--primary-dark, #0056b3) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.he-add-to-cart:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.he-add-to-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Status Messages */
.he-status {
    display: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    text-align: center;
}

.he-status.info {
    background: #e8f4fd;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.he-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.he-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* How It Works Steps */
.he-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.he-step {
    text-align: center;
    padding: 20px 12px;
}

.he-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color, #007bff);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 auto 12px;
}

.he-step-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.he-step-desc {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
    .he-editor-panel.active {
        grid-template-columns: 1fr;
    }

    .he-config-card {
        position: static;
    }

    .he-steps {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .he-drop-zone {
        padding: 40px 20px;
    }

    .he-section-title {
        font-size: 1.5rem;
    }

    .he-preview-area {
        min-height: 250px;
    }
}

@media (max-width: 480px) {
    .he-steps {
        grid-template-columns: 1fr;
    }

    .he-editor-panel.active {
        gap: 16px;
    }
}

/* ═══════════════════════════════════════════
   ZOOM CONTROLS
   ═══════════════════════════════════════════ */

.he-zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-secondary, #f5f5f5);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    margin-bottom: 8px;
}

.he-zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-primary, #333);
    transition: background 0.15s, border-color 0.15s;
}

.he-zoom-btn:hover {
    background: var(--accent-color, #2563eb);
    color: #fff;
    border-color: var(--accent-color, #2563eb);
}

.he-zoom-level {
    min-width: 52px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    user-select: none;
}

/* ═══════════════════════════════════════════
   CANVAS SCROLL WRAPPER (for zoomed canvas)
   ═══════════════════════════════════════════ */

.he-preview-workspace {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
}

.he-canvas-scroll-wrapper {
    overflow: auto;
    max-height: 70vh;
    border-radius: 8px;
    position: relative;
    min-width: 0;
    display: grid;
    justify-content: center;
}

/* ═══════════════════════════════════════════
   PAGE THUMBNAILS SIDEBAR
   ═══════════════════════════════════════════ */

.he-page-thumbnails {
    display: none;
    margin-top: 0;
    padding: 10px;
    background: var(--bg-secondary, #f9f9f9);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    width: 112px;
    max-height: 70vh;
}

.he-page-thumbnails h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #555);
}

.he-thumb-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    max-height: calc(70vh - 26px);
    scrollbar-gutter: stable;
}

.he-thumb-scroll::-webkit-scrollbar {
    width: 8px;
}

.he-thumb-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f0f0f0);
    border-radius: 3px;
}

.he-thumb-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-color, #2563eb);
    border-radius: 3px;
}

.he-thumb-counter {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary, #888);
    margin-top: 6px;
}

.he-thumb-item {
    flex: 0 0 auto;
    cursor: pointer;
    text-align: center;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 4px;
    transition: border-color 0.2s, box-shadow 0.2s;
    scroll-snap-align: start;
    background: var(--bg-primary, #fff);
}

.he-thumb-item:hover {
    border-color: var(--accent-color, #2563eb);
}

.he-thumb-item.active {
    border-color: var(--accent-color, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.he-thumb-item img {
    display: block;
    width: 80px;
    height: auto;
    border-radius: 4px;
}

.he-thumb-placeholder {
    width: 80px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    border-radius: 4px;
    color: #999;
    font-size: 18px;
}

.he-thumb-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin-top: 4px;
}

.he-thumb-loading {
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary, #888);
}

/* ═══════════════════════════════════════════
   COLOR INFO PANEL
   ═══════════════════════════════════════════ */

.he-color-info {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary, #f9f9f9);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
}

.he-color-info h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #555);
}

.he-color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}

.he-color-label {
    font-weight: 600;
    color: var(--text-secondary, #555);
    font-size: 12px;
}

.he-color-value {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-primary, #333);
}

.he-color-warn {
    color: #d97706;
    font-size: 12px;
    margin-top: 4px;
}

.he-color-swatches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.he-swatch {
    text-align: center;
    cursor: help;
}

.he-swatch-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.he-swatch-pct {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════
   LAYER PANEL
   ═══════════════════════════════════════════ */

.he-layer-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    overflow: hidden;
}

.he-layer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9f9f9;
}

.he-layer-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.he-layer-header h4 i {
    color: #6c63ff;
}

.he-layer-list {
    padding: 4px 0;
    max-height: 200px;
    overflow-y: auto;
}

.he-layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.he-layer-item:hover {
    background: #f5f5ff;
}

.he-layer-item.active {
    background: #eef0ff;
    border-left-color: #6c63ff;
    color: #333;
    font-weight: 600;
}

.he-layer-item .he-layer-icon {
    width: 18px;
    text-align: center;
    color: #999;
    font-size: 12px;
    flex-shrink: 0;
}

.he-layer-item.active .he-layer-icon {
    color: #6c63ff;
}

.he-layer-item .he-layer-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.he-layer-item .he-layer-preview {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
}

.he-layer-item .he-layer-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.he-layer-item:hover .he-layer-actions {
    opacity: 1;
}

.he-layer-item .he-layer-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    color: #888;
    font-size: 11px;
}

.he-layer-item .he-layer-actions button:hover {
    background: #e0e0e0;
    color: #333;
}

.he-layer-empty {
    padding: 16px 12px;
    text-align: center;
    color: #aaa;
    font-size: 12px;
    font-style: italic;
}

.he-btn-sm {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════
   FOLD TYPE SELECTOR
   ═══════════════════════════════════════════ */

.he-fold-info {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.3;
}

/* ═══════════════════════════════════════════
   3D FOLD PREVIEW PANEL
   ═══════════════════════════════════════════ */

.he-fold-preview-panel {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 12px;
    overflow: hidden;
}

.he-fold-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
}

.he-fold-preview-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.he-fold-preview-header h4 i {
    margin-right: 6px;
    color: #1976d2;
}

.he-fold-preview-controls {
    display: flex;
    gap: 4px;
}

.he-fold-3d-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 250px;
    background: linear-gradient(135deg, #e8eaf6 0%, #f5f5f5 50%, #e3f2fd 100%);
    cursor: grab;
}

.he-fold-3d-container:active {
    cursor: grabbing;
}

.he-fold-3d-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.he-fold-legend {
    padding: 8px 12px;
    font-size: 0.78rem;
    color: #666;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.he-fold-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.he-fold-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #ccc;
}

/* Fold direction toggle */
.he-fold-direction-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.he-fold-dir-btn {
    font-size: 11px !important;
    padding: 3px 35px !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    transition: all .15s;
}
.he-fold-dir-btn.active {
    background: #1976d2;
    color: #fff;
    border-color: #1565c0;
}
.he-fold-dir-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* ═══════════════════════════════════════════
   SPLIT LAYOUT: when 3D preview is active, 
   preview area uses internal grid
   ═══════════════════════════════════════════ */

.he-preview-area.fold-active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 1fr auto auto;
    gap: 0 16px;
    align-items: start;
}

/* Row 1 — Drop zone (full width) */
.he-preview-area.fold-active #heDropSection {
    grid-column: 1 / -1;
    grid-row: 1;
}

/* Row 2 — Format badge (full width) */
.he-preview-area.fold-active #heFormatBadge {
    grid-column: 1 / -1;
    grid-row: 2;
}

/* Row 3 — Zoom controls (left col) */
.he-preview-area.fold-active #heZoomControls {
    grid-column: 1;
    grid-row: 3;
}

/* Row 4 — Canvas workspace (left col, fills remaining space) */
.he-preview-area.fold-active .he-preview-workspace {
    grid-column: 1;
    grid-row: 4;
    max-height: 65vh;
    overflow: hidden;
}

/* Row 5 — Page navigation (left col) */
.he-preview-area.fold-active #hePageNav {
    grid-column: 1;
    grid-row: 5;
}

/* 3D Preview panel — right column, spans rows 3-5 */
.he-preview-area.fold-active #heFoldPreviewPanel {
    grid-column: 2;
    grid-row: 3 / 6;
    margin-top: 0;
    height: 100%;
    max-height: 65vh;
    display: flex !important;
    flex-direction: column;
}

.he-preview-area.fold-active #heFoldPreviewPanel .he-fold-3d-container {
    flex: 1;
    min-height: 250px;
    aspect-ratio: auto;
}

/* Row 6 — Editor toolbar (full width, below 3D panel) */
.he-preview-area.fold-active #heEditorToolbar {
    grid-column: 1 / -1;
    grid-row: 6;
}

/* Auto-placed items (after row 6) */
.he-preview-area.fold-active #heColorInfo {
    grid-column: 1;
}

.he-preview-area.fold-active #heLayerPanel {
    grid-column: 1;
}

.he-preview-area.fold-active #heFileList {
    grid-column: 1 / -1;
}

/* Constrain thumbnail sidebar height in split layout */
.he-preview-area.fold-active .he-page-thumbnails {
    max-height: 55vh;
}

.he-preview-area.fold-active .he-canvas-scroll-wrapper {
    max-height: 60vh;
}

/* Responsive: stack on small screens */
@media (max-width: 900px) {
    .he-preview-area.fold-active {
        grid-template-columns: 1fr;
    }
    .he-preview-area.fold-active #heFoldPreviewPanel {
        grid-column: 1;
        grid-row: auto;
        max-height: 400px;
    }
    .he-preview-area.fold-active .he-preview-workspace {
        max-height: none;
    }
}
