/**
 * KS Product Showcase - Frontend Styles
 *
 * @package KS_Product_Showcase
 * @version 1.2.3
 */

/* Base reset */
.ksps-showcase {
    box-sizing: border-box;
    width: 100%;
}

.ksps-showcase *,
.ksps-showcase *::before,
.ksps-showcase *::after {
    box-sizing: border-box;
}

.ksps-showcase a {
    text-decoration: none;
}

/* Section header — one line, frachtbedarf.de style (v1.2.0):
   title + subtitle inline left, "Se alle" link right, vertically centered.
   v1.2.1: border-bottom added — frachtbedarf's module-header has its own
   1.5px #e2e8f0 line between the header and the product row. */
.ksps-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1.5px solid #e2e8f0;
}

.ksps-section-header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.ksps-section-title {
    font-size: 20px; /* v1.2.3: 24 -> 20, matches the Nyheder header (Sascha's spec) */
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.ksps-section-subtitle {
    font-size: 13px;
    color: #bad1e2; /* v1.2.3: #64748b -> #bad1e2, matches the banner subtitles (Sascha's spec) */
    margin: 0;
    padding: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ksps-section-link {
    font-size: 15px;
    color: #e74c3c;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
    transition: color 0.2s ease;
}

.ksps-section-link:hover {
    color: #c0392b;
    text-decoration: underline;
}

/* Grid */
.ksps-grid {
    display: grid;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Carousel (v1.2.0): wrapper holds the arrow buttons.
   v1.2.2: arrow vertical position (top) is set by JS to the middle of the
   product IMAGE (not the whole card), frachtbedarf style; hover colors are
   locked with !important because the theme's button:hover turned the arrow white. */
.ksps-carousel-wrap {
    position: relative;
}

.ksps-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #333333;
    border: 1.5px solid #e2e8f0;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, background 0.2s ease;
}

.ksps-carousel-prev {
    left: -22px;
}

.ksps-carousel-next {
    right: -22px;
}

.ksps-carousel-wrap:hover .ksps-carousel-btn {
    opacity: 1;
    pointer-events: auto;
}

.ksps-carousel-btn:hover,
.ksps-carousel-btn:focus,
.ksps-carousel-btn:active {
    background: #f8f8f8 !important;
    color: #333333 !important;
    border-color: #e2e8f0 !important;
}

.ksps-carousel-wrap:hover .ksps-carousel-btn:disabled,
.ksps-carousel-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

.ksps-carousel-btn svg {
    display: block;
}

/* Product card */
.ksps-product-card {
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

/* Image wrap */
.ksps-product-image-wrap {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.ksps-product-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.ksps-product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s ease;
    padding: 10px;
}

/* Image aspect ratios */
.ksps-ratio-square {
    aspect-ratio: 1 / 1;
}

.ksps-ratio-portrait {
    aspect-ratio: 3 / 4;
}

.ksps-ratio-landscape {
    aspect-ratio: 4 / 3;
}

.ksps-ratio-auto {
    aspect-ratio: auto;
}

/* Image hover effects */
.ksps-img-hover-zoom:hover .ksps-product-image {
    transform: scale(1.08);
}

.ksps-img-hover-fade:hover .ksps-product-image {
    opacity: 0.85;
}

.ksps-img-hover-slide-up:hover .ksps-product-image {
    transform: translateY(-5px);
}

/* Sale badge */
.ksps-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    border-radius: 3px;
    line-height: 1.4;
}

/* Quick view icon — always visible.
   v1.2.0: hover color/background is locked per instance in the dynamic CSS
   (#instance .ksps-quick-view:hover) so theme a:hover rules cannot recolor it. */
.ksps-quick-view {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 1;
    transform: none;
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 2;
    text-decoration: none !important;
}

.ksps-quick-view svg {
    display: block;
}

.ksps-quick-view:hover {
    transform: scale(1.1) !important;
}

/* Product info */
.ksps-product-info {
    padding: 12px 15px 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ksps-product-title-link {
    text-decoration: none !important;
}

.ksps-product-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

/* Rating */
.ksps-product-rating {
    margin: 5px 0;
}

.ksps-product-rating .star-rating {
    font-size: 12px;
    color: #ffc107;
}

/* Price */
.ksps-product-price {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.ksps-tax-label {
    font-size: 11px;
    color: #999;
    font-weight: 400;
}

/* Add to cart button */
.ksps-add-to-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    width: 100%;
    text-align: center;
    line-height: 1.4;
}

.ksps-add-to-cart:hover {
    opacity: 0.9;
}

.ksps-add-to-cart svg {
    flex-shrink: 0;
}

/* Button styles */
.ksps-btn-button,
.ksps-btn-icon-text {
    /* Colors set via dynamic CSS */
}

.ksps-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #f0f0f0;
    color: #333;
}

.ksps-btn-icon:hover {
    background: #e0e0e0;
}

.ksps-btn-text {
    background: transparent;
    color: #e74c3c;
    padding: 8px 0;
    font-weight: 600;
}

.ksps-btn-text:hover {
    text-decoration: underline !important;
}

/* Loading state */
.ksps-add-to-cart.ksps-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.ksps-add-to-cart.ksps-added {
    background: #27ae60 !important;
    color: #fff !important;
}

/* Shadow presets */
.ksps-shadow-small {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ksps-shadow-medium {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ksps-shadow-large {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.ksps-shadow-hover-small:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ksps-shadow-hover-medium:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ksps-shadow-hover-large:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

/* Card style variants */

/* Standard: clean card with image and info below */
.ksps-style-standard .ksps-product-card {
    /* Base styling */
}

/* Overlay: info overlays the bottom of image */
.ksps-style-overlay .ksps-product-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(255,255,255,0.95));
    padding: 30px 15px 15px;
    z-index: 1;
}

.ksps-style-overlay .ksps-product-card {
    position: relative;
}

.ksps-style-overlay .ksps-product-image-wrap {
    border-radius: inherit;
}

/* Minimal: no borders, no background, clean look */
.ksps-style-minimal .ksps-product-card {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.ksps-style-minimal .ksps-product-info {
    padding: 10px 0;
}

/* Bordered: prominent border, no shadow */
.ksps-style-bordered .ksps-product-card {
    border-width: 2px !important;
    box-shadow: none !important;
}

.ksps-style-bordered .ksps-product-card:hover {
    border-color: #e74c3c !important;
}

/* Floating: lift on hover */
.ksps-style-floating .ksps-product-card:hover {
    transform: translateY(-5px);
}

/* Responsive */
@media (max-width: 575px) {
    .ksps-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .ksps-section-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .ksps-section-title {
        white-space: normal;
    }

    .ksps-section-subtitle {
        white-space: normal;
    }

    .ksps-product-info {
        padding: 8px 10px 10px;
    }

    .ksps-product-image {
        padding: 5px;
    }

    .ksps-carousel-btn {
        display: none;
    }
}
