/**
 * WooCommerce Product Carousel Styles
 * Designed to work seamlessly with Astra theme and Spectra plugin
 * 
 * Typography Customization:
 * Use CSS custom properties to customize typography:
 * 
 * --wpc-title-font-family: Font family for product titles
 * --wpc-title-font-size: Font size for product titles
 * --wpc-title-font-weight: Font weight for product titles
 * --wpc-title-line-height: Line height for product titles
 * --wpc-title-color: Color for product titles
 * --wpc-title-hover-color: Color for product titles on hover
 * 
 * --wpc-price-font-family: Font family for prices
 * --wpc-price-font-size: Font size for prices
 * --wpc-price-font-weight: Font weight for prices
 * --wpc-price-color: Color for prices
 * --wpc-price-amount-color: Color for price amounts
 * --wpc-price-del-color: Color for deleted prices
 * --wpc-price-sale-color: Color for sale prices
 */

/* ==========================================================================
   Carousel Wrapper & Container
   ========================================================================== */

.wpc-carousel-wrapper {
    position: relative;
    margin: 2rem 0;
    padding: 0 60px;
    clear: both;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}

.wpc-carousel-wrapper.wpc-loaded {
    opacity: 1;
    visibility: visible;
}

.wpc-carousel {
    position: relative;
    overflow: hidden;
}

/* Prevent vertical stacking before Slick initializes */
.wpc-carousel:not(.slick-initialized):not(.wpc-static-display) {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
}

/* Desktop pre-init fallback */
.wpc-carousel:not(.slick-initialized):not(.wpc-static-display) .wpc-product-item {
    flex: 0 0 25%;
    max-width: 25%;
    min-width: 0;
}

/* Remove default Slick margins and ensure equal heights */
.wpc-carousel .slick-list {
    margin: 0 -10px;
}

.wpc-carousel .slick-slide {
    padding: 0 10px;
    height: auto;
}

.wpc-carousel .slick-slide > div {
    height: 100%;
}

/* ==========================================================================
   Product Item & Card Styles
   ========================================================================== */

.wpc-product-item {
    outline: none;
    border: none;
    margin: 0;
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.wpc-product-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    transition: all 0.3s ease;
    box-shadow: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.wpc-product-card:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

/* ==========================================================================
   Product Image Styles
   ========================================================================== */

.wpc-product-image {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    flex-shrink: 0;
    border-radius: 6px;
}

.wpc-product-link {
    display: block;
    position: relative;
    text-decoration: none;
}

.wpc-product-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    border-radius: 6px;
}

.wpc-product-img.wpc-placeholder {
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
}

.wpc-product-card:hover .wpc-product-img {
    transform: scale(1.04);
}

/* Sale Badge */
.wpc-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #2FC1FF;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

/* ==========================================================================
   Product Info & Content
   ========================================================================== */

.wpc-product-info {
    padding: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.wpc-product-title {
    margin: 0 0 0.25rem 0 !important;
    font-size: var(--wpc-title-font-size, 1rem);
    line-height: var(--wpc-title-line-height, 1.4);
    font-weight: var(--wpc-title-font-weight, 600);
    font-family: var(--wpc-title-font-family, inherit);
    color: var(--wpc-title-color, #333);
    text-align: left;
    min-height: 2.8em;
    display: block;
}

/* Override theme h3 margins specifically for product titles */
.wpc-carousel-wrapper .wpc-product-title,
.wpc-carousel-wrapper .wpc-product-info .wpc-product-title,
.entry-content .wpc-carousel-wrapper .wpc-product-title,
.entry-content .wpc-product-title {
    margin-top: 0 !important;
    margin-bottom: 0.25rem !important;
}

.wpc-product-title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wpc-product-title-link:hover {
    color: var(--wpc-title-hover-color, #0073aa);
}

.wpc-product-price {
    margin: 0.5rem 0 1rem 0;
    font-size: var(--wpc-price-font-size, 1.1rem);
    font-weight: var(--wpc-price-font-weight, 600);
    font-family: var(--wpc-price-font-family, inherit);
    color: var(--wpc-price-color, #333);
    text-align: left;
}

.wpc-product-price .amount {
    color: var(--wpc-price-amount-color, #0073aa);
}

.wpc-product-price small {
    color: var(--wpc-price-subtitle-color, inherit);
    font-size: var(--wpc-price-subtitle-font-size, 0.85em);
    font-weight: var(--wpc-price-subtitle-font-weight, inherit);
    line-height: var(--wpc-price-subtitle-line-height, inherit);
}

.wpc-product-price del {
    color: var(--wpc-price-del-color, #999);
    font-weight: normal;
    margin-right: 0.5rem;
}

.wpc-product-price ins {
    text-decoration: none;
    color: var(--wpc-price-sale-color, #2FC1FF);
}

/* ==========================================================================
   Product Actions & Buttons
   ========================================================================== */

.wpc-product-actions {
    margin-top: auto;
    padding-top: 0.5rem;
}

.wpc-btn {
    display: inline-block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border: 2px solid #0073aa;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.wpc-btn:hover {
    background: #005a87;
    border-color: #005a87;
    color: #fff;
    transform: translateY(-1px);
}

.wpc-btn:active {
    transform: translateY(0);
}

.wpc-btn.wpc-view-product {
    background: #666;
    border-color: #666;
}

.wpc-btn.wpc-view-product:hover {
    background: #555;
    border-color: #555;
}

.wpc-btn.wpc-select-options {
    background: #2FC1FF;
    border-color: #2FC1FF;
}

.wpc-btn.wpc-select-options:hover {
    background: #1daee8;
    border-color: #1daee8;
}

/* Loading state */
.wpc-btn.wpc-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.wpc-btn.wpc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: wpc-spin 1s linear infinite;
}



/* Added-to-cart feedback state */
.wpc-carousel-wrapper .wpc-btn.wpc-added,
.wpc-carousel-wrapper .wpc-btn.wpc-added:visited,
.wpc-carousel-wrapper .wpc-btn.wpc-added:hover,
.wpc-carousel-wrapper .wpc-btn.wpc-added:focus,
.wpc-carousel-wrapper .wpc-btn.added.wpc-added,
.wpc-carousel-wrapper .wpc-btn.added.wpc-added:hover {
    background: #000000 !important;
    background-color: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
    transform: none !important;
    pointer-events: none;
}

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

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet Styles */
@media (max-width: 1024px) {
    .wpc-carousel-wrapper {
        padding: 0 40px;
    }

    .wpc-carousel:not(.slick-initialized):not(.wpc-static-display) .wpc-product-item {
        flex-basis: 33.3333%;
        max-width: 33.3333%;
    }
    
    .wpc-product-img {
        aspect-ratio: 1 / 1;
    }
    
    .wpc-product-title {
        font-size: 0.95rem;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .wpc-carousel-wrapper {
        margin: 1.5rem 0;
        padding: 0 20px;
    }

    .wpc-carousel:not(.slick-initialized):not(.wpc-static-display) .wpc-product-item {
        flex-basis: 100%;
        max-width: 100%;
    }
    
    .wpc-carousel .slick-list {
        margin: 0 -8px;
    }
    
    .wpc-carousel .slick-slide {
        padding: 0 8px;
    }
    
    .wpc-product-img {
        aspect-ratio: 1 / 1;
    }
    
    .wpc-product-title {
        font-size: 0.9rem;
        margin-bottom: 0.2rem !important;
    }
    
    .wpc-product-price {
        font-size: 1rem;
        margin: 0.4rem 0 0.75rem 0;
    }
    
    .wpc-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .wpc-carousel-wrapper {
        padding: 0 10px;
    }
    
    .wpc-product-img {
        aspect-ratio: 1 / 1;
    }
    
    .wpc-product-title {
        font-size: 0.85rem;
    }
    
    .wpc-product-price {
        font-size: 0.95rem;
    }
    
    .wpc-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   No Products Message
   ========================================================================== */

.wpc-no-products {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-style: italic;
    font-size: 1.1rem;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.wpc-error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 1rem 0;
}

/* ==========================================================================
   Astra Theme Compatibility
   ========================================================================== */

.ast-container .wpc-carousel-wrapper {
    width: 100%;
}

.ast-article-post .wpc-carousel-wrapper {
    margin: 2em 0;
}

/* ==========================================================================
   Spectra/UAGB Compatibility
   ========================================================================== */

.uagb-block-grid .wpc-carousel-wrapper,
.wp-block-group .wpc-carousel-wrapper {
    margin: 1.5em 0;
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

.wpc-carousel:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.wpc-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wpc-carousel {
        overflow: visible;
    }
    
    .wpc-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ==========================================================================
   Typography Utility Classes
   ========================================================================== */

/* Small Typography */
.wpc-carousel-wrapper.wpc-typography-small {
    --wpc-title-font-size: 0.9rem;
    --wpc-price-font-size: 1rem;
}

/* Large Typography */
.wpc-carousel-wrapper.wpc-typography-large {
    --wpc-title-font-size: 1.2rem;
    --wpc-price-font-size: 1.4rem;
}

/* Bold Typography */
.wpc-carousel-wrapper.wpc-typography-bold {
    --wpc-title-font-weight: 700;
    --wpc-price-font-weight: 700;
}

/* Light Typography */
.wpc-carousel-wrapper.wpc-typography-light {
    --wpc-title-font-weight: 400;
    --wpc-price-font-weight: 500;
}

/* Dark Theme Typography */
.wpc-carousel-wrapper.wpc-typography-dark {
    --wpc-title-color: #ffffff;
    --wpc-title-hover-color: #60a5fa;
    --wpc-price-color: #f3f4f6;
    --wpc-price-amount-color: #60a5fa;
}

/* ==========================================================================
   Carousel Controls - Progress Bar and Counter
   ========================================================================== */

.wpc-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 15px;
    width: 100%;
}

.wpc-progress-bar-container {
    width: 25%;
    max-width: 250px;
    height: 3px;
    background-color: #e0e0e0;
    border-radius: 2px;
    margin-right: 15px;
    overflow: hidden;
    order: 1;
}

.wpc-progress-bar {
    height: 100%;
    background-color: #000000;
    border-radius: 2px;
    transition: width 0.3s ease-in-out;
    width: 0%;
}

.wpc-slide-counter {
    font-size: 14px;
    color: #000000;
    font-weight: bold;
    white-space: nowrap;
    order: 3;
    margin: 0 10px;
}

/* Slick Arrow Overrides and Ordering */
.wpc-carousel-controls .slick-arrow {
    position: static;
    transform: none;
    background: transparent !important;
    border: none !important;
    padding: 0;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
}

.wpc-carousel-controls .slick-prev {
    order: 2;
    margin-right: 10px;
}

.wpc-carousel-controls .slick-next {
    order: 4;
    margin-left: 10px;
}

/* Arrow pseudo-elements for the arrow icons - Simple black arrows */
.wpc-carousel-controls .slick-prev:before,
.wpc-carousel-controls .slick-next:before {
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: #000000;
    opacity: 1;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-size: 20px;
    display: inline-block;
    width: auto;
    height: auto;
}

.wpc-carousel-controls .slick-prev:before {
    content: '‹';
}

.wpc-carousel-controls .slick-next:before {
    content: '›';
}

/* Styling for disabled state */
.wpc-carousel-controls .slick-prev.slick-disabled:before,
.wpc-carousel-controls .slick-next.slick-disabled:before {
    color: #cccccc !important;
    opacity: 0.7;
}

/* Hide original Slick arrows if they are still appearing elsewhere */
.wpc-carousel > .slick-prev,
.wpc-carousel > .slick-next {
    display: none !important;
}

/* Optional: Style for disabled arrows if not using infinite scroll */
.slick-prev.slick-disabled,
.slick-next.slick-disabled {
    opacity: 0.5;
    cursor: default;
}

/* Align arrows with the counter if they are outside the carousel */
.slick-slider {
    position: relative;
}

/* ==========================================================================
   Static Display Styles when slider is not needed
   ========================================================================== */

.wpc-carousel.wpc-static-display {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

.wpc-carousel.wpc-static-display .wpc-product-item {
    flex: 0 0 auto;
    width: calc(25% - 15px);
    min-width: 0;
}

/* Static display responsive widths based on wrapper classes */
.wpc-carousel-wrapper.wpc-1-desktop .wpc-carousel.wpc-static-display .wpc-product-item {
    width: 100%;
}

.wpc-carousel-wrapper.wpc-2-desktop .wpc-carousel.wpc-static-display .wpc-product-item {
    width: calc(50% - 10px);
}

.wpc-carousel-wrapper.wpc-3-desktop .wpc-carousel.wpc-static-display .wpc-product-item {
    width: calc(33.333% - 14px);
}

.wpc-carousel-wrapper.wpc-4-desktop .wpc-carousel.wpc-static-display .wpc-product-item {
    width: calc(25% - 15px);
}

.wpc-carousel-wrapper.wpc-5-desktop .wpc-carousel.wpc-static-display .wpc-product-item {
    width: calc(20% - 16px);
}

.wpc-carousel-wrapper.wpc-6-desktop .wpc-carousel.wpc-static-display .wpc-product-item {
    width: calc(16.666% - 17px);
}

/* Static display tablet responsive */
@media (max-width: 1024px) {
    .wpc-carousel-wrapper.wpc-1-tablet .wpc-carousel.wpc-static-display .wpc-product-item {
        width: 100%;
    }
    
    .wpc-carousel-wrapper.wpc-2-tablet .wpc-carousel.wpc-static-display .wpc-product-item {
        width: calc(50% - 10px);
    }
    
    .wpc-carousel-wrapper.wpc-3-tablet .wpc-carousel.wpc-static-display .wpc-product-item {
        width: calc(33.333% - 14px);
    }
    
    .wpc-carousel-wrapper.wpc-4-tablet .wpc-carousel.wpc-static-display .wpc-product-item,
    .wpc-carousel-wrapper.wpc-5-tablet .wpc-carousel.wpc-static-display .wpc-product-item,
    .wpc-carousel-wrapper.wpc-6-tablet .wpc-carousel.wpc-static-display .wpc-product-item {
        width: calc(33.333% - 14px);
    }
}

/* Static display mobile responsive */
@media (max-width: 768px) {
    .wpc-carousel-wrapper.wpc-1-mobile .wpc-carousel.wpc-static-display .wpc-product-item,
    .wpc-carousel-wrapper.wpc-2-mobile .wpc-carousel.wpc-static-display .wpc-product-item,
    .wpc-carousel-wrapper.wpc-3-mobile .wpc-carousel.wpc-static-display .wpc-product-item {
        width: calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .wpc-carousel.wpc-static-display .wpc-product-item {
        width: 100% !important;
    }
    
    .wpc-carousel.wpc-static-display {
        gap: 15px;
    }
}

/* Hide carousel controls when in static mode */
.wpc-carousel.wpc-static-display + .wpc-carousel-controls {
    display: none !important;
}
/* ========================================================================== 
   Version 2.0 Controls: Arrow placement options and enhanced buttons
   ========================================================================== */

.wpc-carousel-wrapper.wpc-arrows-none > .slick-arrow,
.wpc-carousel-wrapper.wpc-arrows-none .wpc-carousel-controls .slick-arrow {
    display: none !important;
}

.wpc-carousel-wrapper.wpc-arrows-sides {
    --wpc-side-arrow-size: 28px;
    --wpc-side-arrow-offset: 8px;
    padding-left: calc(var(--wpc-side-arrow-size) + var(--wpc-side-arrow-offset) + 14px);
    padding-right: calc(var(--wpc-side-arrow-size) + var(--wpc-side-arrow-offset) + 14px);
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-arrow {
    position: absolute !important;
    top: 38%;
    transform: translateY(-50%) !important;
    z-index: 5;
    width: var(--wpc-side-arrow-size) !important;
    height: var(--wpc-side-arrow-size) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 0 !important;
    line-height: 1 !important;
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-prev {
    left: var(--wpc-side-arrow-offset);
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-next {
    right: var(--wpc-side-arrow-offset);
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-prev:before,
.wpc-carousel-wrapper.wpc-arrows-sides > .slick-next:before {
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: #111111;
    opacity: 1;
    font-size: var(--wpc-side-arrow-size);
    line-height: 1;
    display: block;
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-prev:before {
    content: '‹';
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-next:before {
    content: '›';
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-arrow:hover {
    background: transparent !important;
    border-color: transparent !important;
}

.wpc-carousel-wrapper.wpc-arrows-sides > .slick-disabled {
    opacity: 0.45;
    cursor: default;
}

.wpc-carousel-wrapper.wpc-arrows-sides .wpc-carousel-controls {
    display: none !important;
}

.wpc-carousel-wrapper.wpc-arrows-sides .wpc-carousel-controls .slick-arrow,
.wpc-carousel-wrapper.wpc-arrows-none .wpc-carousel-controls .slick-arrow {
    display: none !important;
}

.wpc-carousel-wrapper .wpc-btn,
.wpc-carousel-wrapper .wpc-btn:visited {
    box-sizing: border-box;
}

.wpc-carousel-wrapper .wpc-btn:hover,
.wpc-carousel-wrapper .wpc-btn:focus {
    text-decoration: none;
}

@media (max-width: 768px) {
    .wpc-carousel-wrapper.wpc-arrows-sides {
        padding-left: calc(var(--wpc-side-arrow-size) + var(--wpc-side-arrow-offset) + 8px);
        padding-right: calc(var(--wpc-side-arrow-size) + var(--wpc-side-arrow-offset) + 8px);
    }

    .wpc-carousel-wrapper.wpc-arrows-sides > .slick-arrow {
        top: 36%;
    }
}

/* Extra breathing room so button borders/focus outlines are not clipped */
.wpc-product-carousel-wrapper {
    padding-bottom: 10px;
}

.wpc-product-carousel .slick-list {
    padding-bottom: 10px;
    padding-left: 3px;
    padding-right: 3px;
}

.wpc-product-item {
    padding-bottom: 10px;
}