/* Product page cleanup */
.path-product .field-field-product-brand .taxonomy-term.vocabulary-brand {
  padding: 0;
  background-color: transparent;
  margin-top: 25px;
  text-align: center;
}
.path-product .field-field-product-brand h2,
.path-product .field-field-care-icons h2,
.path-product .field-field-product-yarn-care .field-label {
  display: none;
}
.field-field-care-icons .field-items {
  display: flex;
}
.commerce-order-item-variation-cart-form-form .field--name-purchased-entity,
.commerce-order-item-variation-cart-form-form .form-item-unit-price-0-override {
  display: none;
}

/* Catalog Teaser Title Styling */
.product-title-catalog {
  line-height: 1.2;
  text-align: center;
}

.product-title-catalog a.product-title-link {
  font-size: 18px; /* Adjust this to match your preferred size */
  font-weight: 500;
  color: #2ea3d1; /* The blue color from your Summer Stripes image */
  text-decoration: none;
  display: block;
  transition: color 0.3s ease;
}

.product-title-catalog a.product-title-link:hover {
  color: #237da1; /* Slightly darker on hover */
}



/* Header layout */
.main-menu-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  background-color: #f8f9fa;
  padding: 10px 20px;
  border-bottom: 1px solid #ddd;
}

.left-menu {
  justify-content: flex-end;
  flex: 1;
}
.right-menu {
  justify-content: flex-start;
  flex: 1;
}
.logo-center {
  flex: 0 0 auto;
  margin: 0 20px;
  text-align: center;
}
.logo-center img {
  max-height: 60px;
}

/* Targeted overrides for the Brand Vocabulary on Product Pages */
.path-product .product-header-inline .field-field-product-brand .taxonomy-term.vocabulary-brand {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.path-product .product-header-inline .taxonomy-term.vocabulary-brand {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    line-height: 0; /* Helps collapse the container height */
}

/* Ensure the header container itself is tight */
.product-header-inline {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 0 !important;
    padding: 0 !important;
}

/* Keep the Brand and Title vertically aligned */
.product-brand, 
.product-title {
    margin: 0 !important;
    padding: 0 !important;
    vertical-align: middle;
}

.product-title {
    font-size: 1.8rem;
    line-height: 1.1;
}

/* ---- Tabs --- */
/* Container: Square box around everything */
.product-tabs-wrapper {
    width: 100%;
    border: 1px solid #e1e1e1; /* Light gray outer border */
    border-bottom: none; /* Let the content container provide the bottom edge */
}

/* Nav Row: Equal segments */
.tabs-nav {
    display: flex;
    width: 100%;
    background-color: #f9f9f9; /* Consistent light gray background */
}

/* Tab Buttons: Square, centered, with dividers */
.tab-btn {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 10px;
    font-size: 14px;
    font-weight: 600;
    color: #2ea3d1; /* Titles in Blue as requested */
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 0 !important;
    text-transform: uppercase;
}

/* Hover effect since there is no active state */
.tab-btn:hover {
    background-color: #f0f0f0;
}

/* Dividers: Vertical lines between segments */
[dir="ltr"] .tab-btn:not(:last-child) { border-right: 1px solid #e1e1e1; }
[dir="rtl"] .tab-btn:not(:last-child) { border-left: 1px solid #e1e1e1; }

/* Content Area: Pushes content down naturally */
.tabs-content-container {
    background: #fff;
    width: 100%;
    border: 1px solid #e1e1e1;
    border-top: 1px solid #e1e1e1; /* Divider between nav and content */
}

.tab-pane {
    padding: 25px;
    line-height: 1.6;
    color: #444;
}

/* Ensure the arrows are also blue to match titles */
.tab-arrow {
    margin-inline-start: 8px;
    border-top: 5px solid #2ea3d1;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

/*** Image gallert ***/

/* Container to limit the overall size on the page */
.product-gallery-wrapper {
    max-width: 500px; /* Adjust this to your preferred gallery width */
    margin: 0 auto;
}

/* 1. Force the frame size */
.gallery-main {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    
    /* SET YOUR DESIRED HEIGHT HERE */
    height: 300px; 
    
    border: 1px solid #f0f0f0;
    background-color: #fff; /* Padding area color if image is skinny */
    margin-bottom: 15px;
}

/* 2. Ensure every slide fills that height */
.gallery-slide {
    flex: 0 0 100%;
    height: 100%; /* Match parent height */
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 3. Force images to fit the frame without stretching */
.gallery-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* This prevents the "jumping" size issue */
    display: block;
}

.gallery-slide a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.gallery-slide a img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* 1. The Thumbnail Track */
.gallery-thumbs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 15px 0;
    justify-content: center; /* Centers thumbs if there are only a few */
    align-items: center;
}

/* 2. The Thumbnail Frame */
.thumb-item {
    flex: 0 0 70px; /* Fixed width for all thumbs */
    height: 70px;    /* Fixed height for all thumbs */
    cursor: pointer;
    border: 2px solid #eee;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Clips any bleed */
    transition: all 0.3s ease;
}

/* 3. The Thumbnail Image */
.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 'cover' makes them neat squares like your reference */
    display: block;
}

/* 4. Active State (from your reference image) */
.thumb-item.active {
    border-color: #2ea3d1;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 2;
    opacity: 1;
}

.thumb-item:not(.active) {
    opacity: 0.7;
}

/* Active Thumbnail Highlight */
.thumb-item.active {
    border-color: #2ea3d1; /* Your brand blue */
    opacity: 1;
}

.thumb-item:not(.active) {
    opacity: 0.6;
}

/* Hide scrollbars for a cleaner look */
.gallery-main::-webkit-scrollbar,
.gallery-thumbs::-webkit-scrollbar {
    display: none;
}

/**** Pattern tab images  ****/

/* Container spacing */
.ravelry-patterns-section {
    padding: 15px;
    background: #f9f9f9; /* Subtle background to separate from booklet */
    border-radius: 8px;
}

/* The Grid */
.ravelry-grid {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-top: 15px;
}

/* Individual Items */
.ravelry-item {
    flex: 1; /* Forces 3 equal columns */
    min-width: 0; /* Prevents flex items from overflowing */
    background: #fff;
    border: 1px solid #eee;
    transition: transform 0.2s ease;
    text-align: center;
}

.ravelry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Image Handling */
.ravelry-item .image-wrapper {
    aspect-ratio: 1 / 1; /* Keeps images as perfect squares */
    overflow: hidden;
}

.ravelry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Crops images to fill the square without stretching */
}

/* Text Styling */
.pattern-details {
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.pattern-name {
    font-weight: bold;
    color: #333;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pattern-author {
    font-size: 0.8em;
    color: #777;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .ravelry-grid {
        flex-direction: column;
    }
}

/* Remove default padding from the patterns tab container */
#tab-patterns.tab-pane {
    padding: 0 !important;
}

/* Container adjustments */
.ravelry-tab-wrapper {
    background: #ffffff; /* Shopify themes usually stay white/clean */
    border-radius: 0;    /* Remove rounded corners for a sharper look */
}

/* The Title Styling */
.ravelry-tab-wrapper h3.ravelry-header {
    font-family: inherit; /* Uses your theme's primary font */
    font-size: 1.25rem;    /* Shopify standard for section subheadings */
    font-weight: 400;      /* Lighter weight looks more premium */
    letter-spacing: 0.04em; /* Slight letter spacing for readability */
    color: #121212;        /* Shopify's standard dark grey/black */
    text-transform: capitalize; 
    margin: 0;
    padding: 20px 0 15px 0; /* Align perfectly with the grid edge */
    border-bottom: 1px solid #e8e8e8; /* Subtle separator line */
    margin-bottom: 20px;
}

/* Adjust the grid to align with the new title layout */
.ravelry-flex-grid {
    padding: 0; /* Since we removed the outer tab padding earlier */
    display: flex;
    gap: 20px;
}

/* Styling the cards to look like Shopify "Product Cards" */
.ravelry-card {
    border: none; /* Shopify often uses shadows or no borders instead of thin lines */
    box-shadow: none;
    transition: opacity 0.3s ease;
}

.ravelry-card:hover {
    opacity: 0.7; /* Classic Shopify hover effect */
}

.p-title {
    font-size: 0.9rem;
    color: #121212;
    margin-top: 10px;
    text-decoration: underline; /* Suggests a clickable link clearly */
    text-underline-offset: 3px;
}

/* Dynamic Title Styling */


.ravelry-toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ravelry-toggle-container:hover {
    opacity: 0.7;
}

.ravelry-toggle-container svg {
    color: #121212;
    flex-shrink: 0;
}

.ravelry-link-toggle {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: #121212 !important;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    box-shadow: none !important;
    border-radius: 0 !important;
    height: auto !important;
    line-height: 1 !important;
    margin: 0 !important;
    /* Remove the default underline to look cleaner with the icon */
    text-decoration: none !important; 
}

/* Add a subtle underline only on hover for the text */
.ravelry-toggle-container:hover .ravelry-link-toggle {
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

#ravelry-ajax-wrapper .ravelry-link-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    color: #121212;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

#ravelry-ajax-wrapper .ravelry-link-toggle:hover {
    opacity: 0.7;
}

.ravelry-link-toggle, 
.ravelry-view-more-btn {
    display: inline-block;
    margin-top: 20px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: #121212;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.ravelry-link-toggle:hover, 
.ravelry-view-more-btn:hover {
    color: #707070;
    border-bottom-color: #707070;
    padding-left: 5px; /* Subtle movement effect */
}

/* Ensure the SVG icon inherits the hover color */
.ravelry-link-toggle:hover .ravelry-icon {
    stroke: #ffffff !important;
}

/* Icon Styling inside the button */
.ravelry-icon {
    width: 16px;
    height: 16px;
    stroke: #121212;
    stroke-width: 2px;
    margin-right: 10px;
    flex-shrink: 0;
    transition: stroke 0.2s ease;
}

/* Remove default button appearance */
button.ravelry-link-toggle, 
button.ravelry-view-more-btn {
    appearance: none;
    -webkit-appearance: none;
}

/* Ensure the grid doesn't force a single item to be 100% wide */
.ravelry-patterns-grid-container {
    width: 100%;
    margin-bottom: 20px;
}

/* 1. The Container */
#ravelry-ajax-wrapper .ravelry-grid {
    display: flex !important;
    flex-wrap: nowrap !important;  /* Force single row */
    justify-content: flex-start !important;
    gap: 15px !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 2. The Items */
#ravelry-ajax-wrapper .ravelry-grid .ravelry-item {
    flex: 0 1 calc((100% - 30px) / 3) !important;  /* Don't grow, CAN shrink */
    min-width: 0 !important;  /* Allow shrinking below content size */
    max-width: 200px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

/* 3. The Images */
#ravelry-ajax-wrapper .ravelry-grid .ravelry-item .image-wrapper {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    background: #f4f4f4;
}

#ravelry-ajax-wrapper .ravelry-grid .ravelry-item .image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Target the input specifically via the ID suffix to beat theme scripts */
input[id^="edit-quantity-0-value"].form-number {
    -moz-appearance: number-input !important;
    -webkit-appearance: inner-spin-button !important;
    appearance: auto !important;
    opacity: 1 !important;
    display: inline-block !important;
    /* Increase width: if the box is too narrow, Chrome hides arrows */
    width: 55px !important; 
    min-width: 55px !important;
}

/* Force the pseudo-elements again with higher specificity */
input[id^="edit-quantity-0-value"].form-number::-webkit-inner-spin-button,
input[id^="edit-quantity-0-value"].form-number::-webkit-outer-spin-button {
    -webkit-appearance: inner-spin-button !important;
    appearance: inner-spin-button !important;
    opacity: 1 !important;
    display: block !important;
}

/* Target the Add to Cart button specifically */
.button--add-to-cart {
    border-radius: 4px !important;   /* This creates the "light round" corner effect */
    padding: 0 20px !important;      /* Adjusts horizontal size */
    height: 40px !important;         /* Fixed height to help with the square look */
    line-height: 40px !important;    /* Centers text vertically */
    display: inline-block;
    width: auto;                     /* Allows it to wrap the text naturally */
}

/* Badge cell in variation table - overlapping image */
.product-variation-badge-cell {
  position: relative;
  width: 1px; /* Collapse the cell width */
  padding: 0 !important;
  border: none !important;
  vertical-align: top;
}

.product-variation-badge-cell .badge-label {
  position: absolute;
  top: -50px; 
  font-size: 10px;
  text-align: center;
  color: #ffffff;
  width: 60px;
  height: 20px;
  line-height: 20px;
  text-transform: uppercase;
  z-index: 10;
  margin: 0;
}

.product-variation-badge-cell .badge-new {
  background-color: #53d542;
}

.product-variation-badge-cell .badge-sale {
  background-color: #ff421d;
}

.product-variation-badge-cell .badge-discontinue {
  background-color: #4774c7;
}

/* Ensure image cell can show overflow */
.views-field-field-image {
  position: relative;
  overflow: visible !important;
}

/* needles variation view - add to cart **/
/* Ensure the table cell itself aligns content to the middle */
.views-table td {
  vertical-align: middle !important;
}

/* Remove the card-style border/shadow from grid items for needles */
.product-variation-needles.product-variation-grid-item {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Target the wrapper for vertical centering within the table cell */
.product-variation-needles .product-variation-add-to-cart-wrapper {
  display: flex;
  align-items: center; /* Vertical center */
  justify-content: center; /* Horizontal center */
  height: 100%;
}

/* Target the form to align quantity input and button horizontally */
.product-variation-needles .product-variation-add-to-cart form {
  display: flex;
  align-items: center; 
  justify-content: center;
  margin: 0;
  gap: 8px; /* Space between quantity and button */
}

/* Remove extra margins from the quantity field container */
.product-variation-needles .product-variation-add-to-cart .form-item {
  margin: 0 !important;
}

/* Force the button and quantity label to have zero bottom margin */
.product-variation-needles .product-variation-add-to-cart .form-actions,
.product-variation-needles .product-variation-add-to-cart .form-item {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

/* If the button still feels high, target it directly for a small nudge */
.product-variation-needles .button--add-to-cart {
  position: relative;
  top: 2px; /* Fine-tune this value (1px to 4px) until it looks perfect to your eye */
}

/* Target the Title specifically */
.related-product-item {
    display: flex !important;
    flex-direction: column !important; /* Stack image and text vertically */
    align-items: center !important;    /* This centers everything horizontally */
    text-align: center !important;     /* Centers the text inside the div */
}

.related-product-item .views-field-title .field-content div a {
    font-size: 18px !important; /* Larger font */
    color: #333 !important;      /* Darker color for visibility */
    text-decoration: none !important;
    display: block;
    text-align: center !important;
}

/* 1. Make the row/container items equal height */
.view-products-on-sale .view-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Space between boxes */
}

/* 2. Ensure every product teaser takes full height of its grid slot */
.product-teaser-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-teaser {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto; /* Ensures it stretches to fill the wrap */
    height: 100%;
    border: 1px solid #eee; /* Optional: matches your image border */
}

.product-teaser-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 3. The Image Area - keep it consistent */
.product-image {
    flex: 0 0 200px; /* Fixed height for the image area */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    max-height: 100%;
    width: auto;
}

/* 4. The Meta Area - This is where the magic happens */
.product-meta-wrap {
    flex: 1 0 auto; /* This area takes up all remaining space */
    display: flex;
    flex-direction: column;
    text-align: center;
}

/* 5. Set a min-height for titles so short titles don't collapse the box */
.product-title-catalog {
    min-height: 3em; /* Ensures 2 lines of space even if title is 1 line */
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-yarn-content {
    color: #666;
    min-height: 2.5em; /* Ensures space for yarn content is consistent */
}

/* Container for the randomized grid */
.view-id-your_view_name .view-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 20px 0;
}

/* The container that holds all the products */
.view-id-your_view_name .view-content {
    display: flex; /* This is the magic line that puts them side-by-side */
    flex-wrap: wrap; /* Allows them to wrap to a second line if there are more than 5-6 */
    gap: 15px; /* Space between the items */
    justify-content: center; /* Centers the row on the page */
}

/* Target the inner wrapper of each grid item */
.views-view-responsive-grid__item-inner, .product-teaser-wrap.product-teaser-attribute {
    background: #ffffff !important;
    border-radius: 15px !important; /* Rounded corners like your brand image */
    padding: 20px !important;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important; /* Soft modern shadow */
    border: 1px solid #f0f0f0 !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    
    /* Ensure content inside is vertically aligned */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%; /* Keeps all boxes same height in the row */
}

/* Hover effect */
.views-view-responsive-grid__item-inner:hover, .product-teaser-wrap.product-teaser-attribute:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

/* Style the image container */
.views-field-field-image-teaser {
    margin-bottom: 15px;
}

/* Ensure the image is rounded and fits the tile */
.views-field-field-image-teaser img {
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Style the Title (Noto Sans) */
.views-field-title a {
    font-family: 'Noto Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #333 !important;
    text-decoration: none;
}

/* Remove any default Martis background from the whole view area */
.view-content {
    background: transparent !important;
}



/* 2. Remove Martis default background highlights */
.product-teaser-bg {
    display: none !important; /* Removes the theme's default grey/colored background */
}


/* 4. Image Styling */
.product-image img {
    border-radius: 10px !important;
    max-width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

/* 5. Typography Fixes (Noto Sans) */
.product-title-catalog .field-title {
    font-family: 'Noto Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #333 !important;
}

/* Sub-text (The Yarn Content) */
.product-yarn-content .field-field-yarn-content {
    font-family: 'Noto Sans', sans-serif !important;
    color: #777 !important;
}



/* 1. Ensure the container fills the grid height */
.product-variation-list-row {
    display: flex;
    flex-wrap: wrap;
}

.product-variation-grid-item {
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 25px !important;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center; /* Keeps button and input centered */
    height: 100%;
    height: 100% !important; /* Forces all boxes in a row to match the tallest one */
    justify-content: space-between; /* Pushes the price/button to the bottom */
}

/* 2. Fix the Title Height */
/* This is the most important part: it gives every title the same 'space' */
.product-variation-title {
    min-height: 64px; /* Adjust this based on your font size (roughly 2-3 lines of text) */
    display: flex;
    align-items: center; /* Vertically centers shorter titles within that space */
    justify-content: center;
}

.product-variation-title .field-title {
    margin: 0 !important;
    line-height: 1.2;
}

.variation-contents-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allows this area to expand to fill the box */
}

.product-variation-add-to-cart {
    margin-top: auto; /* Pushes the button area to the bottom of the card */
}

/* Remove the Bootstrap 'Card' styling that wraps the search results */
.custom_product_search_results .card.shadow-sm,
#block-martis-content--3 .card.shadow-sm {
    border: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Remove internal card-body padding so your product card touches the edges */
.custom_product_search_results .card-body,
#block-martis-content--3 .card-body {
    padding: 0 !important;
}

/* Force the search row to act like the catalog flex-grid */
.custom_product_search_results .row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

/* Ensure the product teaser wrap expands to full width of the column */
.custom_product_search_results .product-teaser-wrap.product-teaser-attribute {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 30px !important;
}

/* Mobile padding for product tabs */
@media (max-width: 767px) {
  .product-tabs-wrapper {
    padding-bottom: 20px;
  }
}

/* Mobile Product Variation Cards - Complete Redesign */
@media (max-width: 767px) {
  
  /* Card container */
  .grid-item-product-variations .product-variation-grid-item {
    width: 100%;
  }
  
  .grid-item-product-variations .product-variation-list-row.container-fluid {
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 10px;
  }
  
  /* Image */
  .grid-item-product-variations .product-variation-image {
    width: 100%;
    max-width: 120px;
    margin-bottom: 8px;
  }
  
  .grid-item-product-variations .product-variation-image img {
    width: 100%;
    height: auto;
  }
  
  /* Title - truncate long names */
  .grid-item-product-variations .product-variation-title {
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 6px;
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    width: 100%;
  }
  
  /* Stock info */
  .grid-item-product-variations .product-variation-stock {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
  }
  
  /* Price section */
  .grid-item-product-variations .product-variation-list-price,
  .grid-item-product-variations .product-variation-price-sale {
    font-size: 14px;
    font-weight: 600;
  }
  
  .grid-item-product-variations .product-variation-list-price {
    color: #999;
    text-decoration: line-through;
    font-size: 12px;
  }
  
  /* Quantity + Add to cart row */
  .grid-item-product-variations .product-variation-add-to-cart {
    width: 100%;
    margin-top: 8px;
  }
  
  .grid-item-product-variations .product-variation-add-to-cart form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  
  /* Hide quantity label */
  .grid-item-product-variations .form-item-quantity-0-value label {
    display: none;
  }
  
  /* Quantity wrapper */
  .grid-item-product-variations .form-item-quantity-0-value {
    display: flex;
    justify-content: center;
    margin: 0;
  }
  
  /* Quantity input */
  .grid-item-product-variations input.form-number,
  .grid-item-product-variations input[type="number"] {
    width: 60px !important;
    max-width: none !important;
    height: 36px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    -moz-appearance: textfield;
  }
  
  .grid-item-product-variations input[type="number"]::-webkit-outer-spin-button,
  .grid-item-product-variations input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  
  /* Add to cart button */
  .grid-item-product-variations .product-variation-add-to-cart button[type="submit"],
  .grid-item-product-variations .product-variation-add-to-cart input[type="submit"] {
    width: 100%;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
  }
  
  /* Hide unnecessary form elements */
  .grid-item-product-variations .product-variation-add-to-cart .field--name-purchased-entity {
    display: none;
  }
    /* Fix button text cutoff */
  .grid-item-product-variations .product-variation-add-to-cart button[type="submit"],
  .grid-item-product-variations .product-variation-add-to-cart input[type="submit"] {
    width: 100%;
    padding: 10px 5px;
    font-size: 10px !important;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Mobile Quantity +/- Buttons */
@media (max-width: 767px) {
  .grid-item-product-variations .qty-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .grid-item-product-variations .qty-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
  }

  .grid-item-product-variations .qty-btn:active {
    background: #e0e0e0;
  }

  .grid-item-product-variations .qty-minus {
    border-radius: 4px 0 0 4px;
    border-right: none;
  }

  .grid-item-product-variations .qty-plus {
    border-radius: 0 4px 4px 0;
    border-left: none;
  }

  .grid-item-product-variations .qty-wrapper input[type="number"] {
    width: 50px !important;
    height: 36px;
    text-align: center;
    border-radius: 0;
    border: 1px solid #ddd;
    -moz-appearance: textfield;
  }

  .grid-item-product-variations .qty-wrapper input[type="number"]::-webkit-outer-spin-button,
  .grid-item-product-variations .qty-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .product-variation-title {
    min-height: 10px !important; 
  }
}

/**
 * Needle Variation Cards - Single Line Layout
 * Add this to product-custom.css
 */

/* Override the grid wrapper to stack vertically */
.needle-variation-table .grid-wrapper {
  flex-direction: column !important;
  gap: 8px !important;
  padding: 0 !important;
  width: 100% !important;
}

/* Make each grid item full width */
.needle-variation-table .grid-wrapper > div,
.needle-variation-table .grid-wrapper > .grid-item,
.needle-variation-table .grid-wrapper > [class*="col-"] {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* product-variation-list-row wrapper */
.needle-variation-table .product-variation-list-row {
  display: block !important;
  width: 100% !important;
}

/* Card styling */
.needle-variation-table .product-variation-grid-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
}

/* Single line grid layout */
.needle-variation-table .variation-contents-wrapper {
  display: grid !important;
  grid-template-columns: 50px 2fr 1fr 1fr 1fr !important;  grid-template-rows: auto !important;
  gap: 0 12px !important;
  align-items: center !important;
  width: 100% !important;
}

/* Badge - absolute positioned */
.needle-variation-table .product-badge {
  position: absolute;
  top: -6px;
  left: 10px;
  z-index: 1;
}

.needle-variation-table .badge-label {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Image */
.needle-variation-table .product-variation-image {
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.needle-variation-table .product-variation-image img {
  width: 45px !important;
  height: auto !important;
  border-radius: 4px;
  object-fit: cover;
}

/* Title */
.needle-variation-table .product-variation-title {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

.needle-variation-table .product-variation-title .field-item,
.needle-variation-table .product-variation-title .field {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin: 0;
}

/* RTL alignment */
[dir="rtl"] .needle-variation-table .product-variation-title {
  justify-content: right;
  text-align: right;
}

/* LTR alignment */
[dir="ltr"] .needle-variation-table .product-variation-title {
  justify-content: left;
  text-align: left;
}

/* Stock */
.needle-variation-table .product-variation-stock {
  grid-column: 3 !important;
  grid-row: 1 !important;
}

.needle-variation-table .product-variation-stock .field {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.needle-variation-table .product-variation-stock .field-label {
  font-size: 12px;
  color: #888;
  margin: 0;
}

.needle-variation-table .product-variation-stock .field-item {
  font-size: 12px;
  color: #333;
  font-weight: 500;
}

/* Price */
.needle-variation-table .product-variation-price-sale {
  grid-column: 4 !important;
  grid-row: 1 !important;
}

.needle-variation-table .product-variation-price-sale .field-label {
  display: none !important;
}

.needle-variation-table .product-variation-price-sale .field-item {
  font-weight: 700;
  font-size: 15px;
  color: #2a9d8f;
  white-space: nowrap;
}

.needle-variation-table .product-variation-price-sale .field {
  margin: 0;
}

/* Add to cart */
.needle-variation-table .product-variation-add-to-cart {
  grid-column: 5 !important;
  grid-row: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Hide autocomplete field */
.needle-variation-table .form-item-purchased-entity-0-target-id,
.needle-variation-table .form-type-entity-autocomplete {
  display: none !important;
}

/* Compact add-to-cart form */
.needle-variation-table .commerce-order-item-variation-cart-form-form {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

/* Quantity input */
.needle-variation-table .form-item-quantity-0-value {
  margin: 0 !important;
}

.needle-variation-table .form-item-quantity-0-value > label {
  display: none !important;
}

.needle-variation-table input.form-number,
.needle-variation-table input[type="number"] {
  width: 45px !important;
  padding: 6px 4px !important;
  text-align: center !important;
  border: 1px solid #ddd !important;
  border-radius: 4px !important;
  font-size: 13px !important;
}

/* Add to cart button */
.needle-variation-table .button--add-to-cart,
.needle-variation-table input[type="submit"] {
  font-size: 12px !important;
  border-radius: 4px !important;
  white-space: nowrap !important;
}

/* Hide list price */
.needle-variation-table .product-variation-list-price {
  display: none !important;
}

/* Hide unnecessary form elements */
.needle-variation-table .form-type-checkbox {
  display: none !important;
}

.needle-variation-table .grid-item {
  margin-bottom: 0 !important;
}

.new-products-view .field-field-yarn-content, .product-title-catalog .field-title {
  direction: rtl;
}

.new-products-view .field-field-yarn-content {
    padding-bottom: 0 !important;
}


/* Mobile Layout - 3 columns for needles only */
@media (max-width: 767px) {
  /* Full width container */
  .needle-variation-table {
    padding: 0 0 !important;
  }

  .needle-variation-table .grid-wrapper {
    padding: 0 !important;
  }

  .needle-variation-table .grid-item {
    margin-bottom: 0 !important;
  }

  .needle-variation-table .product-variation-grid-item {
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 3 column grid: Image | Title+Stock+Price | Add to Cart */
  .needle-variation-table .variation-contents-wrapper {
    grid-template-columns: 50px 1fr 110px !important;
    grid-template-rows: auto auto auto !important;
    gap: 4px 8px !important;
    width: 100% !important;
  }

  /* Image - spans all 3 rows */
  .needle-variation-table .product-variation-image {
    grid-column: 1 !important;
    grid-row: 1 / 4 !important;
  }

  .needle-variation-table .product-variation-image img {
    width: 45px !important;
  }

  /* Title - row 1, col 2 */
  .needle-variation-table .product-variation-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  .needle-variation-table .product-variation-title .field-item,
  .needle-variation-table .product-variation-title .field {
    font-size: 13px;
  }

  /* Stock - row 2, col 2 */
  .needle-variation-table .product-variation-stock {
    grid-column: 2 !important;
    grid-row: 2 !important;
  }

  .needle-variation-table .product-variation-stock .field {
    display: flex !important;
    align-items: center;
    gap: 4px;
    font-size: 11px;
  }

  .needle-variation-table .product-variation-stock .field-label,
  .needle-variation-table .product-variation-stock .field-item {
    font-size: 11px;
  }

  /* Price - row 3, col 2 */
  .needle-variation-table .product-variation-price-sale {
    grid-column: 2 !important;
    grid-row: 3 !important;
  }

  .needle-variation-table .product-variation-price-sale .field {
    display: flex !important;
  }

  .needle-variation-table .product-variation-price-sale .field-label {
    display: none !important;
  }

  .needle-variation-table .product-variation-price-sale .field-item {
    font-size: 12px;
    font-weight: 600;
    color: #2a9d8f;
  }

  /* Add to Cart - spans all 3 rows, col 3 */
  .needle-variation-table .product-variation-add-to-cart {
    grid-column: 3 !important;
    grid-row: 1 / 4 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Stack quantity and button vertically */
  .needle-variation-table .commerce-order-item-variation-cart-form-form {
    flex-direction: column !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Quantity wrapper */
  .needle-variation-table .form-item-quantity-0-value {
    margin: 0 !important;
  }

  .needle-variation-table .form-item-quantity-0-value label {
    display: none !important;
  }

  /* Qty wrapper from JS */
  .needle-variation-table .qty-wrapper {
    display: flex !important;
    align-items: center !important;
  }

  /* +/- buttons styling */
  .needle-variation-table .qty-btn {
    width: 28px;
    height: 32px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    padding: 0;
    line-height: 1;
  }

  .needle-variation-table .qty-btn:hover {
    background: #e8e8e8;
  }

  .needle-variation-table .qty-btn.qty-minus {
    border-radius: 4px 0 0 4px;
    border-right: none;
  }

  .needle-variation-table .qty-btn.qty-plus {
    border-radius: 0 4px 4px 0;
    border-left: none;
  }

  /* Quantity input - hide native spinner */
  .needle-variation-table input.form-number,
  .needle-variation-table input[type="number"] {
    width: 35px !important;
    height: 32px !important;
    padding: 0 !important;
    font-size: 13px !important;
    border: 1px solid #ddd !important;
    border-radius: 0 !important;
    text-align: center !important;
    -moz-appearance: textfield !important;
  }

  .needle-variation-table input[type="number"]::-webkit-outer-spin-button,
  .needle-variation-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
  }

  /* Add to cart button */
  .needle-variation-table .button--add-to-cart,
  .needle-variation-table input[type="submit"] {
    padding: 0px 10px !important;
    font-size: 11px !important;
    width: 100% !important;
    max-width: 100px !important;
  }

  /* Smaller badge */
  .needle-variation-table .badge-label {
    font-size: 8px;
    padding: 2px 5px;
  }
  

}

/* Care Instructions Table */
.care-icons-table .field-items {
  display: flex;
  flex-direction: column;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 12px;
}

.care-icons-table .field-item {
  border-bottom: 1px solid #f0f0f0;
}

.care-icons-table .field-item:last-child {
  border-bottom: none;
}

.care-icon-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #fff;
  transition: background 0.2s;
}

.care-icon-row:hover {
  background: #f8f9fa;
}

.care-icon-image {
  flex-shrink: 0;
  width: 44px;
  height: 36px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.care-icon-image img {
  width: 36px;
  height: auto;
  object-fit: cover;
  object-position: top;
}

.care-icon-label {
  font-size: 14px;
  color: #444;
  font-family: 'Noto Sans', sans-serif;
}

.needle-variation-table .form-actions {
  margin-bottom: 0 !important;
  align-self: center !important;
}

.needle-variation-table .form-item-quantity-0-value {
  align-self: center !important;
}

.needle-variation-table .product-variation-title {
  min-height: 0 !important;
}