/**
 * WooCommerce Product Customizer - Public Styles
 */

/* ── Layout ──────────────────────────────────────────────── */
#wpc-product-customizer {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

.wpc-preview-section { flex: 1; min-width: 280px; }

.wpc-canvas-wrapper {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

#wpc-live-preview {
    display: block;
    width: 100%;
    height: auto;
    background: #f7f7f7;
}

.wpc-controls-section {
    flex: 1;
    min-width: 260px;
}

.wpc-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 18px;
    color: #111;
}

.wpc-fields-container { display: flex; flex-direction: column; gap: 16px; }

.wpc-field-group { display: flex; flex-direction: column; gap: 6px; }

.wpc-label { font-weight: 600; font-size: .92rem; color: #333; }

/* Text input */
.wpc-input-field {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color .2s, box-shadow .2s;
}
.wpc-input-field:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
    outline: none;
}

/* ── Logo / File upload ───────────────────────────────────── */
.wpc-logo-upload-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.wpc-logo-preview {
    width: 60px;
    height: 60px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: repeating-conic-gradient(#eee 0% 25%,#fff 0% 50%) 0 0/12px 12px;
}
.wpc-logo-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }

.wpc-file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2271b1;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 600;
    transition: background .2s;
}
.wpc-file-label:hover { background: #135e96; }

.wpc-file-input {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
}

.wpc-file-name { font-size: .82rem; color: #888; }

/* ── Background Gallery ──────────────────────────────────── */
.wpc-backgrounds-section { display: flex; flex-direction: column; gap: 8px; }

.wpc-bg-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wpc-bg-thumb {
    position: relative;
    width: 72px;
    flex-shrink: 0;
    border: 3px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    padding: 0;
    transition: border-color .2s, transform .15s;
}
.wpc-bg-thumb:hover  { border-color: #2271b1; transform: scale(1.04); }
.wpc-bg-thumb.selected { border-color: #d63638; box-shadow: 0 0 0 2px rgba(214,54,56,.25); }

.wpc-bg-thumb img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
}

.wpc-bg-name {
    display: block;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 10px;
    text-align: center;
    padding: 3px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Overlay & Spinner ───────────────────────────────────── */
.wpc-overlay {
    position: absolute; inset: 0;
    background: rgba(255,255,255,.75);
    display: flex; justify-content: center; align-items: center;
    z-index: 20;
}
.wpc-spinner {
    width: 38px; height: 38px;
    border: 4px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wpc-spin 1s linear infinite;
}
@keyframes wpc-spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    #wpc-product-customizer { flex-direction: column; }
}
