/*
 * Grateful Nature - product widget cards (GratefulNature_ProductWidgets)
 *
 * New look for the Meigee product widgets (Bestsellers, New Products, On Sale, Featured Category,
 * Featured Category Group) and "Grateful Nature - New Arrivals", in all three templates:
 *   Grid   .home-container.grid .widget-grid            2 / 3 / 4 / 5 columns (phone -> wide desktop)
 *   List   .widget-prod-list .products-list             compact rows, 2 columns on wide screens
 *   Slider .slider-container .widget-slider             2 / 3 / 4 / 5 products in view
 * Only CSS: the Meigee templates (add-to-cart, popups, slider script) are unchanged.
 * Loaded on every page by layout/gratefulnature_productwidgets.xml.
 */

/* ---------- Shared card ---------- */
body .home-container.grid .widget-grid li.item .product-container,
body .slider-container .widget-slider li.item .indent,
body .widget-prod-list .products-list > li.item {
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #ebe7de;
    border-radius: 12px;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
body .home-container.grid .widget-grid li.item .product-container:hover,
body .slider-container .widget-slider li.item .indent:hover,
body .widget-prod-list .products-list > li.item:hover {
    border-color: #dcd6c8;
    box-shadow: 0 8px 22px rgba(60, 50, 30, .10);
    transform: translateY(-2px);
}

/* Image: square box, whole product visible */
body .home-container.grid .widget-grid li.item .product-img-box,
body .slider-container .widget-slider li.item .product-img-box,
body .widget-prod-list .products-list > li.item .product-img-box {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 10px;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
body .home-container.grid .widget-grid li.item .product-img-box a.product-image,
body .slider-container .widget-slider li.item .product-img-box a.product-image,
body .widget-prod-list .products-list > li.item .product-img-box a.product-image {
    display: block;
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    margin: 0;
    border: 0;
}
body .home-container.grid .widget-grid li.item .product-img-box a.product-image img,
body .slider-container .widget-slider li.item .product-img-box a.product-image img,
body .widget-prod-list .products-list > li.item .product-img-box a.product-image img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    margin: 0;
}

/* Product name: max 3 lines, same height on every card */
body .home-container.grid .widget-grid li.item .product-name,
body .slider-container .widget-slider li.item .product-name {
    margin: 0 0 8px;
    padding: 0;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 400;
    min-height: 4.05em;
    text-align: left;
}
body .home-container.grid .widget-grid li.item .product-name a,
body .slider-container .widget-slider li.item .product-name a,
body .widget-prod-list .products-list > li.item .product-name a {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #222;
    text-decoration: none;
}
body .home-container.grid .widget-grid li.item .product-name a:hover,
body .slider-container .widget-slider li.item .product-name a:hover,
body .widget-prod-list .products-list > li.item .product-name a:hover {
    color: #6f7629;
}

/* Prices: main price large, "Fra ..." and old price small */
body .home-container.grid .widget-grid li.item .price-box,
body .slider-container .widget-slider li.item .price-box,
body .widget-prod-list .products-list > li.item .price-box {
    height: auto; /* theme: .products-grid .price-box {height:35px} cuts off the "Fra ..." line */
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    margin: 0;
    padding: 0;
    text-align: left;
    float: none;
}
body .home-container.grid .widget-grid li.item .price-box .price,
body .slider-container .widget-slider li.item .price-box .price,
body .widget-prod-list .products-list > li.item .price-box .price {
    font-size: 17px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
}
body .home-container.grid .widget-grid li.item .price-box .minimal-price-link,
body .slider-container .widget-slider li.item .price-box .minimal-price-link,
body .widget-prod-list .products-list > li.item .price-box .minimal-price-link {
    order: 2;
    display: inline;
    margin: 0;
    font-size: 12px;
    color: #777;
    text-decoration: none;
}
body .home-container.grid .widget-grid li.item .price-box .minimal-price-link .price,
body .home-container.grid .widget-grid li.item .price-box .minimal-price-link .label,
body .slider-container .widget-slider li.item .price-box .minimal-price-link .price,
body .slider-container .widget-slider li.item .price-box .minimal-price-link .label,
body .widget-prod-list .products-list > li.item .price-box .minimal-price-link .price,
body .widget-prod-list .products-list > li.item .price-box .minimal-price-link .label {
    font-size: 12px;
    font-weight: 400;
    color: #777;
}
body .home-container.grid .widget-grid li.item .price-box .old-price,
body .slider-container .widget-slider li.item .price-box .old-price,
body .widget-prod-list .products-list > li.item .price-box .old-price {
    order: 2;
    margin: 0;
}
body .home-container.grid .widget-grid li.item .price-box .old-price .price,
body .slider-container .widget-slider li.item .price-box .old-price .price,
body .widget-prod-list .products-list > li.item .price-box .old-price .price {
    font-size: 13px;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
}
body .home-container.grid .widget-grid li.item .price-box .special-price .price,
body .slider-container .widget-slider li.item .price-box .special-price .price,
body .widget-prod-list .products-list > li.item .price-box .special-price .price {
    color: #b0412e;
}
body .home-container.grid .widget-grid li.item .price-box .price-label,
body .slider-container .widget-slider li.item .price-box .price-label,
body .widget-prod-list .products-list > li.item .price-box .price-label {
    display: none;
}

/* Buttons row: wishlist heart + green "Kjøp nå" */
body .home-container.grid .widget-grid li.item .product-buttons,
body .slider-container .widget-slider li.item .product-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    float: none;
    width: 100%;
}
body .home-container.grid .widget-grid li.item .button-holder,
body .slider-container .widget-slider li.item .button-holder,
body .widget-prod-list .products-list > li.item .button-holder {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    margin: 0;
    float: none;
}
body .home-container.grid .widget-grid li.item .add-to-links,
body .slider-container .widget-slider li.item .add-to-links {
    order: 1;
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    float: none;
    list-style: none;
}
body .home-container.grid .widget-grid li.item .add-to-links li,
body .slider-container .widget-slider li.item .add-to-links li {
    margin: 0;
    padding: 0;
    float: none;
}
/* Only the wishlist heart; the compare link (second) is hidden to give "Kjøp nå" room */
body .home-container.grid .widget-grid li.item .add-to-links li + li,
body .slider-container .widget-slider li.item .add-to-links li + li {
    display: none;
}
body .home-container.grid .widget-grid li.item .add-to-links .separator,
body .slider-container .widget-slider li.item .add-to-links .separator,
body .widget-prod-list .products-list > li.item .add-to-links .separator {
    display: none;
}
body .home-container.grid .widget-grid li.item .add-to-links a,
body .slider-container .widget-slider li.item .add-to-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid #e3ded3;
    border-radius: 50%;
    background: #fff;
    color: #8a8a8a;
    line-height: 1;
}
body .home-container.grid .widget-grid li.item .add-to-links a:hover,
body .slider-container .widget-slider li.item .add-to-links a:hover {
    border-color: #939b38;
    color: #939b38;
}
body .home-container.grid .widget-grid li.item .add-to-links a i,
body .slider-container .widget-slider li.item .add-to-links a i {
    margin: 0;
    font-size: 15px;
    color: inherit;
}

body .home-container.grid .widget-grid li.item .btn-cart,
body .slider-container .widget-slider li.item .btn-cart,
body .widget-prod-list .products-list > li.item .btn-cart {
    display: block;
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: #939b38;
    box-shadow: none;
    cursor: pointer;
    transition: background-color .15s ease;
    float: none;
}
body .home-container.grid .widget-grid li.item .btn-cart:hover,
body .slider-container .widget-slider li.item .btn-cart:hover,
body .widget-prod-list .products-list > li.item .btn-cart:hover {
    background: #7b8230;
}
body .home-container.grid .widget-grid li.item .btn-cart span,
body .slider-container .widget-slider li.item .btn-cart span,
body .widget-prod-list .products-list > li.item .btn-cart span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    margin: 0;
    padding: 0;
    /* !important: the theme (style-altshop.css) paints a lighter box behind the text on hover */
    background: transparent !important;
    border: 0 !important;
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
body .home-container.grid .widget-grid li.item .btn-cart i,
body .slider-container .widget-slider li.item .btn-cart i,
body .widget-prod-list .products-list > li.item .btn-cart i {
    margin: 0;
    color: #fff;
    font-size: 15px;
}
body .home-container.grid .widget-grid li.item .ajax-loader-item,
body .slider-container .widget-slider li.item .ajax-loader-item,
body .widget-prod-list .products-list > li.item .ajax-loader-item {
    position: absolute;
    top: 50%;
    right: 10px;
    margin-top: -8px;
}

/* ---------- Grid ---------- */
body .home-container.grid .widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}
body .home-container.grid .widget-grid:before,
body .home-container.grid .widget-grid:after {
    display: none;
}
body .home-container.grid .widget-grid > li.item {
    display: flex;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    clear: none;
}
body .home-container.grid .widget-grid li.item .product-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 10px;
}
body .home-container.grid .widget-grid li.item .price-box {
    margin-top: auto;
}
@media (min-width: 640px) {
    body .home-container.grid .widget-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 16px;
    }
}
@media (min-width: 1100px) {
    /* At most 5 columns in the full-width content area */
    body .home-container.grid .widget-grid {
        grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    }
}
@media (min-width: 640px) {
    body .home-container.grid .widget-grid li.item .product-container {
        padding: 12px;
    }
}

/* ---------- Slider ---------- */
/* Width the slider script measures to work out how many products fit (2 / 3 / 4 / 5); it then
   sets the exact pixels. Based on the screen width, because the slider strip itself is as wide as
   all products together. On phones the script does not run, so this width is used as it is. */
body .slider-container .home-container .home-slider .widget-slider li.item {
    box-sizing: border-box;
    width: calc((100vw - 32px) / 2);
    padding: 0 5px;
}
@media (min-width: 640px) {
    body .slider-container .home-container .home-slider .widget-slider li.item { width: calc((100vw - 30px) / 3); padding: 0 8px; }
}
@media (min-width: 960px) {
    body .slider-container .home-container .home-slider .widget-slider li.item { width: calc((100vw - 30px) / 4); }
}
@media (min-width: 1200px) {
    body .slider-container .home-container .home-slider .widget-slider li.item { width: calc((min(100vw, 1280px) - 30px) / 5); }
}
@media (max-width: 479px) {
    /* The theme forces 278px (!important) on phones = one product per view; show two */
    body .slider-container .home-container .home-slider .widget-slider li.item {
        width: calc((100vw - 24px) / 2) !important;
    }
}
body .slider-container .widget-slider li.item {
    float: left;
    margin: 0;
}
body .slider-container .widget-slider li.item .indent {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 0 12px;
    padding: 10px;
}
body .slider-container .widget-slider li.item .price-box {
    margin-top: auto;
    /* Slides can't stretch to equal height, so reserve room for "Fra ..." to keep buttons in line */
    min-height: 44px;
    align-content: flex-start;
}
/* Arrows: round buttons */
body .slider-container .home-slider .next,
body .slider-container .home-slider .prev {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-top: -19px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    border: 1px solid #e3ded3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    color: #555;
    z-index: 5;
}
/* Just inside the slider, so they never stick out past the screen edge */
body .slider-container .home-slider .next { right: 2px; left: auto; }
body .slider-container .home-slider .prev { left: 2px; right: auto; }
body .slider-container .home-slider .next:hover,
body .slider-container .home-slider .prev:hover {
    background: #939b38;
    border-color: #939b38;
    color: #fff;
}
body .slider-container .home-slider .next i,
body .slider-container .home-slider .prev i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent; /* theme paints the icon itself as a green square */
    color: inherit;
    font-size: 14px;
    line-height: 1;
}
body .slider-container .home-slider .prev.unselectable {
    opacity: .35;
}

/* ---------- List ---------- */
body .widget-prod-list .products-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}
body .widget-prod-list .products-list > li.item {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 12px;
    align-items: center;
    margin: 0;
    padding: 10px;
    float: none;
}
body .widget-prod-list .products-list > li.item:before,
body .widget-prod-list .products-list > li.item:after {
    display: none;
}
body .widget-prod-list .products-list > li.item > .grid_3,
body .widget-prod-list .products-list > li.item > .grid_9 {
    float: none;
    width: 100% !important;
    max-width: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}
/* custom.css forces ".widget-prod-list #products-list .grid_3" to 20% (!important), which shrinks the image to a dot */
body .widget-prod-list ol#products-list > li.item > .grid_3,
body .widget-prod-list ol#products-list > li.item > .grid_9 {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
}
body .widget-prod-list .products-list > li.item .product-img-box {
    margin: 0;
}
body .widget-prod-list .products-list > li.item .product-shop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
}
body .widget-prod-list .products-list > li.item .product-name {
    flex: 0 0 100%;
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 600;
}
body .widget-prod-list .products-list > li.item .product-name a {
    -webkit-line-clamp: 2;
}
body .widget-prod-list .products-list > li.item .desc {
    display: none;
}
body .widget-prod-list .products-list > li.item .price-box {
    flex: 1 1 auto;
}
body .widget-prod-list .products-list > li.item .button-holder {
    flex: 0 0 auto;
}
body .widget-prod-list .products-list > li.item .btn-cart {
    width: auto;
    padding: 0 18px;
}
body .widget-prod-list .products-list > li.item .add-to-links {
    display: none;
}
@media (min-width: 640px) {
    body .widget-prod-list .products-list > li.item {
        grid-template-columns: 130px 1fr;
        gap: 16px;
        padding: 12px;
    }
    body .widget-prod-list .products-list > li.item .product-name {
        font-size: 16px;
    }
    body .widget-prod-list .products-list > li.item .desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        flex: 0 0 100%;
        margin: 0;
        font-size: 13px;
        line-height: 1.45;
        color: #666;
    }
    body .widget-prod-list .products-list > li.item .desc .link-learn {
        display: none;
    }
}
@media (min-width: 1024px) {
    body .widget-prod-list .products-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

/* ---------- Small phones ---------- */
@media (max-width: 480px) {
    body .home-container.grid .widget-grid li.item .product-name,
    body .slider-container .widget-slider li.item .product-name {
        font-size: 13px;
    }
    body .home-container.grid .widget-grid li.item .price-box .price,
    body .slider-container .widget-slider li.item .price-box .price,
    body .widget-prod-list .products-list > li.item .price-box .price {
        font-size: 15px;
    }
    body .home-container.grid .widget-grid li.item .add-to-links,
    body .slider-container .widget-slider li.item .add-to-links {
        display: none;
    }
    body .home-container.grid .widget-grid li.item .btn-cart,
    body .home-container.grid .widget-grid li.item .btn-cart span,
    body .slider-container .widget-slider li.item .btn-cart,
    body .slider-container .widget-slider li.item .btn-cart span,
    body .widget-prod-list .products-list > li.item .btn-cart,
    body .widget-prod-list .products-list > li.item .btn-cart span {
        height: 36px;
        font-size: 12px;
    }
}
