/* --- Responsive Grid Adjustment (Larger Images, Fewer Per Row) --- */
.detail-images .repeat-element__repeated-elements {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; 
    gap: 1rem;
    justify-items: center;
}

/* 1. Define the square shape on the immediate grid item */
.detail-images .repeat-element__repeated-elements > div {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

/* 2. Force 100% height through all wrapper layers (to prevent gaps) */
.detail-images .element__wrapper,
.detail-images .element__inner-wrapper,
.detail-images .image-element {
  width: 100%;
  height: 100%;
}

/* 3. Baserow image wrapper: Apply Border Radius and Overflow here */
.detail-images .ab-image {
  width: 100%;
  height: 100%;
  overflow: hidden; /* CRITICAL: Clips the scaled corners */
  border-radius: 0.5rem; /* CRITICAL: Maintains the corner shape */
}

/* 4. The Image itself: Fill and Hover */
.detail-images .ab-image__img {
  width: 100%;
  height: 100%; 
  object-fit: cover; 
  
  /* Gap elimination */
  display: block; 
  vertical-align: top;
  
  /* Hover and Shadow settings */
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  cursor: zoom-in; /* Changed to zoom-in to match previous code */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 5. Hover Effect: Image scales within the rounded container */
.detail-images .ab-image__img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* === Responsive behavior === */
@media (min-width: 768px) {
  .detail-images .repeat-element__repeated-elements {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (min-width: 1024px) {
  .detail-images .repeat-element__repeated-elements {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}


/* Modal overlay (shared globally, but invisible until used) */
#imageModal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
}

/* Enlarged image */
#imageModal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 0.5rem;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  transition: transform 0.25s ease;
}

#imageModal img:hover {
  transform: scale(1.02);
}

#imageModal.show {
  display: flex;
}

/* Navigation arrows */
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: white;
  cursor: pointer;
  user-select: none;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.modal-arrow:hover {
  opacity: 1;
}

.modal-arrow.left {
  left: 40px;
}

.modal-arrow.right {
  right: 40px;
}

/* ----------------------------------------------------------------------
   --- STABLE NEON GLOW (v7.2 - Builder Cleanup Fix) ---
   This version is the same as v7, but adds dedicated, high-specificity 
   rules to kill Baserow's default padding, margin, and borders 
   set in the visual app builder.
   ---------------------------------------------------------------------- 
*/

/* --- BUILDER CLEANUP (Targeted Overrides to remove App Builder styles) --- */

/* 1. Kill all padding and margin on the main card container */
.search-section .repeat-element__repeated-elements > div > .element__wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

/* 2. Kill all padding and margin on the image/content inner wrapper */
.search-section .repeat-element__repeated-elements > div > .element__wrapper > .element__inner-wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

/* 3. Kill the builder's border CSS variables */
.search-section .repeat-element__repeated-elements > div > .element__wrapper {
    --element-border-top: none !important;
    --element-border-bottom: none !important;
    --element-border-left: none !important;
    --element-border-right: none !important;
}

/* --- 1. OVERALL CARD STRUCTURE & HEIGHT (Visual Styles) --- */
.search-section .repeat-element__repeated-elements > div > .element__wrapper {
    height: 100% !important; 
    overflow: hidden; 
    display: flex;
    flex-direction: column; 
    cursor: pointer;
    position: relative !important; 
    z-index: 1 !important;
    
    /* Base state: solid dark background and border */
    background-color: #013539;
    border: 3px solid #013539 !important; /* Re-apply our custom border */
    border-radius: 20px;
    padding: 20px; !important
    /* Add transitions */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* --- 2. NEW, RELIABLE HOVER EFFECT --- */
.search-section .repeat-element__repeated-elements > div > .element__wrapper:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0px 0px 30px 1px rgba(153, 189, 37, .30); /* The Glow */
    z-index: 10 !important; 
    
    border-color: #99bd25 !important; /* The Neon Border */
}

/* --- 3. IMAGE SECTION SIZING (Fixed height, prevents shrinking) --- */
.search-section .image-element.element {
    height: 250px !important; 
    flex-shrink: 0; /* Prevents this element from shrinking */
    
    width: 100% !important;
    min-width: 100% !important; 
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 10px !important; /* Round all corners */
}

/* --- 4. CONTENT AREA SIZING (Fills remaining space) --- */
/* This is the wrapper for all the text/button content */
.search-section .repeat-element__repeated-elements > div > .element__wrapper > .element__inner-wrapper > .element__wrapper:nth-child(2) {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Prevents overflow issues in flex columns */
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: auto !important;
}

/* --- 5. IMAGE FILL & ALIGNMENT --- */
.search-section .image-element.element .ab-image,
.search-section .image-element.element .ab-image__img {
    width: 100% !important;
    height: 250px !important; 
    object-fit: cover !important; 
    object-position: top !important; 
    display: block;
    border-radius: 10px !important; 
}

.search-section .element__inner-wrapper,
.search-section .element__inner-wrapper > .element__wrapper {
    width: 100%;
    min-height: 0; 
}


/* --- 6. CLICKABLE LINK FIX (Your Stable Code) --- */
.search-section .card-link {
    margin: 0 !important; padding: 0 !important; height: 0 !important;
    position: absolute !important;
    top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
    z-index: 5 !important; 
    cursor: pointer !important;
    background: transparent !important;
}
.search-section .card-link.element {
    height: 100% !important; width: 100% !important; padding: 0 !important;
    margin: 0 !important; overflow: visible !important;
}
.search-section .card-link a {
    width: 100% !important; height: 100% !important; display: block !important;
    color: transparent !important; text-decoration: none !important;
    font-size: 0 !important; line-height: 0 !important; background: transparent !important;
}
.search-section .repeat-element__repeated-elements > div {
    overflow: visible !important;
}


/* --- 7. TEXT & BUTTON LAYOUT (Now inside the flex-grow content area) --- */
/* We target the wrappers *inside* the new flex-grow container */
.search-section .repeat-element__repeated-elements > div > .element__wrapper > .element__inner-wrapper > .element__wrapper:nth-child(2) > .element__wrapper {
    width: 100% !important; 
    padding: 10px 15px !important; 
    box-sizing: border-box !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Doll Name Link (wrapper 1 *inside* content area): Left Aligned */
.search-section .repeat-element__repeated-elements > div > .element__wrapper > .element__inner-wrapper > .element__wrapper:nth-child(2) > .element__wrapper:nth-child(1) {
    align-items: flex-start; 
    text-align: left !important;
}

/* Company Name Link (wrapper 2 *inside* content area): Centered and ABSORBS SPACE */
.search-section .repeat-element__repeated-elements > div > .element__wrapper > .element__inner-wrapper > .element__wrapper:nth-child(2) > .element__wrapper:nth-child(2) {
    text-align: center !important; 
    flex-grow: 1; /* Pushes button to the bottom */
}

/* Size Button (wrapper 3 *inside* content area): Centered */
.search-section .repeat-element__repeated-elements > div > .element__wrapper > .element__inner-wrapper > .element__wrapper:nth-child(2) > .element__wrapper:nth-child(3) {
    text-align: center !important;
}

/* 1. Primary Links and Titles (#99bd25) */
.filters__none-title, 
.button-text__label, 
.button-text__icon {
    color: #99bd25 !important;
}

/* 2. Secondary Labels and Descriptions (#a6bc71) */
.filters__none-description,
.filters__operator-where {
    color: #a6bc71 !important;
}

/* 3. Interaction (Optional) */
.button-text:hover .button-text__label {
    filter: brightness(1.2); /* Makes the lime green slightly glow on hover */
}

/* Styling the "all disabled" text label */
.switch__label {
    color: #a6bc71 !important;
}

/* Styling the switch track (the background of the toggle) */
.switch.switch--color-green {
    background-color: rgba(166, 188, 113, 0.2) !important; /* Muted sage at 20% opacity */
    border: 1px solid #a6bc71;
}

/* Styling the switch knob (the part that moves) */
.switch.switch--color-green .switch__button {
    background-color: #99bd25 !important; /* Your bright link color */
}

/* If the switch is 'active' or 'on', you might want to brighten the track */
.switch.switch--color-green.active {
    background-color: #99bd25 !important;
}

.filters__group-item {
    background-color: #1e4856 !important;
    border: 1px solid #013539 !important;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 6px 0;
}


.filters__operator-text {
    margin-left: 12px;
    color: #a6bc71 !important;
}

/* 1. The Empty State Text */
.sortings__none-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #99bd25 !important; /* Using your brighter green for the title */
}

.sortings__none-description {
    font-size: 13px;
    color: #a6bc71 !important; /* Sage for the description */
}

/* 2. The Remove/Trash/Cancel buttons */
.sortings__remove {
    align-items: center;
    color: #a6bc71 !important; /* Changed from #070810 */
    display: flex;
    font-size: 20px;
    gap: 0;
    justify-content: center;
    width: 22px;
}

/* Targeting the "Sort by" label */
.sortings__description {
    color: #a6bc71 !important;
    font-size: 13px; /* Matches the other descriptions */
    font-weight: 500;
}

/* 3. The Sorting Order Labels/Items */
.sortings__order-item {
    align-items: center;
    border-radius: 4px;
    color: #a6bc71 !important; /* Changed from #070810 */
    border: 1px solid rgba(166, 188, 113, 0.3); /* Optional: subtle border to see the box */
    display: flex;
    flex-wrap: nowrap;
    font-size: 14px;
    font-weight: 600;
    gap: 5px;
    height: 32px;
    justify-content: center;
    width: 80px;
}

/* 4. Targeting the specific icons directly */
.iconoir-cancel, 
.iconoir-arrow-right {
    color: #a6bc71 !important;
}

/* Hover effect for the cancel icon to make it feel like a button */
.sortings__remove:hover .iconoir-cancel {
    color: #99bd25 !important; /* Pops brighter on hover */
}

/* Styling the active sort button (e.g., Z -> A) */
.sortings__order-item.active {
    background-color: #99bd25 !important; /* Bright green background */
    color: #013539 !important;            /* Dark blue text */
    border: none !important;              /* Remove any default borders */
}

/* Ensuring the icon inside the active button also turns dark blue */
.sortings__order-item.active .iconoir-arrow-right {
    color: #013539 !important;
}

/* Optional: Slight hover effect when active to show it's still clickable */
.sortings__order-item.active:hover {
    background-color: #a6bc71 !important; /* Muted sage on hover */
    filter: brightness(1.1);
    cursor: pointer;
}

/* Ensure the icon stays dark blue during the hover too */
.sortings__order-item.active:hover .iconoir-arrow-right {
    color: #013539 !important;
}

/* Target the inactive sorting item hover state */
.sortings__order-item:not(.active):hover {
    background-color: #a6bc71 !important; /* Sage background on hover */
    color: #013539 !important;            /* Dark blue text on hover */
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Ensure icons inside the inactive hover also turn dark blue */
.sortings__order-item:not(.active):hover i {
    color: #013539 !important;
}

/* Push the Baserow context/filter menus to the very front */
.context {
    z-index: 2000 !important;
}