/* ==========================================================================
   OPRANIC - Product Category Archive
   --------------------------------------------------------------------------
   Laddas via opranic_conditional_styles() på is_product_category().

   Innehåll:
     1. Category Hero ([opr_cat_hero] shortcode-styling)
     2. Category sidebar (product_categories widget)
     3. WC produktarkiv/loop (.woocommerce ul.products li.product)
     4. Pagination
     5. CLS-fixar (Lipscore på loop, image aspect-ratio)
     6. Mobil-overrides (hero, breadcrumbs, product cards)
     7. Elfsight-i-WC-kort (.opr-elfsight-in-card wrapper)

   Källor:
     - additional-css block 9b, 11, 12 + 15 (cat-hero, current-cat, lipscore-loop)
     - style.css sek 5a, 5c, 8b, 9-Mobile-Polish, 9-Woo-Cards-Mobile, 9-Elfsight
     - WPCode 25218 (Product Card CLS-fix)
     - WPCode 25339 (opr-cat-hero__title override)

   Version: 2026-04-30 (refactor v2.5 - skapad ny)
   ========================================================================== */

/* ==========================================================================
   1. CATEGORY HERO - [opr_cat_hero] shortcode
   ========================================================================== */

.opr-cat-hero {
    position: relative;
    width: 100%;
    height: 380px;
    overflow: hidden;
    border-radius: 6px;
}

/* Bakgrundsbild som riktig IMG */
.opr-cat-hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 0;
}

/* Diagonal grå overlay */
.opr-cat-hero__overlay {
    position: absolute;
    inset: 0;
    background: rgba(240, 240, 240, 0.93);
    clip-path: polygon(0 0, 40% 0, 29% 100%, 0 100%);
    z-index: 1;
}

/* Textblock */
.opr-cat-hero__text {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    padding: 0 44px;
    max-width: 440px;
}

/* Rubrik */
.opr-cat-hero__title {
    font-size: clamp(22px, 2.4vw, 36px) !important;
    font-weight: 300;
    letter-spacing: clamp(1px, 0.28vw, 5px) !important;
    text-transform: uppercase;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    line-height: 1.1;
    white-space: nowrap !important;
    overflow: visible !important;
}

/* Orange accentlinje */
.opr-cat-hero__accent {
    width: 52px;
    height: 3px;
    background: #EE9305;
    margin-bottom: 14px;
}

/* Säljargument */
.opr-cat-hero__bullets {
    list-style: none;
    margin: 0;
    padding: 0;
}
.opr-cat-hero__bullets li {
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: clamp(13px, 1.15vw, 16px);
    color: #2a2a2a;
    padding: 2px 0;
    line-height: 1.4;
}

/* Tablet */
@media (max-width: 1024px) {
    .opr-cat-hero { height: 300px; }
    .opr-cat-hero__overlay {
        clip-path: polygon(0 0, 50% 0, 36% 100%, 0 100%);
    }
    .opr-cat-hero__text { padding: 0 32px; }
}

/* Mobil */
@media (max-width: 768px) {
    .opr-cat-hero {
        margin-left: calc(50% - 50vw) !important;
        margin-right: calc(50% - 50vw) !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 200px;
        border-radius: 0 !important;
    }
    .opr-cat-hero__overlay {
        clip-path: polygon(0 0, 50% 0, 35% 100%, 0 100%);
    }
    .opr-cat-hero__text {
        top: 50%;
        transform: translateY(-50%);
        padding: 0 16px;
        max-width: 70%;
    }
    .opr-cat-hero__title {
        font-size: 16px !important;
        letter-spacing: 0.10em;
        margin-bottom: 4px;
    }
    .opr-cat-hero__accent {
        width: 30px;
        height: 2px;
        margin-bottom: 6px;
    }
    .opr-cat-hero__bullets li {
        font-size: 11px;
        padding: 1px 0;
        line-height: 1.3;
    }
}

/* Dölj breadcrumbs på mobil */
@media (max-width: 767px) {
    .tax-product_cat .site-breadcrumbs {
        display: none !important;
    }
}

/* ==========================================================================
   2. CATEGORY SIDEBAR (product_categories widget)
   ========================================================================== */

#woocommerce_product_categories-2 .widget-title {
    background: var(--color-brand-dark);
    color: var(--color-text-white);
    font-weight: 400;
    text-transform: uppercase;
    padding: 10px 12px;
    margin-bottom: 0;
}

.wpex-bordered-list .product-categories li {
    border: 0;
    padding: 10px 0;
}

.sidebar-widget-icons .widget_product_categories a::before {
    display: none;
}

.product-categories > .cat-item {
    text-transform: uppercase;
    padding: 0;
}
.product-categories > .cat-item > a {
    background: var(--color-brand-orange);
    padding: 10px 12px;
    margin-top: 1px;
    font-size: 16px;
    color: var(--color-brand-dark);
    display: flex;
    align-items: center;
    height: 50px;
}
.product-categories > .cat-item > a::after {
    content: ' \203A ';
    margin-left: auto;
    font-size: 16px;
}

.cat-item.current-cat > a {
    background: #F0F0F0;
    color: #262626;
    border-top: 2px solid #EE9305;
    border-bottom: 2px solid #EE9305;
    border-left: none;
    border-right: none;
}

/* Aktiv underkategori - F0F0F0 bakgrund, orange top/bottom */
.product-categories .children .cat-item.current-cat > a,
.product-categories .children .cat-item.current-cat-ancestor > a,
.product-categories .children .cat-item.current-cat-parent > a {
    display: block !important;
    background: #F0F0F0 !important;
    color: #262626 !important;
    font-weight: 600 !important;
    border: none !important;
    border-top: 2px solid #EE9305 !important;
    border-bottom: 2px solid #EE9305 !important;
    border-radius: 0 !important;
    padding: 4px 11px !important;
}

/* ==========================================================================
   3. WC PRODUKTARKIV / LOOP
   ========================================================================== */

.woocommerce ul.products li.product .product-inner {
    border: 1px solid var(--color-border-main);
    padding: 6px 15px 80px 15px;
    position: relative;
    min-height: 420px;
}

.woocommerce ul.products li.product .wpex-loop-product-images img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    min-height: 60px;
    font-size: 15px;
}

.woocommerce ul.products li.product .price > .amount,
.woocommerce ul.products li.product .price ins .amount {
    color: var(--color-brand-dark);
    font-size: 21px;
    font-weight: 400;
}

.woocommerce ul.products li.product .star-rating {
    margin: 1px 0 5px;
}

.custom_sku,
.product_meta > span {
    display: inline-block;
    font-weight: 300;
    font-size: 12px;
    color: var(--color-brand-dark);
    background: var(--color-bg-medium-gray);
    border-radius: var(--border-radius-standard);
    padding: 4px 10px;
    margin-top: 10px;
    text-align: center;
}

.woocommerce ul.products li.product .product-actions {
    position: absolute;
    bottom: 15px;
    left: 10px;
    right: 10px;
    text-align: center;
}

/* Produktknappar i arkiv */
.woocommerce ul.products li.product .button {
    background-color: var(--color-text-white) !important;
    color: var(--color-brand-dark) !important;
    border: 2px solid var(--color-brand-orange) !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    transition: all 0.2s ease-in-out;
}
.woocommerce ul.products li.product .button::before {
    content: url(/wp-content/uploads/2022/12/shopping-cart-1-1.svg);
    display: inline-block;
    vertical-align: -2px;
    margin-right: 8px;
    transition: filter 0.2s ease-in-out;
    filter: none;
}
.woocommerce ul.products li.product .button:hover {
    background-color: var(--color-brand-orange) !important;
    color: var(--color-text-white) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.woocommerce ul.products li.product .button:hover::before {
    filter: brightness(0) invert(1);
}
.woocommerce ul.products li.product .button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ==========================================================================
   4. PAGINATION
   ========================================================================== */

.woocommerce-pagination {
    text-align: center;
}
.woocommerce-pagination li {
    border-radius: 0;
    margin: 0 10px;
    width: 33px;
}
.woocommerce-pagination .page-numbers.current {
    border: 1px solid var(--color-brand-orange);
}
.woocommerce-pagination span.page-numbers {
    border-radius: 0;
    background: var(--color-text-white);
}

/* ==========================================================================
   5. CLS-FIXAR (Lipscore på loop + Image aspect-ratio)
   ========================================================================== */

/* Reservera plats för Lipscore-rating på produktkort */
.woocommerce ul.products li.product .lipscore-wc-loop-rating {
    display: block;
    min-height: 24px;
}

/* Reservera utrymme för produktbilder innan lazy-load */
.wpex-loop-product-images {
    aspect-ratio: 420 / 486;
    overflow: hidden;
}
.wpex-loop-product-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   6. MOBIL-OVERRIDES (gutters, product cards, hero-fullbleed för category)
   ========================================================================== */

@media (max-width: 768px) {
    /* WooCommerce produktlistor (UL & DIV) - tajtare yttre gutters */
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .woocommerce div.products,
    .woocommerce-page div.products {
        padding-left: 0 !important;
        padding-right: 0px !important;
    }

    /* Nollning endast inuti WooCommerce produktkort */
    .woocommerce ul.products .vc_row,
    .woocommerce ul.products .wpb_row,
    .woocommerce ul.products .vc_column_container > .vc_column-inner,
    .woocommerce-page ul.products .vc_row,
    .woocommerce-page ul.products .wpb_row,
    .woocommerce-page ul.products .vc_column_container > .vc_column-inner,
    .woocommerce div.products .vc_row,
    .woocommerce div.products .wpb_row,
    .woocommerce div.products .vc_column_container > .vc_column-inner,
    .woocommerce-page div.products .vc_row,
    .woocommerce-page div.products .wpb_row,
    .woocommerce-page div.products .vc_column_container > .vc_column-inner {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Övriga mobilanpassningar */
    .product-inner { padding: 6px 10px 60px 10px; }

    .woocommerce ul.products li.product { min-width: 0; }
    .woocommerce ul.products li.product > .woo-entry-inner,
    .woocommerce ul.products li.product > .product-inner {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        border: 0 !important;
        box-shadow: none !important;
        padding: 8px 8px 12px !important;
        background: transparent !important;
        min-height: 430px;
        min-width: 0;
    }

    /* Dölj serie-/kategori-pillret under bilden för mer luft */
    .woocommerce ul.products li.product .woo-entry-category,
    .woocommerce ul.products li.product .loop-product-categories,
    .woocommerce ul.products li.product .entry-category,
    .woocommerce ul.products li.product .wpex-product-cats,
    .woocommerce ul.products li.product .custom_sku,
    .woocommerce ul.products li.product .term-badge {
        display: none !important;
    }

    /* Stabilisera ev. "KAMPANJ" badge */
    .woocommerce ul.products li.product .onsale,
    .woocommerce ul.products li.product .wc-onsale-badge {
        margin-bottom: 4px;
        min-height: 0;
    }

    /* Bild */
    .woocommerce ul.products li.product a img {
        display: block;
        width: 100%;
        height: auto;
        border-radius: 6px;
        box-shadow: none !important;
    }

    /* Rubrik - 2 rader räcker */
    .woocommerce-loop-product__title {
        font-size: 13px !important;
        line-height: 1.2;
        margin: 8px 0 6px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        min-height: calc(1.2em * 2);
    }

    /* Stjärnor: reservera plats */
    .woocommerce ul.products li.product .star-rating {
        margin: 4px 0 !important;
        min-height: 16px;
    }

    /* Pris: mindre, en rad */
    .woocommerce ul.products li.product .price {
        font-size: 14px !important;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 2px 0 8px !important;
        min-height: 16px;
    }

    /* Knappen alltid i botten */
    .woocommerce ul.products li.product .button {
        margin-top: auto !important;
        font-size: 12.5px !important;
        line-height: 1.1;
        padding: 9px 10px !important;
        white-space: nowrap;
        min-height: auto;
    }
}

/* Tablet 769-1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .woocommerce div.products,
    .woocommerce-page div.products {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .woocommerce ul.products .vc_row,
    .woocommerce ul.products .wpb_row,
    .woocommerce ul.products .vc_column_container > .vc_column-inner,
    .woocommerce div.products .vc_row,
    .woocommerce div.products .wpb_row,
    .woocommerce div.products .vc_column_container > .vc_column-inner {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Små mobiler - produkt-grid 2 kolumner */
@media (max-width: 480px) {
    .products.wpex-pp-grid-cols-1 {
        --wpex-grid-columns: 2;
    }
}

/* ==========================================================================
   7. ELFSIGHT I WC-PRODUKTKORT (.opr-elfsight-in-card wrapper)
   --------------------------------------------------------------------------
   Wrapper som håller Elfsight-widgets bredd inom produktkort.
   Behålls trots att klassen inte syns i HTML-snapshots - används aktivt
   på produktrelaterade sidor enligt Mats.
   ========================================================================== */

/* Wrappern i kortet */
.woocommerce ul.products li.product .opr-elfsight-in-card {
    display: block;
    margin-top: 6px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Säkerställ att widgeten aldrig gör kortet bredare */
.woocommerce ul.products li.product .opr-elfsight-in-card > div,
.woocommerce ul.products li.product .opr-elfsight-in-card [class^="elfsight-app"],
.woocommerce ul.products li.product .opr-elfsight-in-card .eapps-widget {
    display: block !important;
    max-width: 100% !important;
    width: auto !important;
    margin: 0 !important;
    text-align: left !important;
}

/* Iframe-fall - fyll kortets bredd */
.woocommerce ul.products li.product .opr-elfsight-in-card iframe {
    width: 100% !important;
    max-width: 100% !important;
    display: block;
}

/* Neutralisera gamla generella regler */
.woocommerce ul.products li.product [class^="elfsight-app"] {
    display: block;
    margin: 0;
    text-align: left;
    max-width: 100%;
}

/* Mobil: Elfsight-koppel */
@media (max-width: 768px) {
    .woocommerce ul.products li.product .opr-elfsight-in-card {
        display: block;
        margin-top: 6px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    .woocommerce ul.products li.product .opr-elfsight-in-card > div,
    .woocommerce ul.products li.product .opr-elfsight-in-card [class^="elfsight-app"],
    .woocommerce ul.products li.product .opr-elfsight-in-card .eapps-widget {
        display: block !important;
        max-width: 100% !important;
        width: auto !important;
        margin: 0 !important;
        text-align: left !important;
    }
    .woocommerce ul.products li.product .opr-elfsight-in-card iframe {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
    }
    .woocommerce ul.products li.product [class^="elfsight-app"] {
        display: block;
        margin: 0;
        text-align: left;
        max-width: 100%;
    }
}

/* === SLUT på opr-category ================================================ */