/* --- Wrapper for the checkbox group --- */
.ab-form-group__children.checkbox-wrapper-16 {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start; /* align rows at top */
}

/* --- Ensure dropdowns take full width --- */
.ab-form-group__children.checkbox-wrapper-16 > .ab-dropdown,
.ab-form-group__children.checkbox-wrapper-16 .ab-dropdown.choice-element {
  flex: 0 0 100% !important;
  min-width: 0;
  display: block !important;
}

/* --- Checkbox tile --- */
.ab-form-group__children.checkbox-wrapper-16 > .ab-checkbox {
  flex: 0 0 11rem;   /* fixed width */
  height: 11rem;     /* fixed height */
  box-sizing: border-box;
  margin-top: 0 !important;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;

  /* ✅ Restore visual styling */
  border: 2px solid #99bd25;
  border-radius: 0.75rem;
  background-color: #013539;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: all 0.25s ease;
  cursor: pointer;
}

/* --- Checkbox label inside tile --- */
.ab-form-group__children.checkbox-wrapper-16 .ab-checkbox__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  box-sizing: border-box;
  margin: 0;

  font-size: 1.5rem;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: center;
}

/* --- Icon inside label --- */
.ab-form-group__children.checkbox-wrapper-16 .ab-checkbox__label .checkbox-icon {
  width: 5rem;
  height: 5rem;
  margin-bottom: 0.5rem;
  background-size: cover;
  background-position: center;
  border-radius: 0.5rem;
  flex-shrink: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* --- Hide native checkbox --- */
.ab-form-group__children.checkbox-wrapper-16 .ab-checkbox__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* --- Hover effects for tiles --- */
.ab-form-group__children.checkbox-wrapper-16 > .ab-checkbox:hover {
  transform: translateY(-3px);
  border-color: #99bd25;
  box-shadow: 0 6px 14px rgba(166,188,113,0.25);
}
.ab-form-group__children.checkbox-wrapper-16 > .ab-checkbox:hover .checkbox-icon {
  transform: scale(1.08);
}

/* --- Checked / selected effects --- */
.ab-form-group__children.checkbox-wrapper-16 .ab-checkbox__input:checked + .ab-checkbox__label {
  color: #99bd25;
}
.ab-form-group__children.checkbox-wrapper-16 .ab-checkbox__input:checked + .ab-checkbox__label .checkbox-icon {
  box-shadow: 0 0 0 3px #99bd25, 0 0 10px rgba(166,188,113,0.4);
  transform: scale(1.05);
}

/* --- 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;
}