/**
 * WooCommerce Product Personalizer – Frontend Styles
 */

/* ===== Wrapper ===== */
.wcpp-personalization-wrap {
    margin: 20px 0;
    padding: 20px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.wcpp-section-title {
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #96588a;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

/* ===== Field wrap ===== */
.wcpp-field-wrap {
    margin-bottom: 18px;
}

.wcpp-field-wrap:last-child {
    margin-bottom: 0;
}

/* ===== Labels ===== */
.wcpp-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.wcpp-label .required {
    color: #e00;
    margin-left: 2px;
}

/* ===== Name Input ===== */
.wcpp-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

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

.wcpp-input.wcpp-error {
    border-color: #e00;
}

/* ===== Char counter ===== */
.wcpp-char-counter {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #888;
}

.wcpp-char-counter.wcpp-limit-near {
    color: #e6a817;
}

.wcpp-char-counter.wcpp-limit-reached {
    color: #e00;
    font-weight: 600;
}

/* ===== Error messages ===== */
.wcpp-field-error {
    display: block;
    margin-top: 6px;
    color: #e00;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== Design Radio Options ===== */
.wcpp-design-options.wcpp-design-radio {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.wcpp-design-option {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100px;
    text-align: center;
    user-select: none;
}

.wcpp-design-option:hover {
    border-color: #96588a;
    box-shadow: 0 2px 8px rgba(150, 88, 138, 0.2);
}

.wcpp-design-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wcpp-design-option.wcpp-selected {
    border-color: #96588a;
    background: #f9f0f8;
    box-shadow: 0 0 0 3px rgba(150, 88, 138, 0.2);
}

/* Selected checkmark badge */
.wcpp-design-option.wcpp-selected::after {
    content: "✓";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #96588a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.wcpp-design-thumb img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.wcpp-design-label {
    font-size: 0.8rem;
    color: #555;
    word-break: break-word;
    line-height: 1.3;
}

/* ===== Zoom button on each design card ===== */
.wcpp-zoom-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(255,255,255,0.92);
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
    z-index: 2;
    line-height: 1;
}

.wcpp-zoom-btn svg {
    width: 13px;
    height: 13px;
    stroke: #555;
    display: block;
    pointer-events: none;
}

.wcpp-design-option:hover .wcpp-zoom-btn {
    opacity: 1;
}

.wcpp-zoom-btn:hover {
    background: #96588a !important;
    border-color: #96588a !important;
    transform: scale(1.1);
}

.wcpp-zoom-btn:hover svg {
    stroke: #fff;
}

/* ===== Design Preview bar ===== */
.wcpp-design-preview {
    margin-top: 14px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    animation: wcppFadeIn 0.2s ease;
}

.wcpp-preview-title {
    margin: 0;
    font-size: 0.85rem;
    color: #777;
}

.wcpp-preview-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.wcpp-preview-label {
    font-weight: 600;
    color: #333;
    flex: 1;
}

/* "View full size" link in preview bar */
.wcpp-preview-zoom {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #96588a;
    text-decoration: none;
    border: 1px solid #96588a;
    border-radius: 4px;
    padding: 3px 8px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.wcpp-preview-zoom svg {
    flex-shrink: 0;
}

.wcpp-preview-zoom:hover {
    background: #96588a;
    color: #fff;
}

/* ===== Cart design thumbnail ===== */
.wcpp-cart-design,
.wcpp-order-design {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wcpp-cart-design-img,
.wcpp-order-design-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    vertical-align: middle;
}

/* ===== Animations ===== */
@keyframes wcppFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================================================================== */
/*  LIGHTBOX                                                               */
/* ===================================================================== */

/* Scroll lock when lightbox is open */
body.wcpp-lb-body-lock {
    overflow: hidden;
}

/* Outer shell */
.wcpp-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.wcpp-lightbox.wcpp-lb-open {
    display: flex;
}

/* Semi-transparent backdrop */
.wcpp-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    animation: wcppLbFadeIn 0.2s ease;
}

/* Dialog card */
.wcpp-lb-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 92vh;
    animation: wcppLbSlideIn 0.22s ease;
}

/* Image wrapper */
.wcpp-lb-img-wrap {
    background: #111;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: min(820px, 90vw);
    max-height: min(600px, 72vh);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.wcpp-lb-img {
    display: block;
    max-width: 100%;
    max-height: min(600px, 72vh);
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.15s ease;
}

.wcpp-lb-img.wcpp-lb-img-loading {
    opacity: 0.3;
}

/* Footer – label + counter */
.wcpp-lb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 12px;
    padding: 0 4px;
    gap: 12px;
}

.wcpp-lb-label {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.wcpp-lb-counter {
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Close button */
.wcpp-lb-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.wcpp-lb-close svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    pointer-events: none;
}

.wcpp-lb-close:hover {
    background: rgba(255,255,255,0.28);
}

/* Prev / Next nav arrows */
.wcpp-lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    padding: 0;
    z-index: 2;
}

.wcpp-lb-prev { left: 20px; }
.wcpp-lb-next { right: 20px; }

.wcpp-lb-nav svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    pointer-events: none;
}

.wcpp-lb-nav:hover {
    background: rgba(150, 88, 138, 0.7);
    transform: translateY(-50%) scale(1.08);
}

/* Lightbox animations */
@keyframes wcppLbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes wcppLbSlideIn {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .wcpp-design-options.wcpp-design-radio {
        gap: 8px;
    }

    .wcpp-design-option {
        width: 80px;
        padding: 6px;
    }

    .wcpp-design-thumb img {
        width: 56px;
        height: 56px;
    }

    .wcpp-lb-nav {
        width: 36px;
        height: 36px;
    }

    .wcpp-lb-prev { left: 8px; }
    .wcpp-lb-next { right: 8px; }
}

/* ===== Frontend order details (My Account / Thank You page) ===== */
.wcpp-order-personalization {
    margin: 8px 0 4px;
}

.wcpp-order-meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #e8d5f0;
    border-radius: 4px;
    overflow: hidden;
}

.wcpp-order-meta-table th {
    background: #f5edfb;
    color: #5b2c6f;
    padding: 6px 10px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    width: 38%;
    vertical-align: top;
}

.wcpp-order-meta-table td {
    padding: 6px 10px;
    border-top: 1px solid #f0e8f8;
    color: #333;
    vertical-align: middle;
}

.wcpp-order-meta-table .wcpp-design-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wcpp-order-design-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.wcpp-design-option input[type="radio"] {
    pointer-events: none;
}
