/* /home/ubuntu/woocommerce/wp-content/themes/hello-theme-child-master/assets/css/custom-product-archive.css */

/* ==========================================================================
   Custom Product Archive Styles
   ========================================================================== */

/* General Page Styles
   ========================================================================== */
   body.post-type-archive-product { /* Updated Selector */
    background-color: #f4f5f6; /* Updated Color */
}
.custom-product-archive-wrapper {
    /* max-width: 1500px; */ /* Old value */
    max-width: 1700px; /* <<< UPDATED: Increased max-width */
    margin: 0 auto; /* Center wrapper */
    padding: 0 15px;
    color: #222b38;
}

/* Header Area
   ========================================================================== */

/* --- NEW: Full Width Hero --- */
.custom-archive-hero {
    width: 100%; /* Stretch full browser width */
    height: 200px; /* Fixed height */
    background-image: url('/wp-content/uploads/2023/12/nettbutikk-header-pk.jpg'); /* <<< Your image path */
    background-size: cover; /* Scale image to cover, maintain aspect ratio */
    background-position: center center; /* Center the image */
    background-repeat: no-repeat;
    display: flex; /* Use flexbox to center content */
    align-items: center; /* Vertically center */
    justify-content: center; /* Horizontally center */
    box-sizing: border-box;
}

.custom-archive-hero-content {
    width: 100%; /* Take full width of flex parent */
    /* max-width: 1500px; */ /* Old value */
    max-width: 1700px; /* <<< UPDATED: Apply increased content max-width */
    padding: 0 15px; /* Match wrapper padding */
    box-sizing: border-box;
    text-align: left; /* Default alignment */
}

.custom-archive-hero h1.page-title {
    color: #ffffff !important; /* White text */
    font-size: 2.5em; /* Adjust as needed */
    margin: 0; /* Reset margin */
    padding: 0; /* Reset padding */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); /* Optional: improve readability */
    /* Remove any existing margin/padding from original .page-title rule if needed */
}
/* --- END: Full Width Hero --- */


/* Remove old header margin if it exists */
.custom-archive-header {
    margin-bottom: 0; /* Reset as spacing is handled by hero/nav */
}
/* Remove old title styles if they conflict */
.custom-archive-header .page-title {
   /* These styles are now handled by .custom-archive-hero h1.page-title */
   /* font-size: 2.5em; */
   /* margin-bottom: 20px; */
   /* color: #222b38; */
   /* text-align: left; */
}


/* ==========================================================================
   Category Navigation - Responsive
   ========================================================================== */

/* --- Base Styles (Medium Screens / Default) --- */
.custom-category-navigation {
    /* display: flex; <<< REMOVED */
    /* flex-wrap: wrap; <<< REMOVED */
    /* gap: 10px; <<< REMOVED */
    /* margin-bottom: 30px; <<< MOVED to inner container */
    /* Now inside .custom-product-archive-wrapper, so it respects max-width */ /* <<< Comment obsolete */
    width: 100%; /* Span full width */
    background-color: #e0e5e9; /* Bar background color */
    box-sizing: border-box;
    margin-bottom: 30px; /* <<< ADDED: Space below nav bar */
}

/* NEW: Inner content wrapper */
.category-nav-content {
    max-width: 1700px; /* Match main content width */
    margin: 0 auto; /* Center the content */
    padding: 0 15px; /* Match main content padding */
    box-sizing: border-box;
    display: flex; /* Use flex for layout of buttons/dropdown inside */
    flex-wrap: wrap;
    align-items: center; /* Align items vertically */
    /* margin-bottom: 30px; <<< Optional: Add space below the nav content if needed */
}

.category-buttons-standard {
    display: flex; /* Use flex for the container of standard buttons */
    flex-wrap: wrap;
    /* gap: 10px; <<< REMOVED */
    width: 100%; /* Ensure it takes full width within the content wrapper */
}

.category-buttons-standard .category-button {
    /* Standard button appearance (no flex: 1 here) */
    display: inline-block;
    padding: 10px 15px; /* Adjusted padding slightly */
    /* border-radius: 5px; <<< REMOVED */
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-color: #e0e5ea; /* <<< UPDATED: New inactive background */
    color: #222b38;
    border: none;
    cursor: pointer;
    font-size: .9em;
    text-align: center; /* Center text */
}

.category-buttons-standard .category-button.current-cat,
.category-buttons-standard .category-button:hover {
    background-color: #222b38;
    color: #ffffff;
}

/* Hide dropdown elements by default */
.category-dropdown {
    display: none;
    width: 100%;
    position: relative; /* For positioning the options */
}


/* --- Large Screens (> 1532px) --- */ /* Updated Breakpoint */
/* NOTE: This breakpoint might need adjustment based on the new max-width (1700px) */
/* If you want the buttons to stretch earlier, lower this value */
@media (min-width: 1532px) {
    .category-buttons-standard {
        /* Keep display: flex, gap: 10px */
        flex-wrap: nowrap; /* Prevent wrapping on large screens */
    }

    .category-buttons-standard .category-button {
        /* flex: 1; <<< REMOVED */
        /* min-width: 0; <<< REMOVED */
        /* Keep other button styles */
    }
}


/* --- Small Screens (< 768px) --- */
@media (max-width: 768px) {
    .custom-category-navigation {
        /* Override flex settings if needed, or keep for alignment */
        /* display: block !important; <<< No longer needed for outer container */
        /* gap: 0 !important; <<< No longer needed */
        padding: 0; /* Remove padding on mobile if dropdown takes full width */
    }

    .category-nav-content {
        padding: 0; /* Remove padding if dropdown is full width */
    }

    /* Hide the standard buttons */
    .category-buttons-standard {
        display: none !important;
    }

    /* Show and style the dropdown */
    .custom-category-navigation .category-dropdown {
        display: block !important; /* Show the dropdown container */
        width: 100% !important;
        position: relative !important; /* For positioning the options */
        /* No margin needed now as it's inside centered container */
    }

    /* --- Dropdown Toggle Button Styling --- */
    .custom-category-navigation .category-dropdown .category-dropdown-toggle {
        /* Reset Button Styles - Force Override */
        appearance: none !important;
        -webkit-appearance: none !important;
        background: none !important; /* Overridden */
        border: none !important; /* Overridden */
        box-shadow: none !important;
        text-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important; /* Overridden */
        font: inherit !important;
        line-height: normal !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        border-radius: 0 !important; /* Overridden */

        /* Custom Toggle Styles - Force Override */
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important; /* Pushes label and icon apart */
        width: 100% !important; /* <<< Make full width */
        box-sizing: border-box !important; /* <<< Include padding/border in width */
        padding: 12px 15px !important; /* Adjust as needed */
        background-color: #e0e5e9 !important; /* <<< UPDATED: Match bar background */
        border: none !important; /* <<< REMOVED border */
        /* border: 1px solid #d7dce2 !important; */
        /* border-radius: 5px !important; <<< REMOVED radius */
        color: #222b38 !important;
        font-weight: 500 !important;
        text-align: left !important;
        cursor: pointer !important;
        transition: background-color 0.2s ease, border-color 0.2s ease !important;
    }
    .custom-category-navigation .category-dropdown .category-dropdown-toggle:hover,
    .custom-category-navigation .category-dropdown .category-dropdown-toggle:focus {
        background-color: #d7dce2 !important; /* Darker shade for hover */
        /* border-color: #c8cfd6 !important; */
        color: #222b38 !important; /* Ensure text color doesn't change unexpectedly */
        outline: none !important;
        box-shadow: none !important; /* Prevent Elementor focus shadows */
    }

    .custom-category-navigation .category-dropdown .category-dropdown-label {
        flex-grow: 1 !important;
        margin-right: 10px !important;
        overflow: hidden !important; /* Prevent long text overflowing */
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        /* Inherit color/font from parent toggle */
        color: inherit !important;
        font-weight: inherit !important;
    }

    .custom-category-navigation .category-dropdown .dropdown-chevron-icon {
        fill: #222b38 !important;
        transition: transform 0.3s ease !important;
        flex-shrink: 0 !important;
    }
    /* Rotate chevron when dropdown is open */
    .custom-category-navigation .category-dropdown .category-dropdown-toggle[aria-expanded="true"] .dropdown-chevron-icon {
        transform: rotate(180deg) !important;
    }

    /* --- Dropdown Options Styling --- */
    .custom-category-navigation .category-dropdown .category-dropdown-options {
        display: none; /* Hidden by default, shown by JS */
        position: absolute !important;
        top: 100% !important; /* Position below the toggle */
        left: 0 !important;
        right: 0 !important;
        background-color: #ffffff !important;
        border: 1px solid #d7dce2 !important;
        border-top: none !important; /* Avoid double border */
        /* border-radius: 0 0 5px 5px !important; <<< REMOVED radius */
        box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
        z-index: 100 !important; /* Ensure it's above other content */
        max-height: 300px !important; /* Limit height and allow scrolling */
        overflow-y: auto !important;
        margin: 0 !important; /* Reset potential margins */
        padding: 0 !important; /* Reset potential padding */
        list-style: none !important; /* Reset potential list styles */
    }
    .custom-category-navigation .category-dropdown .category-dropdown-options.is-open {
        display: block !important; /* Show when open */
    }

    .custom-category-navigation .category-dropdown .dropdown-option {
        display: block !important;
        padding: 10px 15px !important;
        color: #222b38 !important;
        text-decoration: none !important;
        font-weight: 400 !important;
        transition: background-color 0.2s ease !important;
        white-space: nowrap !important;
        box-sizing: border-box !important; /* Ensure padding is included */
        width: 100% !important; /* Ensure options take full width */
        border: none !important; /* Reset borders */
        background: none !important; /* Reset background */
        text-align: left !important; /* Ensure text alignment */
    }
    .custom-category-navigation .category-dropdown .dropdown-option:hover,
    .custom-category-navigation .category-dropdown .dropdown-option:focus {
        background-color: #ebeef2 !important;
        color: #222b38 !important;
        outline: none !important;
    }
    .custom-category-navigation .category-dropdown .dropdown-option.current-cat {
        background-color: #ebeef2 !important;
        font-weight: 600 !important; /* Highlight current selection */
    }

    /* --- Hero Mobile Styles --- */
    .custom-archive-hero {
        height: 150px; /* Optional: Adjust height for mobile */
    }
    .custom-archive-hero-content {
        text-align: center; /* Center the title text */
        padding: 0 20px; /* Adjust padding if needed */
    }
    .custom-archive-hero h1.page-title {
        font-size: 2em; /* Optional: Adjust title size for mobile */
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6); /* Slightly stronger shadow maybe */
    }
    /* --- END: Hero Mobile Styles --- */

    /* --- Mobile Filter Drawer Styles --- */
    /* Hide the sidebar filter in the grid layout */
    .custom-archive-filters {
        display: none !important;
    }

    /* Show the mobile filter toggle button */
    .mobile-filter-toggle {
        display: flex !important; /* Use flex for alignment of icon and text.
                                     !important here helps ensure it overrides the desktop 'display: none'
                                     and any theme styles for 'a' tags that might set display: block/inline. */
    }

    /* Show the mobile filter drawer container */
    .mobile-filter-drawer {
        display: block !important;
    }

    /* Stack sidebar and products */
    .custom-archive-content-area {
        grid-template-columns: 1fr !important;
        gap: 0 !important; /* <<< REMOVE GAP ON MOBILE */
    }

    /* Adjust product grid columns for smaller screens */
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        /* grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; */ /* Old value */
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important; /* <<< UPDATED: Slightly wider min on tablet */
        gap: 15px !important;
    }
    
    /* Minor adjustments to card content padding and font sizes */
    .custom-product-card .card-content-wrapper {
        padding: 10px !important;
    }
    .custom-product-card .woocommerce-loop-product__title {
        font-size: 15px !important;
        margin-bottom: 10px !important;
    }
    .custom-product-card .price {
        font-size: 15px !important;
        margin-bottom: 15px !important;
    }
    .custom-product-card .card-add-to-cart-row .quantity .qty,
    .custom-product-card .card-add-to-cart-row form.cart .button.add_to_cart_button,
    .custom-product-card .card-add-to-cart-row a.button {
        font-size: 15px !important;
    }
    .custom-product-card .added-to-cart-message {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }

} /* End @media (max-width: 768px) */


/* Main Content Area Layout (Sidebar + Products)
   ========================================================================== */
.custom-archive-content-area {
    display: grid;
    grid-template-columns: 250px 1fr; /* Sidebar width and main content */
    /* Consider making sidebar width relative if needed: e.g., grid-template-columns: 20% 1fr; */
    gap: 50px;
    align-items: start; /* Align items to the top */
    /* padding-top: 30px; */ /* Optional: Add space above filters/products if needed */
}

/* Filter Sidebar
   ========================================================================== */
.custom-archive-filters {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    height: fit-content; /* Allow sidebar to size to its content */
    position: sticky; /* Make sidebar sticky on scroll */
    top: 20px; /* Offset from top when sticky */
}
.custom-archive-filters h2 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 20px;
    color: #222b38;
}
.filter-group {
    margin-bottom: 15px;
    border-bottom: 1px solid #ebeef2;
    padding-bottom: 15px;
}
.filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* ==========================================================================
   Mobile Filter Drawer (Slides from Bottom)
   ========================================================================== */

/* Mobile Filter Toggle Button (Fixed at Bottom) */
/* UPDATED: Now targets an <a> tag */
.mobile-filter-toggle {
    display: none; /* Hidden by default, shown on mobile. Try without !important first. */
    width: 100%; /* Full width */
    background-color: #222b38;
    color: #ffffff !important; /* Ensure text color is white, overriding default link color */
    text-decoration: none !important; /* Remove underline from anchor */
    border: none;
    border-radius: 5px;
    padding: 12px 15px;
    margin-bottom: 20px; /* Space between button and products */
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    align-items: center; /* Will apply when display is flex (on mobile) */
    justify-content: center; /* Will apply when display is flex (on mobile) */
    box-sizing: border-box;
    line-height: normal;
    text-transform: none;
    letter-spacing: normal;
}

.mobile-filter-toggle:hover,
.mobile-filter-toggle:focus {
    background-color: #3a4454;
    color: #ffffff !important; /* Ensure text color remains white */
    text-decoration: none !important; /* Ensure no underline on hover/focus */
}

.mobile-filter-toggle .filter-icon {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    fill: currentColor; /* Make SVG icon inherit color */
}

/* Filter Drawer Container */
.mobile-filter-drawer {
    display: none; /* Hidden by default, shown on mobile */
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw; /* Limit width to viewport width */
    height: 85vh; /* Take up 85% of viewport height */
    background-color: #ffffff;
    z-index: 1050; /* <<< UPDATED: Increased z-index */
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    transform: translateY(100%); /* Start offscreen */
    transition: transform 0.3s ease-in-out;
    overflow: hidden; /* Hide overflow */
    box-sizing: border-box; /* Include padding/border in width calculation */
}

.mobile-filter-drawer.is-open {
    transform: translateY(0); /* Slide in */
}

/* Drawer Header (Sticky) */
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #ebeef2;
    background-color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 2;
    box-sizing: border-box; /* Include padding in width calculation */
    width: 100%; /* Full width of parent */
}

.drawer-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: #222b38;
}

/* Hide the duplicate Filter title in mobile drawer */
.drawer-filters > h2 {
    display: none;
}

/* UPDATED: Increased specificity */
.mobile-filter-drawer .drawer-header button.drawer-close {
    background: none !important; /* Override Elementor */
    border: none !important; /* Override Elementor */
    padding: 5px !important; /* Override Elementor */
    color: #222b38 !important; /* Override Elementor */
    cursor: pointer !important; /* Override Elementor */
    display: flex !important; /* Override Elementor */
    align-items: center !important; /* Override Elementor */
    justify-content: center !important; /* Override Elementor */
    box-shadow: none !important; /* Override Elementor */
    border-radius: 0 !important; /* Override Elementor */
    min-height: auto !important; /* Override Elementor */
    min-width: auto !important; /* Override Elementor */
}
.mobile-filter-drawer .drawer-header button.drawer-close:hover {
    background-color: #f0f0f0 !important; /* Example hover for close */
}

/* Drawer Content Scrollable Area */
.drawer-content {
    height: calc(100% - 60px); /* Full height minus header */
    overflow-y: auto;
    /* UPDATED: Increased bottom padding */
    padding: 5px 0 130px 0; /* Bottom padding for apply button + extra space */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    box-sizing: border-box; /* Include padding in height calculation */
    width: 100%; /* Full width of parent */
}

/* Drawer filters container */
.drawer-filters {
    padding: 0 20px;
    box-sizing: border-box; /* Include padding in width calculation */
    width: 100%; /* Full width of parent */
}

/* Apply Filters Button (Sticky at Bottom) */
.drawer-apply-filters {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background-color: #ffffff;
    border-top: 1px solid #ebeef2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    box-sizing: border-box; /* Include padding in width calculation */
    width: 100%; /* Full width of parent */
}

/* UPDATED: Increased specificity and ensured 100% width */
.mobile-filter-drawer .drawer-apply-filters button.drawer-apply-button {
    background-color: #222b38 !important; /* Override Elementor */
    color: #ffffff !important; /* Override Elementor */
    border: none !important; /* Override Elementor */
    border-radius: 5px !important; /* Override Elementor */
    padding: 12px 0 !important; /* Override Elementor */
    font-weight: 600 !important; /* Override Elementor */
    width: 100% !important; /* Override Elementor */
    text-align: center !important; /* Override Elementor */
    cursor: pointer !important; /* Override Elementor */
    transition: background-color 0.3s ease !important; /* Override Elementor */
    box-sizing: border-box !important; /* Override Elementor */
    line-height: normal !important; /* Prevent Elementor override */
    text-transform: none !important; /* Prevent Elementor override */
    letter-spacing: normal !important; /* Prevent Elementor override */
    min-height: auto !important; /* Prevent Elementor override */
    box-shadow: none !important; /* Prevent Elementor override */
}

.mobile-filter-drawer .drawer-apply-filters button.drawer-apply-button:hover {
    background-color: #3a4454 !important; /* Override Elementor */
    color: #ffffff !important; /* Override Elementor */
}

/* Overlay that dims the background when drawer is open */
.mobile-filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1040; /* <<< UPDATED: Increased z-index */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-filter-overlay.is-open {
    opacity: 1;
}

/* Filter Toggle Button (Accordion Header) */
.filter-toggle {
    /* Reset Button Styles */
    background: none !important;
    border: none !important;
    padding: 5px 0 !important;
    margin: 0;
    font: inherit !important;
    color: #222b38 !important;
    text-align: left !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;

    /* Layout & Alignment */
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    font-size: 1.1em;
    font-weight: 600;
}
.filter-toggle:hover,
.filter-toggle:focus {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: #222b38 !important;
    outline: none;
}
.filter-toggle-text {
    flex-grow: 1;
    margin-right: 5px;
}
.filter-toggle .chevron-icon {
    transition: transform 0.3s ease;
    fill: #222b38;
    flex-shrink: 0;
}
/* Rotate chevron when the associated options are expanded */
.filter-toggle[aria-expanded="true"] .chevron-icon {
    transform: rotate(90deg);
}

/* Filter Options Container (Accordion Content) */
.filter-options {
    margin-top: 10px;
    padding-left: 5px;
    /* display is controlled by JS and inline styles */
}

/* Custom Checkbox Styling */
.filter-options label {
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.95em;
    color: #222b38;
    padding-left: 24px; /* Space for custom checkbox */
    min-height: 18px;
    user-select: none;
    -webkit-user-select: none;
}

/* Hide the actual checkbox input */
.filter-options input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    margin: 0;
    padding: 0;
    left: 0;
    top: 2px;
}

/* Style the visual checkbox element */
.filter-options label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-color: #ebeef2;
    border: 1px solid #d7dce2;
    border-radius: 3px;
    transition: background-color 0.2s ease, border-color 0.2s ease, background-image 0.2s ease;
}

/* Hover state for the visual checkbox */
.filter-options label:hover::before {
     border-color: #aab7c4;
}

/* Checked state for the visual checkbox (using :has for modern browsers) */
.filter-options label:has(input[type="checkbox"]:checked)::before {
    background-color: #222b38;
    border-color: #222b38;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M6.1 11.7L2.4 8l-1.1 1.1 4.8 4.8 9.6-9.6L14.6 3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 10px 10px;
}

/* Focus state for keyboard navigation */
.filter-options label:has(input[type="checkbox"]:focus-visible)::before {
     outline: 2px solid #aab7c4;
     outline-offset: 1px;
}

/* Ensure text aligns correctly */
.filter-options .filter-option-text {
    display: inline-block;
    vertical-align: middle;
}

/* Filter Reset Button */
#filter-reset-button-js {
    /* Reset Base Styles */
    appearance: none !important;
    -webkit-appearance: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    font-size: 1em !important;
    font-weight: normal !important;
    line-height: normal !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    border-radius: 0 !important;

    /* Custom Styles */
    display: block !important;
    width: 100% !important;
    background-color: #d7dce2 !important;
    border: 1px solid #d7dce2 !important;
    color: #222b38 !important;
    padding: 10px !important;
    margin-top: 10px !important;
    border-radius: 5px !important;
    font-weight: 600 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease, color 0.3s ease !important;
}
#filter-reset-button-js:hover {
    background-color: #c8cfd6;
    color: #222b38;
    border-color: #c8cfd6;
}
#filter-reset-button-js:focus-visible {
    outline: 2px solid #222b38;
    outline-offset: 2px;
    box-shadow: none;
}


/* Product Grid Area
   ========================================================================== */
.custom-archive-products {
    width: 100%;
    box-sizing: border-box;
    position: relative; /* Needed for loading overlay */
    margin-bottom: 40px;
}

/* AJAX Loading Overlay */
.ajax-loading-overlay {
    display: none; /* Hidden by default */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    z-index: 100;
    text-align: center;
    padding-top: 60px;
    font-weight: bold;
    color: #222b38;
    font-size: 1.1em;
}
/* Loading spinner animation */
.ajax-loading-overlay::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(34, 43, 56, 0.3);
    border-radius: 50%;
    border-top-color: #222b38;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


/* Product Grid Layout & WooCommerce Overrides */
.woocommerce ul.products,
.woocommerce-page ul.products {
    display: grid !important;
    /* grid-template-columns: repeat(auto-fill, minmax(450px, 1fr)) !important; */ /* <<< Reverted: Too wide */
    /* grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)) !important; */ /* <<< UPDATED: Reduced min width to allow 3 columns */
    /* grid-template-columns: repeat(auto-fill, minmax(390px, 1fr)) !important; */ /* <<< UPDATED: Reduced min width further to allow 4 columns */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important; /* <<< UPDATED: Calculated width for 4 columns */
    gap: 25px !important; /* <<< UPDATED: Increased gap */
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    float: none !important; /* Override default float */
    box-sizing: border-box !important;
    align-items: stretch !important; /* Ensure cards stretch to equal height */
}
/* Remove default WC ::before/::after */
.woocommerce ul.products::before, .woocommerce ul.products::after,
.woocommerce-page ul.products::before, .woocommerce-page ul.products::after {
    display: none !important;
}

/* Individual Product Card Styling */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    float: none !important; /* Override default float */
    width: auto !important; /* Override default width */
    margin: 0 !important; /* Override default margin */
    padding: 0 !important; /* Override default padding */
    box-sizing: border-box !important;
    display: flex !important; /* Use flexbox for internal layout */
    flex-direction: column !important;
    height: 100% !important; /* Ensure card takes full grid cell height */
    background-color: #ffffff !important;
    border-radius: 8px !important;
    overflow: visible !important; /* Allow potential overflows like messages */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
    position: relative !important;
    border: none !important; /* Override default border */
}

/* Product Card Internal Structure */
.custom-product-card .card-image-wrapper {
    aspect-ratio: 1 / 1; /* Maintain square shape */
    /* overflow: hidden; */ /* Not needed for contain */
    position: relative;
    width: 100%;
    padding: 30px; /* Add padding back for spacing around the contained image */
    box-sizing: border-box;
    display: flex; /* Use flex to center the link (<a>) */
    align-items: center;
    justify-content: center;
    background-color: #ffffff; /* Background for potential whitespace */
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    max-height: 300px; /* Ensure container doesn't exceed 300px height */
}

/* Style the link within the image wrapper to fill the container */
.custom-product-card .card-image-wrapper a {
    display: flex; /* Make the link a flex container */
    width: 100%;   /* Make link fill wrapper width */
    height: 100%;  /* Make link fill wrapper height */
    align-items: center; /* Center image vertically within link */
    justify-content: center; /* Center image horizontally within link */
    overflow: hidden; /* Optional: prevent potential overflow issues */
}

.custom-product-card .card-image-wrapper img {
    display: block;
    /* Let the image scale down proportionally to fit */
    max-width: 100%;
    max-height: 100%; /* Max height relative to the container (now capped at 300px) */
    width: auto;
    height: auto;
    object-fit: contain; /* Scale down to fit within the container, maintain aspect ratio */
}

/* Override default WC image styles specifically within our custom card wrapper */
.woocommerce ul.products li.product.custom-product-card .card-image-wrapper a img {
    /* Reaffirm desired sizing and fitting */
    max-width: 100%;
    max-height: 100%;
    width: auto !important;   /* Override width: 100% */
    height: auto !important;  /* Override height: auto */
    object-fit: contain;      /* Ensure contain is applied */
    display: block;

    /* Override conflicting properties from the base rule */
    margin: 0 !important;     /* Reset margin */
    box-shadow: none !important; /* Ensure no shadow */
}

/* --- Energy Label in Card Content --- */
.custom-product-card .card-content-wrapper .card-energy-label-wrapper {
    margin-bottom: 10px; /* Add space below the label */
    line-height: 0; /* Prevent extra space if wrapper is empty */
}
.custom-product-card .card-content-wrapper .card-energy-label-wrapper img {
    display: block;
    max-width: 50px; /* Adjust size as needed */
    height: auto;
}
/* --- END: Energy Label in Card Content --- */

.custom-product-card .card-content-wrapper {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow content to fill remaining space */
    color: #222b38;
    background-color: transparent;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden; /* Hide potential content overflow */
}
.custom-product-card .product-sku {
    font-size: 14px !important;
    color: #7f8286 !important;
    margin-bottom: 8px;
    display: block;
    line-height: 1.3;
}
.custom-product-card .woocommerce-loop-product__title {
    font-size: 16px !important;
    color: #222b38 !important;
    margin-top: 0;
    margin-bottom: 15px;
    flex-grow: 1; /* Allow title to push price/button down */
    line-height: 1.4;
    font-weight: 600;
    padding: 0 !important;
}
.custom-product-card .woocommerce-loop-product__title a {
    color: inherit !important;
    text-decoration: none;
}
.custom-product-card .woocommerce-loop-product__title a:hover {
    color: #0056b3 !important; /* Example hover color */
}
.custom-product-card .price {
    font-size: 16px !important;
    color: #222b38 !important;
    font-weight: bold;
    margin-bottom: 25px; /* <<< UPDATED: Added 5px more space below */
    margin-top: 10px; /* <<< UPDATED: Added 5px more space above */
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.3;
    padding: 0 !important;
}
.custom-product-card .price a,
.custom-product-card .price ins,
.custom-product-card .price del {
    font-size: 16px !important;
    color: #222b38 !important;
    font-weight: bold;
    display: inline !important;
    line-height: 1.3;
    padding: 0 !important;
    margin: 0 !important;
}
.custom-product-card .price del {
    opacity: 0.6;
    font-weight: normal;
}
.custom-product-card .price a[href*="logg-inn"] { /* Style "Login to see prices" link */
    font-weight: normal;
    text-decoration: underline;
}

/* Add to Cart Row */
.custom-product-card .card-add-to-cart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto; /* Push to bottom of card content */
    align-items: center;
    width: 100%;
    position: relative; /* For positioning success message */
}
.custom-product-card .card-add-to-cart-row form.cart {
    display: flex;
    flex-grow: 1;
    gap: 10px;
    align-items: center;
    width: 100%;
}
.custom-product-card .card-add-to-cart-row .quantity {
    margin: 0;
    padding: 0;
}
.custom-product-card .card-add-to-cart-row .quantity .qty {
    background-color: #ebeef2 !important;
    border: none !important;
    padding: 8px;
    border-radius: 5px !important;
    width: 60px;
    text-align: center;
    color: #7f8286 !important;
    font-size: 16px !important;
    height: 38px;
    box-sizing: border-box;
    line-height: normal;
    min-height: 38px;
    appearance: textfield; /* Remove number spinners in some browsers */
    -moz-appearance: textfield;
}
/* Remove number input spinners */
.custom-product-card .card-add-to-cart-row .quantity .qty::-webkit-outer-spin-button,
.custom-product-card .card-add-to-cart-row .quantity .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to Cart / View Options Button */
.woocommerce ul.products li.product .button,
.woocommerce-page ul.products li.product .button {
    margin-top: 0 !important; /* Override WC default margin */
    display: inline-block !important;
}
.custom-product-card .card-add-to-cart-row form.cart .button.add_to_cart_button,
.custom-product-card .card-add-to-cart-row a.button { /* Styles both AJAX button and variable link */
    background-color: #222b38 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 5px !important;
    padding: 0 15px !important;
    flex-grow: 1; /* Allow button to fill space */
    text-align: center !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    height: 38px !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
    line-height: 38px !important; /* Vertically center text */
    white-space: nowrap !important;
    font-size: 16px !important;
    opacity: 1 !important;
    text-shadow: none !important;
    transition: background-color 0.3s ease, opacity 0.3s ease !important;
    margin-top: 0 !important;
    display: inline-flex !important; /* Use flex for centering spinner/text */
    align-items: center;
    justify-content: center;
    width: auto !important; /* Override WC default width */
    position: relative;
    overflow: hidden;
}
.custom-product-card .card-add-to-cart-row form.cart .button.add_to_cart_button:hover,
.custom-product-card .card-add-to-cart-row a.button:hover {
    background-color: #3a4454 !important;
    color: #ffffff !important;
}

/* Button Text & Spinner (AJAX Add to Cart) */
.custom-product-card .card-add-to-cart-row .button .button-text {
    display: inline-block;
    vertical-align: middle;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.custom-product-card .card-add-to-cart-row .button .button-spinner {
    display: none; /* Hidden initially */
    line-height: 1;
    vertical-align: middle;
}
/* Spinner SVG Animation */
.custom-product-card .card-add-to-cart-row .button .button-spinner .spinner {
    animation: rotator 1.4s linear infinite;
}
@keyframes rotator {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(270deg); }
}
.custom-product-card .card-add-to-cart-row .button .button-spinner .path {
    stroke-dasharray: 187;
    stroke-dashoffset: 0;
    transform-origin: center;
    stroke: #ffffff; /* Spinner color */
    animation: dash 1.4s ease-in-out infinite;
}
@keyframes dash {
    0% { stroke-dashoffset: 187; }
    50% { stroke-dashoffset: 46; transform: rotate(135deg); }
    100% { stroke-dashoffset: 187; transform: rotate(450deg); }
}

/* Button Loading State (AJAX) */
.custom-product-card .card-add-to-cart-row .button.loading {
    opacity: 0.8 !important;
    cursor: wait !important;
    pointer-events: none;
    background-color: #3a4454 !important; /* Match hover state during loading */
}
.custom-product-card .card-add-to-cart-row .button.loading .button-text {
    opacity: 0;
    visibility: hidden;
    display: none; /* Ensure text is fully hidden */
}
.custom-product-card .card-add-to-cart-row .button.loading .button-spinner {
    display: inline-block; /* Show spinner */
}

/* Hide default WooCommerce AJAX spinner/checkmark */
.custom-product-card .card-add-to-cart-row .button.loading::after,
.custom-product-card .card-add-to-cart-row .button.added::after {
    display: none !important;
}

/* Hide default WooCommerce "View Cart" link that appears after adding */
.woocommerce a.added_to_cart.wc-forward {
    display: none !important;
}

/* Success Message (AJAX Add to Cart) */
.custom-product-card .added-to-cart-message {
    display: none; /* Hidden initially */
    position: absolute;
    bottom: 100%; /* Position above the add-to-cart row */
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    width: max-content; /* Size to content */
    max-width: 90%; /* Prevent excessive width */
    padding: 12px 15px;
    background-color: #222b38;
    color: #ffffff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 14px; /* Increased from 13px */
    line-height: 1.4;
    text-align: center;
    z-index: 10;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Message text */
.custom-product-card .added-to-cart-message .cart-message-text {
    margin-bottom: 10px;
}

/* Cart button */
.custom-product-card .added-to-cart-message .cart-message-button {
    display: inline-block;
    color: #ffffff;
    background-color: transparent;
    border: 1px solid #ffffff;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.custom-product-card .added-to-cart-message .cart-message-button:hover,
.custom-product-card .added-to-cart-message .cart-message-button:focus {
    background-color: #ffffff;
    color: #222b38;
    text-decoration: none;
}

/* Arrow pointing down from the message */
.custom-product-card .added-to-cart-message::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #222b38 transparent transparent transparent;
}

/* Variable Product Link Styling (when it's the only element) */
.custom-product-card .card-add-to-cart-row a.button:only-child {
    flex-grow: 1;
    width: 100% !important; /* Make variable link full width */
}

/* Out of Stock Message */
.custom-product-card .card-add-to-cart-row .outofstock {
    font-size: 14px;
    color: #7f8286;
    font-style: italic;
    width: 100%;
    text-align: center;
}

/* Login to See Prices Link */
.login-to-see-prices {
    color: #222b38 !important;
    text-decoration: underline !important;
    font-weight: 500;
    transition: color 0.3s ease;
}

.login-to-see-prices:hover {
    color: #0056b3 !important;
    text-decoration: underline !important;
}


/* ==========================================================================
   Pagination Styles
   ========================================================================== */

.woocommerce-pagination {
    margin-top: 40px; /* Add space above pagination */
    clear: both; /* Ensure it clears floated elements if any were used before */
    width: 100%; /* Ensure it takes full width for centering */
}

.woocommerce-pagination ul.page-numbers {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 auto !important; /* Center the list itself */
    display: flex;
    justify-content: center; /* Center the pagination items within the flex container */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 8px; /* Space between pagination items */
    border: none !important; /* Override potential theme borders */
}

.woocommerce-pagination ul.page-numbers li {
     margin: 0 !important; /* Reset default li margin */
     padding: 0 !important; /* Reset default li padding */
     border: none !important; /* Override potential theme borders */
     float: none !important; /* Override potential floats */
     display: inline-block; /* Needed for flex gap to work reliably */
}

/* Remove default WC ::before/::after from list items */
.woocommerce-pagination ul.page-numbers li::before,
.woocommerce-pagination ul.page-numbers li::after {
    display: none !important;
}


/* Common style for all pagination items (links and current span) */
.woocommerce-pagination .page-numbers {
    display: inline-flex !important; /* Use flex for alignment */
    align-items: center;
    justify-content: center;
    min-width: 38px; /* Minimum width */
    height: 38px; /* Fixed height */
    padding: 0 12px !important; /* Horizontal padding */
    border-radius: 5px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
    box-sizing: border-box !important;
    line-height: 1 !important; /* Ensure text centers vertically */
    font-size: 0.95em !important;
    border: 1px solid transparent !important; /* Base border */
    background-clip: padding-box !important; /* Fix potential background issues */
    box-shadow: none !important; /* Reset shadows */
    text-shadow: none !important; /* Reset text shadows */
}

/* Style for clickable page number links */
.woocommerce-pagination a.page-numbers {
    background-color: #d7dce2 !important; /* Light background */
    color: #222b38 !important; /* Dark text */
    border-color: #d7dce2 !important;
}

/* Hover state for clickable links */
.woocommerce-pagination a.page-numbers:hover,
.woocommerce-pagination a.page-numbers:focus {
    background-color: #c8cfd6 !important; /* Slightly darker background on hover */
    color: #222b38 !important;
    border-color: #c8cfd6 !important;
    outline: none; /* Remove focus outline if desired */
}

/* Style for the current page number span */
.woocommerce-pagination span.page-numbers.current {
    background-color: #222b38 !important; /* Dark background for current */
    color: #ffffff !important; /* White text for current */
    border-color: #222b38 !important;
    font-weight: 600 !important; /* Make current slightly bolder */
    cursor: default;
}

/* Style for ellipsis (...) if needed */
.woocommerce-pagination .page-numbers.dots {
    background-color: transparent !important;
    border-color: transparent !important;
    color: #7f8286 !important; /* Match subtle text color */
    cursor: default;
    padding: 0 5px !important; /* Adjust padding for dots */
    line-height: 38px !important; /* Align vertically */
}

/* Ensure next/prev arrows look okay */
.woocommerce-pagination .next,
.woocommerce-pagination .prev {
    /* Add specific styles if the arrows look bad, e.g., font-size */
}


/* Further Responsive Adjustments
   ========================================================================== */
@media (max-width: 480px) {
    /* Further adjust grid columns for very small screens */
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        /* grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; */ /* Old value */
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; /* <<< UPDATED: Slightly wider min on smallest screens */
    }
    /* Consider stacking quantity/button if needed on very small screens */
    /*
    .custom-product-card .card-add-to-cart-row form.cart {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .custom-product-card .card-add-to-cart-row .quantity {
        margin-bottom: 10px;
    }
    .custom-product-card .card-add-to-cart-row .quantity .qty {
        width: 100%;
    }
    .custom-product-card .card-add-to-cart-row form.cart .button.add_to_cart_button {
        width: 100%;
        flex-grow: 0;
    }
    */
}

/* Category Navigation Links on Shop Page */
.filter-options.is-shop-page .category-navigation-link {
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.filter-options.is-shop-page .category-navigation-link:hover {
    background-color: #f5f7fa;
}

.filter-options.is-shop-page .category-navigation-link input[type="checkbox"] {
    pointer-events: none; /* Prevent checkbox interaction */
}

.filter-options.is-shop-page .navigation-arrow {
    display: inline-block;
    margin-left: 5px;
    font-size: 14px;
    color: #7f8286;
    transition: transform 0.2s ease;
}

.filter-options.is-shop-page .category-navigation-link:hover .navigation-arrow {
    transform: translateX(3px);
    color: #222b38;
}

/* Hide the checkbox stylings that would normally show on hover/focus */
.filter-options.is-shop-page .category-navigation-link:hover::before {
    border-color: #ebeef2; /* Keep border unchanged on hover */
}

.filter-options.is-shop-page .category-navigation-link:has(input[type="checkbox"]:focus-visible)::before {
    box-shadow: none; /* Remove focus outline that would normally appear */
}

/* Category Links on Shop Page */
.filter-options .category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: #232b38;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.filter-options .category-link:hover {
    background-color: #f5f7fa;
}

.filter-options .category-link:focus-visible {
    outline: 2px solid #4285f4;
    outline-offset: 1px;
}

.filter-options .category-link .category-name {
    flex-grow: 1;
}

.filter-options .category-link .navigation-arrow {
    display: inline-block;
    margin-left: 5px;
    font-size: 14px;
    color: #7f8286;
    transition: transform 0.2s ease;
}

.filter-options .category-link:hover .navigation-arrow {
    transform: translateX(3px);
    color: #222b38;
}

/* Hide the shop-page specific styles we no longer need */
.filter-options.is-shop-page .category-navigation-link {
    display: none;
}