/* ================================================================
   POD Customizer — Frontend Styles v1.3
   Canvas replaces the product image. Options panel sits in the
   normal summary column. No layout changes to the theme needed.
   ================================================================ */

/* ── Canvas wrapper — sticky within the gallery column ────────────────── */
.podc-canvas-wrap {
    position: sticky;
    top: 20px;
    width: 100%;
    background: #f7f7f7;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}

/* Stretch the gallery column to match the summary column height
   so sticky has room to travel the full scroll distance */
.woocommerce-product-gallery.podc-image-hidden {
    visibility: visible !important;
    align-self: stretch;
}

/* Hide ALL original gallery images — canvas replaces them entirely */
.podc-image-hidden .woocommerce-product-gallery__image,
.podc-image-hidden .woocommerce-product-gallery__image a,
.podc-image-hidden .woocommerce-product-gallery__image img,
.podc-image-hidden .woocommerce-product-gallery__wrapper {
    display: none !important;
}

/* Thumbnails remain visible for color switching */
.podc-image-hidden .flex-control-thumbs,
.podc-image-hidden .flex-control-thumbs li,
.podc-image-hidden .flex-control-thumbs li img {
    display: block !important;
    visibility: visible !important;
}

#podc-canvas {
    display: block;
    width: 100% !important;
    height: auto !important;
    border-radius: 6px;
}

.podc-canvas-badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #fff;
    background: rgba(0,0,0,0.42);
    padding: 3px 12px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}

/* ── Options panel — sits inside the summary column naturally ──── */
.podc-wrap {
    margin: 0 0 16px;
}

.podc-options-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.podc-option-group {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fafafa;
}

.podc-option-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    margin-bottom: 8px;
}

/* ── Color swatches ─────────────────────────────────────────────── */
.podc-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.podc-color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid transparent;
    outline: 1px solid rgba(0,0,0,0.15);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.15s, transform 0.1s;
}

.podc-color-swatch:hover  { transform: scale(1.12); }
.podc-color-swatch.active { border-color: #96588a; transform: scale(1.1); }

.podc-selected-label { font-size: 12px; color: #888; margin-top: 5px; }

/* ── Design swatches ────────────────────────────────────────────── */
.podc-design-swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.podc-design-swatch {
    padding: 0;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    transition: border-color 0.15s, transform 0.1s;
    overflow: hidden;
}

.podc-design-swatch img { display: block; width: 52px; height: 52px; object-fit: cover; border-radius: 5px; }
.podc-design-swatch:hover  { transform: scale(1.06); }
.podc-design-swatch.active { border-color: #96588a; }

/* ── Text fields ────────────────────────────────────────────────── */
.podc-text-field-wrap { margin-bottom: 8px; }
.podc-text-field-wrap:last-child { margin-bottom: 0; }

.podc-text-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s;
}

.podc-text-input:focus {
    border-color: #96588a;
    outline: none;
    box-shadow: 0 0 0 2px rgba(150,88,138,0.15);
}

/* Textarea specific */
textarea.podc-text-input {
    resize: vertical;
    min-height: 72px;
    line-height: 1.5;
}

.podc-char-count { font-size: 11px; color: #bbb; text-align: right; margin-top: 2px; }

/* ── Font swatches ──────────────────────────────────────────────── */
.podc-font-swatches { display: flex; flex-wrap: wrap; gap: 6px; }

.podc-font-swatch {
    padding: 5px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    font-size: 14px;
    transition: border-color 0.15s;
    white-space: nowrap;
}

.podc-font-swatch:hover  { border-color: #96588a; }
.podc-font-swatch.active { border-color: #96588a; background: #fdf6fc; color: #96588a; }

/* ── Text color ─────────────────────────────────────────────────── */
.podc-color-picker-wrap { display: flex; align-items: center; gap: 10px; }

.podc-color-picker-wrap input[type="color"] {
    width: 38px; height: 34px; padding: 2px;
    border: 1px solid #ddd; border-radius: 6px;
    cursor: pointer; background: none;
}

.podc-color-hex { font-size: 13px; color: #666; font-family: monospace; }

/* ── Photo upload ───────────────────────────────────────────────── */
.podc-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fff;
}

.podc-upload-area:hover,
.podc-upload-area.drag-over { border-color: #96588a; background: #fdf6fc; }
.podc-upload-area.has-image { border-style: solid; border-color: #96588a; padding: 8px; }

.podc-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #aaa; font-size: 13px; }
.podc-upload-placeholder svg { color: #ccc; }

#podc-photo-thumb { max-width: 100%; max-height: 80px; border-radius: 4px; display: block; margin: 0 auto; }

.podc-remove-btn {
    display: block; margin: 6px auto 0;
    background: transparent; color: #c00;
    border: 1px solid #c00; padding: 3px 10px;
    font-size: 12px; border-radius: 4px; cursor: pointer;
}

.podc-remove-btn:hover { background: #c00; color: #fff; }
.podc-hint-sm { font-size: 11px; color: #aaa; margin: 4px 0 0; }

/* ── AI Group — two-column layout ──────────────────────────────────────── */
#podc-ai-group {
    padding: 0;
    border: none;
    background: transparent;
}

.podc-ai-two-col {
    display: flex;
    gap: 0;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    min-height: 240px;
}

/* Left: style gallery */
.podc-ai-gallery-col {
    width: 42%;
    flex-shrink: 0;
    border-right: 1px solid #e8e8e8;
    padding: 12px;
    background: #f4f4f4;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.podc-ai-gallery-col .podc-option-label {
    margin-bottom: 4px;
}

.podc-ai-style-swatches {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.podc-ai-style-swatch {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    padding: 6px 8px;
    text-align: left;
    width: 100%;
    transition: border-color .2s, box-shadow .2s;
}

.podc-ai-style-swatch img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.podc-ai-style-swatch span {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.podc-ai-style-swatch.active {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px #2271b133;
    background: #f0f6ff;
}

.podc-ai-style-swatch:hover {
    border-color: #999;
}

/* Right: upload + generate controls */
.podc-ai-controls-col {
    flex: 1;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.podc-ai-controls-col .podc-option-label {
    margin-bottom: 2px;
}

/* Upload area */
#podc-ai-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    transition: border-color .2s, background .2s;
    position: relative;
    min-height: 100px;
}

#podc-ai-upload-area:hover,
#podc-ai-upload-area.drag-over {
    border-color: #2271b1;
    background: #f0f6ff;
}

#podc-ai-upload-area.has-image {
    border-style: solid;
    border-color: #2271b1;
}

#podc-ai-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 12px;
}

#podc-ai-placeholder svg { color: #bbb; }

#podc-ai-thumb {
    max-width: 100px;
    max-height: 100px;
    border-radius: 6px;
    object-fit: contain;
}

/* Progress */
#podc-ai-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#podc-ai-status {
    font-size: 12px;
    color: #555;
    text-align: center;
}

.podc-ai-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #eee;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: podc-spin 0.8s linear infinite;
}

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

.podc-hint-sm {
    font-size: 11px;
    color: #999;
    margin: 0;
    text-align: center;
}

/* Generate button */
.podc-generate-btn {
    width: 100%;
    padding: 10px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.podc-generate-btn:hover  { background: #135e96; }
.podc-generate-btn:disabled { background: #aaa; cursor: not-allowed; }

/* Remove button */
.podc-remove-btn {
    display: block;
    margin: 4px auto 0;
    background: transparent;
    color: #c00;
    border: 1px solid #c00;
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.podc-remove-btn:hover { background: #c00; color: #fff; }

/* Mobile: stack columns */
@media (max-width: 480px) {
    .podc-ai-two-col {
        flex-direction: column;
    }
    .podc-ai-gallery-col {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e8e8e8;
    }
    .podc-ai-style-swatches {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .podc-ai-style-swatch {
        width: calc(50% - 4px);
        flex-direction: column;
        text-align: center;
    }
    .podc-ai-style-swatch img {
        width: 100%;
        height: 60px;
    }
}

/* ── Hide native WooCommerce variation selectors when POD plugin handles them ── */
/* The selects still work and sync — they just aren't shown to the customer */
/* ── Hide only the color attribute row — leave size and other variations visible ── */
/* We hide individual <tr> rows whose select matches a plugin color swatch value    */
/* This is done via JS (see frontend.js) since we need to inspect option values     */
form.variations_form.podc-active .woocommerce-variation-description,
form.variations_form.podc-active .woocommerce-variation-price {
    display: none !important;
}

/* ── AI section — inline inside summary column ───────────────────────────── */
.podc-ai-fullwidth {
    margin: 0 0 12px;
}

.podc-ai-fw-inner { border: none; background: transparent; }

.podc-ai-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    margin-bottom: 8px;
}

/* Simple vertical stack inside summary column */
.podc-ai-fullwidth .podc-ai-two-col {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.podc-ai-fullwidth .podc-ai-gallery-col {
    width: 100%;
    border-right: none;
    border-bottom: none;
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
}

/* Scrollable horizontal strip — compact for summary column */
.podc-ai-fullwidth .podc-ai-style-swatches {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    -webkit-overflow-scrolling: touch;
}

.podc-ai-fullwidth .podc-ai-style-swatches::-webkit-scrollbar { height: 4px; }
.podc-ai-fullwidth .podc-ai-style-swatches::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.podc-ai-fullwidth .podc-ai-style-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    padding: 5px;
    text-align: center;
    flex-shrink: 0;
    width: 90px;
    transition: border-color .2s, box-shadow .2s;
}

/* Aspect ratio */
.podc-ai-fullwidth .podc-ai-style-swatches[data-aspect="portrait"]  .podc-ai-style-swatch img { aspect-ratio: 3/4; }
.podc-ai-fullwidth .podc-ai-style-swatches[data-aspect="landscape"] .podc-ai-style-swatch img { aspect-ratio: 4/3; }
.podc-ai-fullwidth .podc-ai-style-swatches[data-aspect="square"]    .podc-ai-style-swatch img { aspect-ratio: 1/1; }

.podc-ai-fullwidth .podc-ai-style-swatch img {
    width: 100%;
    object-fit: cover;
    border-radius: 5px;
    display: block;
    margin-bottom: 4px;
}

.podc-ai-fullwidth .podc-ai-style-swatch span {
    font-size: 10px;
    font-weight: 600;
    color: #444;
    line-height: 1.2;
}

.podc-ai-fullwidth .podc-ai-style-swatch.active {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px #2271b133;
}

.podc-ai-fullwidth .podc-ai-style-swatch:hover { border-color: #999; }

.podc-ai-fullwidth .podc-ai-controls-col {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.podc-ai-fullwidth #podc-ai-upload-area {
    min-height: 80px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    font-size: 13px;
    color: #888;
    padding: 12px;
}

.podc-ai-fullwidth #podc-ai-upload-area:hover,
.podc-ai-fullwidth #podc-ai-upload-area.drag-over {
    border-color: #2271b1;
    background: #f0f6ff;
}

.podc-ai-fullwidth #podc-ai-upload-area.has-image {
    border-style: solid;
    border-color: #2271b1;
}

.podc-ai-fullwidth #podc-ai-placeholder { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 8px; 
    color: #999;
}

.podc-ai-fullwidth #podc-ai-placeholder small { font-size: 11px; color: #bbb; }

.podc-ai-fullwidth #podc-ai-thumb {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    object-fit: contain;
}

.podc-ai-fullwidth .podc-generate-btn {
    padding: 14px;
    font-size: 16px;
}

/* Mobile — controls stack vertically */
@media (max-width: 600px) {
    .podc-ai-fullwidth .podc-ai-controls-col { flex-direction: column; }
    .podc-ai-fullwidth .podc-ai-style-swatch  { width: 110px; }
}

/* ── Relocated Add to Cart block (moved below AI section by JS) ─────────── */
.podc-atc-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 24px;
}

.podc-atc-wrap form.cart,
.podc-atc-wrap form.variations_form .single_add_to_cart_button {
    margin-top: 0;
}

/* ── Hide PayPal button in product summary (shows at checkout) ───────────── */
.summary .wp-ppcp-button-wrapper,
.summary .wc-ppcp-button,
.entry-summary .wp-ppcp-button-wrapper,
.entry-summary .wc-ppcp-button,
.summary [id*="ppcp"],
.entry-summary [id*="ppcp"] {
    display: none !important;
}
