/* ===========================
   PR4 - Component Styles (Modern Bubble Design)
   =========================== */

/* Upload Zone - WeTransfer Style */
.upload-zone {
    background: #f8f9fa;
    border: 2px dashed rgba(0,0,0,0.15);
    border-radius: 24px;
    padding: 100px 60px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover {
    background: #f0f1f3;
    border-color: var(--primary-color);
}

.upload-zone.drag-over {
    background: rgba(18, 96, 168, 0.08);
    border-color: var(--primary-color);
    border-style: solid;
    border-width: 3px;
    transform: scale(1.01);
}

@media (max-width: 768px) {
    .upload-zone {
        padding: 60px 30px;
    }
}

.upload-icon {
    margin-bottom: 24px;
}

.upload-icon svg {
    width: 80px;
    height: 80px;
    color: var(--primary-color);
}

.upload-title {
    font-family: 'Calibri', Arial, sans-serif;
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 20px;
    font-weight: 400;
}

@media (max-width: 768px) {
    .upload-title {
        font-size: 32px;
    }

    .upload-subtitle {
        font-size: 16px;
    }
}

.select-files-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 18px 48px;
    border-radius: 60px;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Calibri', Arial, sans-serif;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(18, 96, 168, 0.25);
}

.select-files-btn:hover {
    background: #0F4F8A;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(18, 96, 168, 0.3);
}

.select-files-btn:active {
    transform: translateY(0px);
}

@media (max-width: 768px) {
    .select-files-btn {
        padding: 16px 36px;
        font-size: 16px;
    }
}

.file-types {
    margin-top: 24px;
    font-size: 14px;
    color: #8e9199;
    font-weight: 400;
}

/* Files List - Linktree Style Cards */
.files-list {
    display: block;
    margin-bottom: 0px;
    height: calc(100vh - 300px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px 10px 180px 10px;
}

.file-item {
    margin-bottom: 16px;
    animation: slideIn 0.3s ease-out;
    position: relative;
}

.file-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.file-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.file-icon svg {
    width: 32px;
    height: 32px;
    color: rgba(0,0,0,0.7);
    position: relative;
    z-index: 1;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-family: 'Calibri', Arial, sans-serif;
    line-height: 1.4;
}

.file-size {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
}

.file-actions {
    display: flex;
    gap: 12px;
}

.file-actions button {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0,0,0,0.1);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.file-actions button:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.file-actions button svg {
    width: 22px;
    height: 22px;
    color: var(--text-primary);
}

.remove-btn:hover {
    background: var(--error-color);
}

.remove-btn:hover svg {
    color: white;
}

/* Print Options - Compact Horizontal Layout */
.print-options-grid {
    display: grid;
    gap: 12px;
}

.option-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.5) 0%, rgba(240, 249, 255, 0.3) 100%);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius);
    transition: var(--transition);
    position: relative;
    backdrop-filter: blur(8px);
    min-height: 48px;
}

.option-card:hover {
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.9) 0%, rgba(240, 249, 255, 0.7) 100%);
    border-color: rgba(18, 96, 168, 0.25);
    box-shadow: 0 0 0 3px rgba(18, 96, 168, 0.1);
    transform: translateY(-1px);
}

/* Toggle Switch - Playful */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #e5e7eb;
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background: var(--success-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Action Button - WeTransfer Style Floating */
.action-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 100;
    pointer-events: none;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 18px 32px;
    border-radius: 60px;
    font-size: 17px;
    font-weight: 600;
    font-family: 'Calibri', Arial, sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(18, 96, 168, 0.25);
    transition: var(--transition);
    pointer-events: auto;
}

.action-btn:hover {
    background: #0F4F8A;
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(18, 96, 168, 0.3);
}

.action-btn:active {
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .action-container {
        bottom: 20px;
        right: 20px;
        left: 20px;
        display: flex;
        justify-content: center;
    }

    .action-btn {
        width: 100%;
        max-width: 400px;
    }
}

.action-btn.pulse {
    animation: pulse 2s infinite;
}

/* Modals - Linktree Style */
.preview-modal,
.edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    padding: 40px;
    align-items: center;
    justify-content: center;
}

.preview-content,
.edit-modal-content {
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

.preview-header,
.edit-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
}

.preview-header h3,
.edit-modal-header h3 {
    font-family: 'Calibri', Arial, sans-serif;
    font-weight: 800;
    font-size: 24px;
    margin: 0;
}

/* Copy/Close Button */
.copy-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0,0,0,0.1);
    background: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.copy-btn:hover {
    transform: scale(1.05);
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.15);
}

.copy-btn.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.copy-btn svg {
    width: 24px;
    height: 24px;
}

/* Page Preview - Linktree Style Cards */
.preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    background: #fafbfc;
}

.page-preview {
    position: relative;
    border: 2px solid #d1d5db;
    border-radius: var(--radius);
    overflow: visible;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    min-height: calc(60vh - 90px);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-preview canvas {
    max-width: 90%;
    max-height: 90%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    border: 1px solid #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin: auto;
}

.page-preview:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.page-preview.selected {
    border-color: var(--primary-color);
    border-width: 2px;
    background: white;
}

/* Landscape page in preview — portrait A4 frame overlaid on landscape content */
.page-preview.landscape {
    border-color: #d1d5db;
    overflow: visible;
}

.page-preview.landscape canvas {
    max-width: none;
    width: auto !important;
    height: 85% !important;
    object-fit: contain;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    margin: auto;
}

/* Portrait A4 frame overlay — positioned by JS via CSS vars */
.page-preview.landscape .a4-frame-overlay {
    position: absolute;
    border: 2.5px solid var(--error-color, #CC2936);
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 0 0 3px rgba(204, 41, 54, 0.1);
}

.page-preview.landscape.selected {
    border-color: var(--primary-color);
}

/* Top bar: page number + controls + checkbox in a row */
.page-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    position: relative;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.page-checkbox {
    position: absolute;
    top: -14px;
    right: -14px;
    z-index: 3;
    width: 36px;
    height: 36px;
    background: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.page-preview.selected .page-checkbox {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.page-checkbox::after {
    content: '\2713';
    color: rgba(0,0,0,0.15);
    font-weight: 900;
    font-size: 20px;
}

.page-preview.selected .page-checkbox::after {
    color: white;
}

.page-number {
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    background: var(--primary-color);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Calibri', Arial, sans-serif;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.page-controls {
    position: absolute;
    top: 12px;
    left: 105px;
    display: flex;
    gap: 8px;
    opacity: 1;
}

.page-control-btn {
    width: 32px;
    height: 32px;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.page-control-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.page-control-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Preview Footer */
.preview-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
}

.preview-info {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Calibri', Arial, sans-serif;
}

/* Edit Modal - Enlarged with Toolbar */
.edit-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    gap: 16px;
}

/* Modern Horizontal Toolbar */
.edit-toolbar-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-section-label {
    font-family: 'Calibri', Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Calibri', Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.toolbar-btn.active {
    background: #194B8A;
    color: white;
    border-color: #194B8A;
}

.toolbar-btn.active svg {
    stroke: white;
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

/* Icon-only buttons */
.toolbar-btn-icon {
    padding: 8px;
    min-width: auto;
}

.toolbar-btn-icon span {
    display: none;
}

.toolbar-btn-more {
    margin-left: auto;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    flex-shrink: 0;
}

/* Edit Preview Wrapper */
.edit-preview-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
    background: #f0f0f0;
    border-radius: 12px;
}

/* Edit Canvas Container - Enlarged like Selection Preview */
.edit-canvas-container {
    position: relative;
    background: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    border: 2px solid #d1d5db;
    border-radius: 8px;
    padding: 16px;
    max-width: 600px;
    max-height: calc(80vh - 250px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 4px;
}

/* Crop Overlay */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.crop-box {
    position: absolute;
    border: 2px solid #194B8A;
    background: transparent;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #194B8A;
    border-radius: 50%;
    z-index: 11;
}

.crop-handle-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* Edit Modal Footer */
.edit-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0;
    background: white;
}

.edit-cancel-btn,
.edit-save-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-family: 'Calibri', Arial, sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.edit-cancel-btn {
    background: #f3f4f6;
    color: var(--text-primary);
}

.edit-cancel-btn:hover {
    background: #e5e7eb;
}

.edit-save-btn {
    background: var(--primary-color);
    color: white;
}

.edit-save-btn:hover {
    background: #0F4F8A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(18, 96, 168, 0.2);
}

/* Confirmation Page - WeTransfer Style */
.confirmation-page {
    display: none;
    min-height: 600px;
    background: #F4F7FA;
    padding: 0;
    margin: 0;
    position: relative;
    overflow: hidden;
}

/* Remove decorative blobs for cleaner WeTransfer look */

.confirmation-content {
    max-width: 550px;
    margin: 0 auto;
    background: transparent;
    border: none;
    padding: 16px 16px 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    animation: slideIn 0.4s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .confirmation-content {
        margin: 0 auto;
        padding: 0 20px 20px;
    }
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--success-color);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successPop 0.5s ease-out;
}

@keyframes successPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.success-icon svg {
    width: 50px;
    height: 50px;
    color: white;
}

.confirmation-title {
    font-family: 'Calibri', Arial, sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #666666;
    letter-spacing: -0.3px;
    flex-shrink: 0;
    line-height: 1;
}

.confirmation-subtitle {
    color: #6b7280;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
}

@media (max-width: 768px) {
    .confirmation-title {
        font-size: 20px;
    }

    .confirmation-subtitle {
        font-size: 14px;
    }
}

.code-display {
    background: #ffffff;
    border: 4px solid #e0e0e0;
    border-radius: 12px;
    padding: 5px;
    margin: 0 10px;
    max-width: 550px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2px;
    position: relative;
    line-height: 1;
}

.code-display-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.code-actions {
    display: flex;
    flex-direction: row;
    gap: 6px;
}

.code-display .copy-btn,
.code-display .email-code-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.code-display .copy-btn svg,
.code-display .email-code-btn svg {
    width: 18px;
    height: 18px;
}

.email-code-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.email-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    opacity: 0.9;
}

.code-text {
    font-size: 76px;
    font-weight: 700;
    font-family: 'Consolas', 'Courier New', monospace;
    letter-spacing: 5px;
    color: var(--primary-color);
    flex-shrink: 0;
    line-height: 1;
    margin: 0;
}

@media (max-width: 768px) {
    .code-display {
        padding: 16px 12px;
    }

    .code-text {
        font-size: 56px;
        letter-spacing: 3px;
    }
}

.code-info {
    display: flex;
    gap: 8px;
    margin: 0;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.code-info p {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
}

.code-info p::after {
    content: ' • ';
    margin-left: 8px;
    color: var(--text-secondary);
}

.code-info p:last-child::after {
    content: '';
    margin: 0;
}

.price-info {
    font-weight: 700;
    color: var(--text-primary);
}

/* Rating Section — compact inline layout */
.rating-section {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 10px 16px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rating-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
}

.rating-stars {
    display: flex;
    gap: 4px;
    align-items: center;
}

.star-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #D1D5DB;
    cursor: pointer;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.15s ease;
    line-height: 1;
}

.star-btn:hover {
    transform: scale(1.15);
}

.star-btn.active {
    color: #F59E0B;
}

.star-btn.hover {
    color: #FBBF24;
}

.rating-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.rating-section.rated .rating-title {
    color: var(--success-color, #0F8A4F);
}

/* Email Modal */
.email-modal-content {
    max-width: 400px;
}

.email-modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.email-modal-form .email-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: var(--radius, 8px);
    font-size: 16px;
    font-weight: 400;
    background: #ffffff;
    color: var(--text-primary, #1A1A1A);
    transition: var(--transition);
    box-sizing: border-box;
}

.email-modal-form .email-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(18, 96, 168, 0.1);
}

.email-modal-submit {
    margin-top: 4px;
}

/* Feedback Modal Form */
.feedback-modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feedback-modal-form .email-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: var(--radius, 8px);
    font-size: 16px;
    font-weight: 400;
    background: #ffffff;
    color: var(--text-primary, #1A1A1A);
    transition: var(--transition);
    box-sizing: border-box;
}

.feedback-modal-form .email-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(18, 96, 168, 0.1);
}

.feedback-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-family: 'Calibri', sans-serif;
    background: #ffffff;
    color: var(--text-primary, #1A1A1A);
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
    transition: var(--transition);
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(18, 96, 168, 0.1);
}

.feedback-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.feedback-toggle input[type="checkbox"] {
    display: none;
}

.feedback-toggle-slider {
    width: 40px;
    height: 22px;
    background: #D1D5DB;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.feedback-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.feedback-toggle input:checked + .feedback-toggle-slider {
    background: var(--primary-color);
}

.feedback-toggle input:checked + .feedback-toggle-slider::after {
    transform: translateX(18px);
}

.feedback-toggle-label {
    font-size: 14px;
    color: var(--text-secondary, #666);
}

/* Confirmation Ad Space - Cliquable */
.confirmation-ad-space {
    width: 100%;
    max-width: 550px;
    margin: 16px auto 10px auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.confirmation-ad-space:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ad-link {
    display: block;
    position: relative;
    width: 100%;
    height: 250px;
    text-decoration: none;
    cursor: pointer;
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ad-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ad-link:hover .ad-image,
.ad-link:hover .ad-video {
    transform: scale(1.02);
}

.ad-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: #666;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Calibri', Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ad Loading State */
.ad-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: inherit;
    z-index: 5;
}

.ad-loading span {
    font-family: 'Calibri', Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-loading span::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: ad-spin 0.8s linear infinite;
}

@keyframes ad-spin {
    to { transform: rotate(360deg); }
}

/* Ad Hidden State (no ad available) */
.confirmation-ad-space.ad-hidden {
    display: none;
}

/* Ad Error State */
.ad-loading.ad-error span::before {
    display: none;
}

.ad-loading.ad-error span {
    color: #64748b;
}

@media (max-width: 768px) {
    .ad-link {
        height: 250px;
    }

    .confirmation-ad-space {
        margin: 20px auto 10px auto;
        border-radius: 16px;
    }
}

.new-print-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius, 12px);
    font-size: 16px;
    font-weight: 600;
    font-family: 'Calibri', Arial, sans-serif;
    cursor: pointer;
    transition: var(--transition);
    margin: 0;
}

.new-print-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    opacity: 0.95;
}

/* Custom scrollbar for preview */
.preview-body::-webkit-scrollbar {
    width: 12px;
}

.preview-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

.preview-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}

.preview-body::-webkit-scrollbar-thumb:hover {
    background: #194B8A;
}

/* ===== INTEGRATED EDIT VIEW IN PREVIEW MODAL ===== */

.preview-edit-view {
    display: none;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

.preview-edit-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.back-to-list-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-to-list-btn svg {
    width: 18px;
    height: 18px;
}

.back-to-list-btn:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.preview-edit-header h4 {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.edit-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.edit-cancel-btn,
.edit-save-btn {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.edit-cancel-btn {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

.edit-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.02);
}

.edit-save-btn {
    background: var(--primary-color);
    color: white;
}

.edit-save-btn:hover {
    background: #0F4F8A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(18, 96, 168, 0.2);
}

/* ===== INLINE EDIT TOOLBAR (ALWAYS VISIBLE IN PREVIEW) ===== */

.edit-toolbar-container {
    padding: 16px 20px;
    background: rgba(240, 249, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.edit-toolbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.edit-toolbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.edit-toolbar-title span:last-child {
    color: var(--primary-color);
    margin-left: 4px;
}

/* Edit controls on each page */
.page-edit-controls {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.page-edit-btn {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    overflow: hidden;
}

.page-edit-btn svg {
    width: 32px;
    height: 32px;
}

.edit-btn-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-edit-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(18, 96, 168, 0.2);
}

.page-edit-btn:active {
    transform: translateY(0);
}

/* Active tool indicator */
.page-edit-btn.active-tool {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 3px rgba(18, 96, 168, 0.2);
}

/* Eraser canvas overlay */
.eraser-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
}

/* Eraser undo/redo toolbar */
.eraser-toolbar {
    display: flex;
    gap: 6px;
    z-index: 101;
}

.eraser-tool-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: opacity 0.15s, background 0.15s;
    color: var(--text-primary);
}

.eraser-tool-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.eraser-tool-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.eraser-validate-btn {
    background: #0F8A4F;
    border-color: #0F8A4F;
    color: white;
}

.eraser-validate-btn:hover:not(:disabled) {
    background: #0B6E3D;
}

/* Editing mode overlay - dims everything except active page */
.preview-content.editing-mode .preview-body {
    position: relative;
}

.preview-content.editing-mode .preview-body::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 50;
    pointer-events: none;
    border-radius: inherit;
}

.preview-content.editing-mode .preview-footer {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.2s;
}

.preview-content.editing-mode .preview-header {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.2s;
}

.preview-content.editing-mode .page-preview {
    opacity: 0.3;
    transition: opacity 0.2s;
}

.preview-content.editing-mode .page-preview.editing-active {
    opacity: 1;
    z-index: 60;
    position: relative;
}

.preview-content.editing-mode .page-checkbox {
    display: none;
}

.preview-content.editing-mode .page-edit-btn {
    opacity: 0.3;
    pointer-events: none;
}

.preview-content.editing-mode .page-edit-btn.active-tool {
    opacity: 1;
    pointer-events: auto;
}

/* Scale toolbar */
.scale-toolbar {
    display: flex;
    gap: 4px;
    z-index: 101;
}

.scale-btn {
    min-width: 34px;
    height: 30px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    background: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Calibri', Arial, sans-serif;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scale-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.scale-btn-active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(18, 96, 168, 0.2);
}

/* Make more space for page grid */
.preview-modal .preview-body {
    max-height: calc(80vh - 120px);
    min-height: 350px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .edit-toolbar-container {
        padding: 12px 16px;
    }

    .edit-toolbar-modern {
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .preview-modal .preview-body {
        max-height: calc(80vh - 180px);
    }

    .page-preview.active-for-edit::after {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    /* Reduce edit buttons on mobile */
    .page-edit-btn {
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }

    .page-edit-btn svg {
        width: 20px;
        height: 20px;
    }

    .page-edit-controls {
        padding: 4px;
        gap: 4px;
        border-radius: 6px;
    }

    .page-number {
        padding: 3px 10px;
        font-size: 11px;
        top: -11px;
    }

    /* Checkbox on mobile */
    .page-checkbox {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        top: -12px;
        right: -12px;
    }

    .page-checkbox::after {
        font-size: 18px;
    }

    /* Preview footer */
    .preview-footer {
        padding: 14px 16px;
        gap: 10px;
    }

    .preview-info {
        font-size: 13px;
    }

    /* Eraser toolbar buttons */
    .eraser-tool-btn {
        width: 30px;
        height: 30px;
        border-radius: 6px;
    }

    .eraser-tool-btn svg {
        width: 14px;
        height: 14px;
    }
}