/* =========================================================
   PARENT FOTOPOSTER CREATOR
   =========================================================
   Baskervville (ANRT Nancy, OFL) is the poster face. It is
   self-hosted rather than pulled from Google because the preview
   and the exported PNG have to render the same glyphs, and the
   export inlines this very file as base64. The pre-2026 printed
   originals were set in Baskerville Old Face. */

@font-face {
    font-family: 'Baskervville';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../../fonts/creators/Baskervville-Regular.woff2') format('woff2');
}

.pf-app {
    display: flex;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Controls panel ---- */
.pf-controls {
    flex: 0 0 400px;
    max-width: 400px;
}

.pf-page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #111;
}

.pf-page-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 28px;
}

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

.pf-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pf-hint {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}

.pf-warning {
    margin-top: 8px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: #6b4b00;
    background: #fff8e5;
    border: 1px solid #f0dca8;
    border-radius: 8px;
}

/* ---- Image upload ---- */
.pf-upload-area {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    min-height: 180px;
}

.pf-upload-area:hover,
.pf-upload-area.drag-over {
    border-color: #666;
    background: #fafafa;
}

.pf-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: #888;
    font-size: 14px;
}

.pf-upload-preview {
    max-height: 400px;
    overflow: hidden;
}

.pf-upload-preview img {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.pf-crop-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.pf-btn-sm {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pf-btn-confirm {
    background: #111;
    color: #fff;
}

.pf-btn-confirm:hover {
    background: #333;
}

.pf-btn-cancel {
    background: #e8e8e8;
    color: #333;
}

.pf-btn-cancel:hover {
    background: #ddd;
}

/* ---- Filters ---- */
.pf-filter-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pf-filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    transition: border-color 0.2s;
    width: 70px;
}

.pf-filter-btn:hover {
    border-color: #ccc;
}

.pf-filter-btn.active {
    border-color: #111;
}

.pf-filter-thumb {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
}

.pf-filter-name {
    font-size: 10px;
    color: #555;
    text-align: center;
    line-height: 1.2;
}

.pf-filter-btn.active .pf-filter-name {
    color: #111;
    font-weight: 600;
}

/* ---- Background colours ---- */
.pf-color-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pf-color-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, transform 0.15s;
    padding: 0;
}

.pf-color-btn:hover {
    transform: scale(1.1);
}

.pf-color-btn.active {
    border-color: #333;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.pf-color-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ---- Size dropdown ---- */
.pf-size-grid {
    position: relative;
}

.pf-size-dropdown {
    position: relative;
    width: 100%;
}

.pf-size-selected {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.pf-size-selected:hover { border-color: #999; }

.pf-size-dropdown.open .pf-size-selected {
    border-color: #999;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.pf-dropdown-arrow {
    margin-left: 8px;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.pf-size-dropdown.open .pf-dropdown-arrow {
    transform: rotate(180deg);
}

.pf-size-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.pf-size-dropdown.open .pf-size-options {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #999;
    border-top: none;
}

.pf-size-option {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.pf-size-option:last-child { border-bottom: none; }
.pf-size-option:hover { background: #f5f5f5; }
.pf-size-option.active { background: #f0f0f0; }

.pf-size-label {
    font-weight: 600;
    white-space: nowrap;
    color: #111;
    flex-shrink: 0;
}

.pf-size-price {
    font-size: 13px;
    color: #666;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Price & cart ---- */
.pf-cart-section {
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pf-price-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 18px;
}

#pf-price-label {
    font-weight: 600;
    color: #333;
}

#pf-price-value {
    font-weight: 700;
    color: #111;
}

.pf-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.pf-btn-cart {
    background: #111;
    color: #fff;
    margin-bottom: 10px;
}

.pf-btn-cart:hover { background: #333; }

.pf-btn-cart:disabled {
    background: #999;
    cursor: not-allowed;
}

.pf-btn-download {
    background: #fff;
    color: #333;
    border: 1px solid #d0d0d0;
}

.pf-btn-download:hover { background: #f5f5f5; }

.pf-btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Preview ---- */
.pf-preview-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: sticky;
    top: 100px;
}

.pf-preview {
    width: 100%;
    max-width: 580px;
    aspect-ratio: 5 / 7;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.pf-preview svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---- Cropper.js overrides ---- */
.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .pf-app {
        flex-direction: column;
        padding: 20px 16px;
        gap: 24px;
    }

    .pf-controls {
        flex: none;
        max-width: 100%;
    }

    .pf-preview-wrap {
        position: static;
        order: -1;
    }

    .pf-preview {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .pf-page-title { font-size: 20px; }

    .pf-filter-btn { width: 60px; }

    .pf-filter-thumb {
        width: 48px;
        height: 48px;
    }
}
