.pcfw-carousel-wrapper {
    margin: 2rem 0;
    padding: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: var(--pcfw-wrapper-bg, var(--wp--preset--color--background, #ffffff));
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
    max-width: 100%;
}

.pcfw-carousel-header {
    margin-bottom: 1.25rem;
}

.pcfw-carousel-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
}

.pcfw-carousel {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(280px, 320px);
    gap: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.25rem 0.25rem 0.75rem;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-x pan-y;
}

.pcfw-carousel.pcfw-is-dragging {
    cursor: grabbing;
}

.pcfw-carousel, .pcfw-carousel * {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-drag: none;
}

.pcfw-carousel a, .pcfw-carousel img {
    pointer-events: auto;
}

.pcfw-carousel::-webkit-scrollbar {
    display: none;
}

.pcfw-product-card {
    position: relative;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 14px;
    background: var(--pcfw-card-bg, var(--wp--preset--color--white, #fff));
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.pcfw-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.pcfw-product-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

/* Image container - generous height, centered whitespace, zero cropping */
.pcfw-carousel-wrapper .pcfw-product-image-wrap,
.pcfw-product-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 380px;
    min-height: 320px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    box-sizing: border-box;
    position: relative;
}

.pcfw-hidden {
    display: none !important;
}

/* Image - natural aspect ratio, contain, never cropped */
.pcfw-carousel-wrapper .pcfw-product-image-wrap img,
.pcfw-carousel-wrapper .pcfw-product-image,
.pcfw-product-image {
    display: block !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    margin: 0 auto !important;
    transition: transform 0.25s ease;
}

.pcfw-product-card:hover .pcfw-product-image {
    transform: scale(1.02);
}

.pcfw-product-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 200px;
    color: #64748b;
    background: #f1f5f9;
    font-size: 0.95rem;
}

.pcfw-product-content {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pcfw-product-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    max-height: calc(1.35em * 2);
    color: #1e293b;
}

.pcfw-product-rating,
.pcfw-product-stock,
.pcfw-product-price {
    font-size: 0.95rem;
}

.pcfw-product-stock.instock {
    color: #047857;
    font-weight: 500;
}

.pcfw-product-stock.outofstock {
    color: #b91c1c;
    font-weight: 500;
}

.pcfw-product-price {
    font-weight: 700;
    color: #0f172a;
    font-size: 1.05rem;
}

.pcfw-product-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.pcfw-product-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    background: var(--pcfw-button-bg, var(--wp--preset--color--primary, #2563eb));
    color: var(--pcfw-button-text, #ffffff);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    box-sizing: border-box;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pcfw-product-button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.pcfw-carousel-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pcfw-carousel-button {
    border: 0;
    border-radius: 999px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    background: #111827;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s ease;
}

.pcfw-carousel-button:hover {
    background: #374151;
}

.pcfw-product-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
}

.pcfw-product-categories {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0.15rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Button alignment modifiers */
.pcfw-button-align-left .pcfw-product-card-footer {
    justify-content: flex-start;
}

.pcfw-button-align-center .pcfw-product-card-footer {
    justify-content: center;
}

.pcfw-button-align-right .pcfw-product-card-footer {
    justify-content: flex-end;
}

/* Layout variants */
.pcfw-layout-classic .pcfw-product-card {
    border-radius: 8px;
}

.pcfw-layout-classic .pcfw-product-image-wrap {
    border-radius: 6px;
    height: 300px;
}

.pcfw-layout-compact .pcfw-carousel {
    grid-auto-columns: minmax(220px, 260px);
    gap: 0.85rem;
}

.pcfw-layout-compact .pcfw-product-card {
    padding: 0.75rem;
}

.pcfw-layout-compact .pcfw-product-image-wrap {
    height: 240px;
    min-height: 200px;
}

/* Template: Image-focused */
.pcfw-template-image .pcfw-carousel {
    grid-auto-columns: minmax(260px, 320px);
}

.pcfw-template-image .pcfw-product-card {
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pcfw-template-image .pcfw-product-image-wrap {
    height: 340px;
    min-height: 280px;
    border-radius: 12px;
    background: #f1f5f9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcfw-product-image-overlay {
    display: none !important;
}

.pcfw-template-image .pcfw-product-image-overlay {
    display: flex !important;
    align-items: flex-end;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem 1rem 0.75rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.75) 100%);
    z-index: 2;
    pointer-events: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.pcfw-template-image .pcfw-product-title-overlay {
    margin: 0;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pcfw-template-image .pcfw-product-content {
    display: none;
}

.pcfw-template-image .pcfw-product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.25rem 0;
    background: transparent;
}

.pcfw-template-image .pcfw-product-price {
    margin: 0;
    color: #111827;
    font-size: 1.05rem;
    font-weight: 700;
}

.pcfw-template-image .pcfw-product-button {
    width: auto;
    padding: 0.65rem 1.1rem;
    white-space: nowrap;
}

/* Template: Hero */
.pcfw-template-hero .pcfw-carousel {
    grid-auto-columns: minmax(280px, 340px);
}

.pcfw-template-hero .pcfw-product-card {
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pcfw-template-hero .pcfw-product-image-wrap {
    height: 350px;
    min-height: 300px;
    border-radius: 12px;
    background: #f8fafc;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcfw-template-hero .pcfw-product-image-overlay {
    display: none;
}

.pcfw-template-hero .pcfw-product-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 0 0;
    text-align: center;
}

.pcfw-template-hero .pcfw-product-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    text-align: center;
}

.pcfw-template-hero .pcfw-product-price {
    margin: 0;
    color: #111827;
    font-size: 1.15rem;
    font-weight: 800;
}

.pcfw-template-hero .pcfw-product-card-footer-hero {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.pcfw-template-hero .pcfw-product-card-footer-hero .pcfw-product-button {
    width: 100%;
    text-align: center;
}

/* Template: Minimal */
.pcfw-template-minimal .pcfw-carousel {
    grid-auto-columns: minmax(260px, 300px);
}

.pcfw-template-minimal .pcfw-product-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.pcfw-template-minimal .pcfw-product-image-wrap {
    height: 280px;
    min-height: 240px;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pcfw-template-minimal .pcfw-product-button {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
}

.pcfw-template-minimal .pcfw-product-content {
    gap: 0.25rem;
}

.pcfw-empty {
    padding: 1rem;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
}

/* Admin settings page & preview styles */
.pcfw-admin-wrap .pcfw-admin-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(340px, 1fr) minmax(360px, 1.4fr);
    align-items: start;
}

.pcfw-admin-wrap .pcfw-admin-panel {
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-sizing: border-box;
}

.pcfw-admin-preview {
    margin-top: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.pcfw-admin-preview .pcfw-carousel-wrapper {
    margin: 1rem 0 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.pcfw-admin-preview .pcfw-carousel {
    grid-auto-columns: minmax(240px, 280px);
    gap: 1rem;
}

.pcfw-admin-preview .pcfw-product-image-wrap {
    height: 280px;
    min-height: 240px;
}

.pcfw-preview-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.pcfw-preview-control-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.75rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    font-size: 0.95rem;
}

.pcfw-preview-control-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
}

.pcfw-preview-control-row select {
    width: 100%;
    max-width: 150px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 0.55rem 0.6rem;
    background: #ffffff;
}

.pcfw-preview-control-row--full {
    grid-column: 1 / -1;
}

/* Responsive queries */
@media (max-width: 1080px) {
    .pcfw-admin-wrap .pcfw-admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pcfw-carousel {
        grid-auto-columns: minmax(240px, 280px);
        gap: 1rem;
    }

    .pcfw-carousel-wrapper .pcfw-product-image-wrap,
    .pcfw-product-image-wrap {
        height: 320px;
        min-height: 260px;
    }

    .pcfw-template-image .pcfw-product-image-wrap,
    .pcfw-template-hero .pcfw-product-image-wrap {
        height: 330px;
        min-height: 280px;
    }

    .pcfw-template-minimal .pcfw-product-image-wrap {
        height: 280px;
        min-height: 240px;
    }

    .pcfw-template-image .pcfw-product-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .pcfw-template-image .pcfw-product-button {
        width: 100%;
        text-align: center;
    }
}

/* Mobile Screens (Phones) - 1 single full card visible */
@media (max-width: 580px) {
    .pcfw-carousel-wrapper {
        padding: 0.85rem;
        border-radius: 14px;
        margin: 1.25rem 0;
    }

    .pcfw-carousel {
        grid-auto-columns: calc(100% - 0.25rem);
        gap: 1rem;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.5rem;
    }

    .pcfw-product-card {
        width: 100%;
        min-width: 0;
        scroll-snap-align: center;
        padding: 1rem;
        box-sizing: border-box;
    }

    .pcfw-carousel-wrapper .pcfw-product-image-wrap,
    .pcfw-product-image-wrap {
        height: 380px;
        min-height: 340px;
        width: 100%;
        border-radius: 12px;
    }

    .pcfw-template-image .pcfw-product-image-wrap,
    .pcfw-template-hero .pcfw-product-image-wrap {
        height: 400px;
        min-height: 350px;
    }

    .pcfw-template-minimal .pcfw-product-image-wrap {
        height: 340px;
        min-height: 300px;
    }

    .pcfw-product-card-footer {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .pcfw-product-button {
        width: 100% !important;
        white-space: normal !important;
        text-align: center !important;
        padding: 0.85rem 1.25rem !important;
        font-size: 1rem !important;
        line-height: 1.25 !important;
        box-sizing: border-box !important;
    }
}
