/**
 * FotoDigital Photobook - Print Editor Styles
 * @since 2.2.0
 */

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

body.print-editor-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f4f5f7;
    color: #1a1a2e;
    min-height: 100vh;
}

/* ── TOP BAR ────────────────────────────── */
.pe-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 60px; padding: 0 24px;
    background: #fff; border-bottom: 1px solid #e0e0e0;
    position: sticky; top: 0; z-index: 100;
}
.pe-topbar-left { display: flex; align-items: center; gap: 16px; }
.pe-topbar-right { display: flex; align-items: center; gap: 20px; }
.pe-logo img { height: 32px; width: auto; }
.pe-logo-text { font-weight: 700; font-size: 16px; color: #1a1a2e; text-decoration: none; }
.pe-topbar-sep { width: 1px; height: 30px; background: #e0e0e0; }
.pe-title { font-size: 16px; font-weight: 600; color: #333; }
.pe-total-display { display: flex; align-items: center; gap: 8px; }
.pe-total-label { font-size: 13px; color: #666; }
.pe-total-value { font-size: 20px; font-weight: 700; color: #2980b9; }
.pe-total-count { font-size: 12px; color: #999; }

.pe-btn-cart {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 24px; border: none; border-radius: 6px;
    background: #2980b9; color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
}
.pe-btn-cart:hover:not(:disabled) { background: #2471a3; }
.pe-btn-cart:disabled { background: #bdc3c7; cursor: not-allowed; }
.pe-btn-cart svg { stroke: currentColor; fill: none; }

/* ── MAIN ───────────────────────────────── */
.pe-main { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ── UPLOAD ZONE ────────────────────────── */
.pe-upload-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 280px; padding: 48px 24px;
    border: 3px dashed #ccc; border-radius: 12px;
    background: #fff; cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.pe-upload-zone:hover, .pe-upload-zone.dragover {
    border-color: #2980b9; background: #f0f7ff;
}
.pe-upload-zone.has-photos {
    min-height: 80px; padding: 16px;
    border-style: solid; border-width: 1px;
}
.pe-upload-zone.has-photos .pe-upload-icon,
.pe-upload-zone.has-photos h2,
.pe-upload-zone.has-photos .pe-upload-formats { display: none; }
.pe-upload-zone.has-photos p { font-size: 13px; margin: 0; }
.pe-upload-icon { color: #2980b9; margin-bottom: 16px; }
.pe-upload-zone h2 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.pe-upload-zone p { font-size: 14px; color: #666; margin-bottom: 4px; }
.pe-upload-formats { font-size: 12px !important; color: #999 !important; }
.pe-upload-btn {
    margin-top: 16px; padding: 10px 28px;
    background: #2980b9; color: #fff; border: none; border-radius: 6px;
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.pe-upload-btn:hover { background: #2471a3; }

/* ── DEFAULTS BAR ───────────────────────── */
.pe-defaults-bar {
    margin: 20px 0 16px; padding: 12px 16px;
    background: #fff; border-radius: 8px; border: 1px solid #e0e0e0;
}
.pe-defaults-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pe-defaults-row label { font-size: 13px; font-weight: 500; color: #555; }
.pe-select {
    padding: 6px 12px; border: 1px solid #d0d0d0; border-radius: 4px;
    font-size: 13px; background: #fff;
}
.pe-btn-secondary {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 14px; border: 1px solid #d0d0d0; border-radius: 4px;
    background: #fff; font-size: 13px; font-weight: 500; color: #333;
    cursor: pointer; transition: background 0.2s;
}
.pe-btn-secondary:hover { background: #f0f0f0; }
.pe-btn-primary {
    padding: 8px 20px; border: none; border-radius: 4px;
    background: #2980b9; color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer;
}
.pe-btn-primary:hover { background: #2471a3; }

/* ── PHOTO GRID ─────────────────────────── */
.pe-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px; margin-top: 16px;
}

.pe-photo-card {
    background: #fff; border-radius: 8px; border: 1px solid #e0e0e0;
    overflow: hidden; transition: box-shadow 0.2s;
}
.pe-photo-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.pe-photo-preview {
    position: relative; width: 100%;
    aspect-ratio: 3/2; overflow: hidden; background: #f0f0f0;
    cursor: pointer;
}
.pe-photo-preview img {
    width: 100%; height: 100%; object-fit: cover;
}
.pe-photo-crop-btn {
    position: absolute; bottom: 8px; right: 8px;
    padding: 4px 10px; border: none; border-radius: 4px;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 11px;
    cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.pe-photo-preview:hover .pe-photo-crop-btn { opacity: 1; }

.pe-photo-controls {
    padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.pe-photo-row {
    display: flex; align-items: center; gap: 8px;
}
.pe-photo-row label {
    font-size: 12px; font-weight: 500; color: #666; min-width: 55px;
}
.pe-photo-row select, .pe-photo-row input[type="number"] {
    flex: 1; padding: 5px 8px; border: 1px solid #d0d0d0;
    border-radius: 4px; font-size: 13px;
}
.pe-photo-row input[type="number"] { width: 60px; flex: none; text-align: center; }

.pe-photo-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-top: 1px solid #f0f0f0;
}
.pe-photo-price { font-size: 14px; font-weight: 600; color: #2980b9; }
.pe-photo-remove {
    background: none; border: none; color: #e74c3c; font-size: 12px;
    cursor: pointer; padding: 4px 8px;
}
.pe-photo-remove:hover { text-decoration: underline; }

/* ── CROP MODAL ─────────────────────────── */
.pe-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.pe-modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); }
.pe-modal-content {
    position: relative; background: #fff; border-radius: 12px;
    width: 90%; max-width: 600px; max-height: 90vh; overflow: auto;
}
.pe-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e0e0e0;
}
.pe-modal-header h3 { font-size: 16px; font-weight: 600; }
.pe-modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #666; }
.pe-modal-body { padding: 20px; }
.pe-crop-canvas-wrap {
    display: flex; justify-content: center; align-items: center;
    background: #f0f0f0; border-radius: 8px; overflow: hidden;
    min-height: 300px;
}
.pe-crop-canvas-wrap canvas { display: block; }
.pe-crop-info { margin-top: 12px; text-align: center; }
.pe-crop-info p { font-size: 13px; color: #666; }
.pe-modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 20px; border-top: 1px solid #e0e0e0;
}

/* ── LOADING ────────────────────────────── */
.pe-loading {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.85); z-index: 2000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pe-loading-spinner {
    width: 40px; height: 40px; border: 3px solid #e0e0e0;
    border-top-color: #2980b9; border-radius: 50%;
    animation: pe-spin 0.8s linear infinite;
}
@keyframes pe-spin { to { transform: rotate(360deg); } }
.pe-loading-text { margin-top: 12px; font-size: 14px; color: #555; }

/* ── RESPONSIVE ─────────────────────────── */
@media (max-width: 768px) {
    .pe-topbar { padding: 0 12px; flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
    .pe-total-display { order: 3; width: 100%; justify-content: center; }
    .pe-photo-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .pe-defaults-row { flex-direction: column; align-items: stretch; }
}
