/**
 * Cover Designer Styles
 * Professional cover design interface
 */

/* Cover Designer Container */
.cover-designer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #F9FAFB;
}

/* Book Cover Designer Page */
.book-cover-designer-page {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: #F9FAFB;
}

/* Cover Selection Screen (Initial Choice) */
.cover-selection-wrapper {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.cover-option-card {
    background: white;
    border: 3px solid #E5E7EB;
    border-radius: 16px;
    padding: 40px 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.cover-option-card:hover {
    border-color: #3B82F6;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
}

.option-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.option-icon i {
    font-size: 36px;
    color: white;
}

.cover-option-card h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1F2937;
}

.cover-option-card p {
    margin: 0 0 24px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #6B7280;
    flex: 1;
}

.option-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.option-badge.recommended {
    background: #10B981;
    color: white;
}

.option-badge.advanced {
    background: #F59E0B;
    color: white;
}

.btn-block {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: #3B82F6;
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563EB;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #6B7280;
    color: white;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    background: #4B5563;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}

/* Cover Designer Toolbar */
.cover-designer-toolbar {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cover-designer-toolbar button {
    padding: 12px 24px;
    background: #3B82F6;
    border: 2px solid #3B82F6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.cover-designer-toolbar button:hover {
    background: #2563EB;
    border-color: #2563EB;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.cover-designer-toolbar button i {
    font-size: 16px;
}

/* Cover Canvas Wrapper */
.cover-canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 40px 20px;
    overflow: auto;
}

/* Individual Cover Canvas - 6"x9" book size (600px x 900px at 100 DPI) */
.cover-canvas {
    position: relative;
    width: 600px;
    height: 900px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: all 0.3s;
}

.cover-canvas:hover {
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
    transform: translateY(-4px);
}

.front-cover {
    order: 2;
}

.back-cover {
    order: 1;
}

/* Cover Overlay Label */
.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.cover-canvas:hover .cover-overlay {
    opacity: 1;
}

/* Editable Layer */
.editable-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Cover Preview Canvas */
.cover-preview-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.cover-content-layer {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Cover Text Elements */
.cover-title-area {
    margin-bottom: 40px;
}

.cover-main-title {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 12px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.cover-subtitle {
    font-family: 'Georgia', serif;
    font-size: 18px;
    font-style: italic;
    margin: 0;
    opacity: 0.9;
}

.cover-memorial-name {
    margin-top: 30px;
}

.memorial-prefix {
    font-size: 14px;
    font-style: italic;
    opacity: 0.8;
    display: block;
    margin-bottom: 8px;
}

.memorial-name {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.cover-decoration {
    font-size: 48px;
    margin-top: 40px;
    opacity: 0.6;
}

/* Back Cover Elements */
.back-cover-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
}

.back-summary-text {
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
}

.barcode-placeholder {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 120px;
    height: 80px;
    border: 2px dashed rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0.5;
}

/* Spine Preview */
.spine-preview {
    width: 8px;
    height: 450px;
    background: #374151;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 1.5;
    position: relative;
}

.spine-width-info {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 10px;
    color: white;
    font-weight: 600;
}

/* Border Styles */
.border-ornate {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 3px double currentColor;
    border-radius: 4px;
    opacity: 0.8;
    z-index: 0;
}

.border-ornate::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid currentColor;
    border-radius: 2px;
}

.border-simple {
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border: 2px solid currentColor;
    opacity: 0.6;
}

.border-double {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    border: 3px double currentColor;
    opacity: 0.7;
}

/* Cover Properties Panel */
.cover-properties-panel {
    background: white;
    border-top: 1px solid #E5E7EB;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.cover-property-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cover-property-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.cover-property-input {
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
}

.cover-property-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Template Gallery Modal */
.template-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.template-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
}

.template-gallery-modal {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.template-gallery-modal .modal-header {
    padding: 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-gallery-modal .modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

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

.template-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.template-gallery-item {
    cursor: pointer;
    transition: all 0.3s;
}

.template-preview-card {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}

.template-gallery-item:hover .template-preview-card {
    border-color: #3B82F6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
    transform: translateY(-4px);
}

.template-gallery-item.selected .template-preview-card {
    border-color: #10B981;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.template-preview-image {
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    color: white;
    position: relative;
}

.template-preview-label {
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.template-info {
    padding: 16px;
}

.template-info h5 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.template-info p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.4;
}

.template-category {
    display: inline-block;
    background: #F3F4F6;
    color: #6B7280;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-selected-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: #10B981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .cover-canvas {
        width: 500px;
        height: 750px;
    }
}

@media (max-width: 1024px) {
    .cover-canvas {
        width: 450px;
        height: 675px;
    }
    
    .cover-canvas-wrapper.single-preview {
        min-height: 750px;
    }
}

@media (max-width: 768px) {
    .cover-canvas-wrapper {
        flex-direction: column;
        padding: 20px 10px;
    }
    
    .cover-canvas {
        width: 360px;
        height: 540px;
    }
    
    .cover-canvas-wrapper.single-preview {
        min-height: 600px;
        padding: 20px;
    }
}
    
    .spine-preview {
        width: 90%;
        max-width: 300px;
        height: 8px;
        writing-mode: horizontal-tb;
    }
    
    .spine-width-info {
        writing-mode: horizontal-tb;
        transform: none;
    }
    
    .cover-properties-panel {
        grid-template-columns: 1fr;
    }
    
    /* Template grid responsive */
    .template-gallery-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    
    /* Preview controls responsive */
    .preview-controls {
        flex-direction: column;
        align-items: center;
    }
    
    /* Side-by-side mode responsive */
    .cover-preview-section.side-by-side-mode .cover-canvas-wrapper {
        flex-direction: column;
        gap: 16px;
    }
    
    .cover-preview-section.side-by-side-mode .spine-preview {
        width: 90%;
        max-width: 300px;
        height: 8px;
        writing-mode: horizontal-tb;
    }
}

/* Cover Editor Page Styles */
.book-cover-designer-page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cover-design-header {
    text-align: center;
    padding: 24px;
    background: white;
    border-bottom: 1px solid #E5E7EB;
}

.cover-design-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1F2937;
}

.cover-design-header p {
    margin: 0;
    color: #6B7280;
    font-size: 14px;
}

/* Cover Side Selector */
.cover-side-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 16px;
    background: #F9FAFB;
}

.cover-side-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    transition: all 0.2s;
}

.cover-side-btn.active {
    border-color: #3B82F6;
    background: #EFF6FF;
    color: #3B82F6;
}

.cover-side-btn:hover:not(.active) {
    border-color: #9CA3AF;
}

/* Cover Customization Panel */
.cover-customization {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 20px;
}

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

.customization-section:last-child {
    margin-bottom: 0;
}

.customization-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.customization-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 12px;
}

/* Color Picker Group */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #E5E7EB;
    cursor: pointer;
    transition: all 0.2s;
}

.color-picker-preview:hover {
    border-color: #3B82F6;
    transform: scale(1.1);
}

input[type="color"] {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
}

/* Upload Photo Button */
.upload-photo-btn {
    width: 100%;
    padding: 40px 20px;
    border: 3px dashed #3B82F6;
    border-radius: 12px;
    background: #EFF6FF;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-photo-btn:hover {
    border-color: #2563EB;
    background: #DBEAFE;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.upload-photo-btn i {
    font-size: 48px;
    color: #3B82F6;
    display: block;
    margin-bottom: 8px;
}

.upload-photo-btn span {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    display: block;
}

.upload-photo-btn small {
    font-size: 12px;
    color: #6B7280;
    display: block;
}

.upload-photo-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    max-height: 300px;
}

.upload-photo-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-photo-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-photo-btn:hover {
    background: #EF4444;
}

/* Info Messages */
.cover-info-message {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 16px;
    font-size: 13px;
    color: #1E40AF;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cover-info-message i {
    color: #3B82F6;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Preview Toggle */
.preview-toggle-group {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #E5E7EB;
    justify-content: center;
}

.preview-toggle-btn {
    padding: 8px 16px;
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    transition: all 0.2s;
}

.preview-toggle-btn.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
}

.preview-toggle-btn:hover:not(.active) {
    background: #E5E7EB;
}

/* Cover Design Header */
.cover-design-header {
    background: white;
    border-bottom: 2px solid #E5E7EB;
    position: relative;
}

/* Header Action Bar */
.cover-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

.cover-header-actions .btn-back,
.cover-header-actions .btn-change-template {
    padding: 8px 16px;
    background: white;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cover-header-actions .btn-back:hover,
.cover-header-actions .btn-change-template:hover {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

/* Header Title Section */
.cover-header-title {
    text-align: center;
    padding: 32px 24px 24px;
}

.cover-design-header h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: #1F2937;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.cover-design-header p {
    margin: 0;
    color: #6B7280;
    font-size: 15px;
}

/* Legacy button styles for backwards compatibility */
.btn-change-template:not(.cover-header-actions .btn-change-template),
.btn-back:not(.cover-header-actions .btn-back) {
    padding: 8px 16px;
    background: white;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    margin: 8px;
}

.btn-change-template:not(.cover-header-actions .btn-change-template):hover,
.btn-back:not(.cover-header-actions .btn-back):hover {
    background: #F3F4F6;
    border-color: #3B82F6;
    color: #3B82F6;
}

/* Responsive Header Actions */
@media (max-width: 768px) {
    .cover-header-actions {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .cover-header-actions .btn-back,
    .cover-header-actions .btn-change-template {
        width: 100%;
        justify-content: center;
    }
    
    .cover-header-title h2 {
        font-size: 22px;
    }
    
    .cover-header-title p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .cover-header-actions {
        padding: 8px 12px;
    }
    
    .cover-header-title {
        padding: 24px 16px 16px;
    }
    
    .cover-header-title h2 {
        font-size: 20px;
        flex-direction: column;
        gap: 8px;
    }
}

/* Template Gallery Container */
.template-gallery-container {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.template-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.template-gallery-card {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.template-gallery-card:hover {
    border-color: #3B82F6;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
}

.template-preview-image {
    aspect-ratio: 2/3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    color: white;
    position: relative;
    padding: 40px 20px;
}

.template-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.template-gallery-card:hover .template-preview-overlay {
    opacity: 1;
}

.template-preview-overlay .btn {
    background: #3B82F6;
    color: white;
    border: 2px solid white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.template-preview-overlay .btn:hover {
    background: #2563EB;
    transform: scale(1.05);
}

.template-sample-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.template-sample-content h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}

.template-sample-content p {
    font-size: 18px;
    font-style: italic;
    margin: 0;
}

.template-card-info {
    padding: 20px;
}

.template-card-info h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.template-card-info p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #6B7280;
    line-height: 1.5;
}

.category-badge {
    display: inline-block;
    background: #F3F4F6;
    color: #6B7280;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

/* Template Editor Layout */
.template-editor {
    height: 100%;
}

.cover-preview-section {
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    padding: 40px 20px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

/* Tab Mode Layout */
.cover-preview-section.tab-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cover-preview-section.tab-mode .cover-canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 650px;
}

.cover-preview-section.tab-mode .cover-canvas {
    width: 600px;
    height: 900px;
    margin: 0 auto;
}

.cover-preview-section.tab-mode .spine-preview {
    display: none;
}

/* Side-by-Side Mode Layout */
.cover-preview-section.side-by-side-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cover-preview-section.side-by-side-mode .cover-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 1250px;
}

.cover-preview-section.side-by-side-mode .cover-canvas {
    width: 600px;
    height: 900px;
}

.cover-preview-section.side-by-side-mode .spine-preview {
    width: 8px;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-label {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: rgba(255,255,255,0.9);
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cover-side-label {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.cover-preview-container {
    width: 100%;
    height: 100%;
}

/* Customization Panel */
.cover-customization-panel {
    background: #FFFFFF;
    border-top: 3px solid #E5E7EB;
    padding: 32px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.cover-customization-panel h3 {
    margin: 0 0 24px 0;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cover-customization-panel h3 i {
    color: #3B82F6;
}

/* Tabs */
.customization-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: #F3F4F6;
    padding: 4px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #3B82F6;
    background: rgba(59, 130, 246, 0.1);
}

.tab-btn.active {
    color: #FFFFFF;
    background: #3B82F6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.tab-btn i {
    font-size: 16px;
}

.tab-content {
    padding: 24px 0;
}

/* Customization Grid */
.customization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.form-group label i {
    color: #3B82F6;
    font-size: 16px;
}

.form-control {
    padding: 14px 16px;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    font-size: 15px;
    color: #111827;
    background: white;
    transition: all 0.2s;
    font-weight: 500;
}

.form-control::placeholder {
    color: #9CA3AF;
    font-weight: 400;
}

.form-control:hover {
    border-color: #9CA3AF;
}

.form-control:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    background: #FFFFFF;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.6;
}

/* Color Picker Enhanced */
.color-picker-enhanced {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-preview-large {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    border: 3px solid #E5E7EB;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.color-preview-large:hover {
    border-color: #3B82F6;
    transform: scale(1.05);
}

.color-hex-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #D1D5DB;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: #3B82F6;
}

/* Color Presets */
.color-presets {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
}

.color-presets label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.color-preset {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.color-preset:hover {
    border-color: #3B82F6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.preset-colors {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    justify-content: center;
}

.preset-colors span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #F3F4F6;
}

.color-preset span {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
}

/* Photo Upload Section */
.photo-upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.photo-upload-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.photo-upload-area label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.uploaded-photo-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid #10B981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.uploaded-photo-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-photo {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.remove-photo:hover {
    background: #DC2626;
    transform: scale(1.1);
}

/* Custom Upload Section */
.custom-upload-wrapper {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
    padding: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.custom-upload-section {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.upload-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.upload-section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.required-badge {
    background: #EF4444;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.custom-upload-dropzone {
    border: 3px dashed #D1D5DB;
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    background: #F9FAFB;
    cursor: pointer;
    transition: all 0.3s;
}

.custom-upload-dropzone:hover {
    border-color: #3B82F6;
    background: #EFF6FF;
}

.custom-upload-dropzone i {
    font-size: 48px;
    color: #9CA3AF;
    display: block;
    margin-bottom: 16px;
}

.custom-upload-dropzone h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.custom-upload-dropzone p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #6B7280;
}

.upload-specs {
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    color: #92400E;
    line-height: 1.6;
    text-align: left;
    display: inline-block;
}

.upload-specs strong {
    display: block;
    margin-bottom: 6px;
}

.uploaded-cover-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid #10B981;
}

.uploaded-cover-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 16px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-secondary {
    background: #6B7280;
    color: white;
}

.btn-secondary:hover {
    background: #4B5563;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

/* Info Messages */
.cover-info-message {
    background: #EFF6FF;
    border: 2px solid #BFDBFE;
    border-radius: 12px;
    padding: 20px;
    margin: 24px;
    font-size: 14px;
    color: #1E40AF;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    line-height: 1.6;
}

.cover-info-message.warning {
    background: #FEF3C7;
    border-color: #FCD34D;
    color: #92400E;
}

.cover-info-message i {
    color: #3B82F6;
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.cover-info-message.warning i {
    color: #F59E0B;
}

.cover-info-message a {
    color: #2563EB;
    text-decoration: underline;
}

.cover-info-message a:hover {
    color: #1D4ED8;
}

/* Safe Zone Guides */
.safe-zone-guides {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
    display: none;
}

.safe-zone-guides.visible {
    display: block;
}

/* Bleed Zone (0-12%) - Subtle RED Pattern */
.guide-bleed {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px dashed rgba(239, 68, 68, 0.3);
    background: repeating-linear-gradient(
        45deg,
        rgba(239, 68, 68, 0.02),
        rgba(239, 68, 68, 0.02) 8px,
        transparent 8px,
        transparent 16px
    );
}

/* Trim Line (12% in) - Subtle ORANGE */
.guide-trim {
    position: absolute;
    top: 12%;
    left: 12%;
    right: 12%;
    bottom: 12%;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.1);
}

/* Safe Zone (24% in) - Subtle GREEN */
.guide-safe {
    position: absolute;
    top: 24%;
    left: 24%;
    right: 24%;
    bottom: 24%;
    border: 1px dashed rgba(16, 185, 129, 0.3);
}

/* Spine Caution (front cover only) - BLUE Vertical Line */
.guide-spine-caution {
    position: absolute;
    top: 24%;
    left: 39%; /* Extra caution zone near binding */
    bottom: 24%;
    width: 2px;
    background: repeating-linear-gradient(
        to bottom,
        #3B82F6 0px,
        #3B82F6 8px,
        transparent 8px,
        transparent 16px
    );
}

/* Guide Labels - More Subtle */
.guide-label {
    position: absolute;
    background: rgba(0,0,0,0.4);
    color: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    backdrop-filter: blur(2px);
    z-index: 60;
}

.bleed-label {
    top: 4px;
    left: 4px;
    background: rgba(239, 68, 68, 0.6);
}

.trim-label {
    top: calc(12% + 4px);
    left: calc(12% + 4px);
    background: rgba(245, 158, 11, 0.6);
}

.safe-label {
    top: calc(24% + 4px);
    left: calc(24% + 4px);
    background: rgba(16, 185, 129, 0.6);
}

.spine-label {
    top: calc(24% + 4px);
    left: calc(39% + 4px);
    background: rgba(59, 130, 246, 0.6);
}

/* Preview Controls */
.preview-controls {
    text-align: center;
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toggle-guides {
    padding: 10px 20px;
    background: white;
    color: #374151;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-guides:hover {
    background: #F3F4F6;
    border-color: #3B82F6;
    color: #3B82F6;
}

.toggle-guides.active {
    background: #3B82F6;
    color: white;
    border-color: #3B82F6;
}

.toggle-guides i {
    font-size: 14px;
}

/* Cover View Toggle */
.cover-view-toggle {
    padding: 10px 20px;
    background: white;
    color: #374151;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cover-view-toggle:hover {
    background: #F3F4F6;
    border-color: #10B981;
    color: #10B981;
}

.cover-view-toggle.active {
    background: #10B981;
    color: white;
    border-color: #10B981;
}

.cover-view-toggle i {
    font-size: 14px;
}

/* Cover Side Tabs */
.cover-side-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.cover-side-btn {
    padding: 12px 24px;
    background: white;
    color: #374151;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cover-side-btn:hover {
    background: #F3F4F6;
    border-color: #6B7280;
    color: #6B7280;
}

.cover-side-btn.active {
    background: #3B82F6;
    color: white;
    border-color: #3B82F6;
}

.cover-side-btn i {
    font-size: 16px;
}

/* Safe Zone Legend */
.safe-zone-legend {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 20px auto 0;
    max-width: 800px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #374151;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-color.bleed {
    background: #EF4444;
    border: 2px dashed #DC2626;
}

.legend-color.trim {
    background: #F59E0B;
    border: 2px solid #D97706;
}

.legend-color.safe {
    background: #10B981;
    border: 2px dashed #059669;
}

.legend-color.spine {
    background: #3B82F6;
    border: 2px dotted #2563EB;
}

.legend-item strong {
    color: #111827;
}

/* Spine Note */
.spine-note {
    display: block;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    margin-top: 4px;
    text-align: center;
}

/* Title Page Cover Preview */
.book-cover-preview-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    background: #F9FAFB;
    min-height: 100%;
}

.cover-preview-notice {
    background: #EFF6FF;
    border: 2px solid #3B82F6;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 800px;
    width: 100%;
}

.cover-preview-notice i {
    color: #3B82F6;
    font-size: 20px;
    flex-shrink: 0;
}

.cover-preview-notice span {
    flex: 1;
    color: #1E40AF;
    font-weight: 500;
}

.cover-display-wrapper {
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
}

.custom-cover-preview img,
.template-cover-preview {
    width: 100%;
    aspect-ratio: 2/3;
    display: block;
}

.template-cover-preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-preview-placeholder {
    background: #E5E7EB;
    padding: 60px 20px;
    text-align: center;
    color: #6B7280;
}

.cover-preview-placeholder i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.cover-info-note {
    margin-top: 24px;
    text-align: center;
    max-width: 600px;
}

.cover-info-note p {
    margin: 8px 0;
    color: #374151;
}

.cover-info-note .text-muted {
    color: #9CA3AF;
    font-size: 14px;
}

/* Design Cover Prompt (when no cover designed yet) */
.design-cover-prompt {
    margin-top: 60px;
    text-align: center;
    background: white;
    border: 3px dashed #D1D5DB;
    border-radius: 16px;
    padding: 48px 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.prompt-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.prompt-icon i {
    font-size: 36px;
    color: white;
}

.design-cover-prompt h3 {
    margin: 0 0 12px 0;
    font-size: 22px;
    font-weight: 700;
    color: #1F2937;
}

.design-cover-prompt p {
    margin: 0 0 24px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #6B7280;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}


/* ============================ */
/* Editable & Draggable Elements */
/* ============================ */

.cover-editable-element {
    transition: all 0.2s ease;
    border: 2px dashed transparent;
    border-radius: 4px;
    user-select: none;
    position: relative;
    z-index: 10;
}

.cover-editable-element:hover {
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.cover-editable-element .edit-handle {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #3B82F6;
    color: white;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.cover-editable-element:hover .edit-handle {
    opacity: 1;
}

.cover-editable-element .edit-handle i {
    margin-right: 5px;
}

/* Contenteditable styling */
[contenteditable="true"] {
    position: relative;
}

[contenteditable="true"]:focus {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 10px;
    border-radius: 4px;
}

[contenteditable="true"]:empty:before {
    content: attr(placeholder);
    color: rgba(255, 255, 255, 0.5);
}

/* Single preview mode - Full book size display */
.cover-canvas-wrapper.single-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 950px;
    padding: 40px;
    background: #F9FAFB;
    border-radius: 12px;
    margin-top: 20px;
    overflow: auto;
}

.cover-canvas-wrapper.single-preview .cover-canvas {
    width: 600px;
    height: 900px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Preview label enhancement */
.preview-label {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.preview-label i {
    margin-right: 10px;
    color: #3B82F6;
}

/* Memorial name editing */
.cover-memorial-name-edit {
    text-align: center;
}

.memorial-prefix {
    font-style: italic;
    opacity: 0.8;
}

/* Extra small screens */
@media (max-width: 480px) {
    .cover-canvas {
        width: 300px;
        height: 450px;
    }
    
    .cover-canvas-wrapper.single-preview {
        min-height: 500px;
        padding: 15px;
    }
}
