/* KN Product Image Widget */

/* Ensure nav dropdown menus appear above product badge */
.elementor-nav-menu .sub-menu,
.elementor-widget-nav-menu .sub-menu,
.menu .sub-menu,
.dropdown-menu,
[class*="nav-menu"] .sub-menu {
    z-index: 99999 !important;
}

.kn-product-image-wrapper {
    width: 100%;
    position: relative;
    z-index: 0;
}

.kn-product-image-main {
    width: 100%;
    margin-bottom: 0;
    line-height: 0;
    position: relative;
}

/* Expired deal: grey ribbon + overlay on main image */
.kn-product-image-wrapper.kn-product-image-deal-expired .kn-product-image-main {
    opacity: 0.9;
}
.kn-product-image-main-inner {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 6px;
}
/* Ribbon – same as kn-price-table-widget (deal-expired: gray) */
.kn-product-image-wrapper .kn-price-table-ribbon {
    width: 200px;
    height: 35px;
    line-height: 35px;
    background-color: rgba(28, 28, 28, 0.85);
    color: #fff;
    position: absolute;
    text-align: center;
    top: 38px;
    font-size: 20px;
    z-index: 10;
}
.kn-product-image-wrapper .kn-price-table-ribbon__text {
    display: block;
}
.kn-product-image-wrapper .kn-price-table-ribbon--top-left {
    left: -42px;
    transform: rotate(-45deg);
}
.kn-product-image-wrapper .kn-price-table-ribbon--deal-expired {
    background-color: rgba(28, 28, 28, 0.85) !important;
}
.kn-product-image-deal-expired-cover {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    pointer-events: none;
    z-index: 2;
}

.kn-product-image-main a {
    display: block;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
}

.kn-product-image-main img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    vertical-align: top;
}

/* Percentage badge on top of main image (like kn-marktplatz-shop-widget) */
.kn-product-image-wrapper .knshop-badge {
    position: absolute;
    top: 0;
    right: 20px;
    background: #db584a;
    color: #f6f4f2;
    font-family: 'Lato-local', Arial, sans-serif;
    font-weight: 900;
    font-size: 24px;
    border-radius: 0;
    width: 120px;
    height: 35px;
    text-align: center;
    line-height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    letter-spacing: 0.5px;
}
/* Deal abgelaufen: badge darker/gray like ribbon and label (same as kn-shop-page-widget) */
.kn-product-image-wrapper.kn-product-image-deal-expired .knshop-badge {
    background: #5a5a5a !important;
}

/* Label under main image: countdown or Deal abgelaufen */
.kn-product-image-wrapper .knshop-label {
    width: 100%;
    background: #db584a;
    color: #f6f4f2;
    font-family: 'Lato-local', Arial, sans-serif;
    font-size: 10px;
    text-align: right;
    padding: 0 18px 0 0;
    font-weight: 900;
    border-radius: 0 0 6px 6px;
    margin: 0;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}
.kn-product-image-wrapper .knshop-label.knshop-label--deal-expired {
    background: rgba(28, 28, 28, 0.85) !important;
    font-size: 20px;
    color: #fff;
}
.kn-product-image-wrapper .knshop-label.knshop-label-empty {
    background: #fff !important;
    color: #fff !important;
}

.kn-product-image-gallery {
    display: grid;
    grid-template-columns: repeat(var(--kn-gallery-cols, 4), 1fr);
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.kn-product-image-gallery a {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
}

.kn-product-image-gallery img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1;
    border-radius: 4px;
    vertical-align: top;
}

/* Lightbox overlay */
.kn-product-image-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.kn-product-image-lightbox-overlay.kn-product-image-lightbox-open {
    opacity: 1;
    visibility: visible;
}

.kn-product-image-lightbox-overlay .kn-product-image-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.kn-product-image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.kn-product-image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.kn-product-image-lightbox-prev,
.kn-product-image-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.kn-product-image-lightbox-overlay.kn-product-image-lightbox-has-nav .kn-product-image-lightbox-prev,
.kn-product-image-lightbox-overlay.kn-product-image-lightbox-has-nav .kn-product-image-lightbox-next {
    display: flex;
}

.kn-product-image-lightbox-prev:hover,
.kn-product-image-lightbox-next:hover {
    opacity: 0.85;
}

.kn-product-image-lightbox-prev {
    left: 20px;
}

.kn-product-image-lightbox-next {
    right: 20px;
}

.kn-product-image-lightbox-prev img,
.kn-product-image-lightbox-next img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.kn-product-image-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
}
