/* CSS fixes for the Bildbyran photo archive */

/* Admin album rename pencil */
.image-wrapper:hover .album-edit-pencil { opacity: 0.6 !important; }
.album-edit-pencil:hover { opacity: 1 !important; }

/* Ensure entire theme has #fafafa background */
html, body {
  background-color: #fafafa !important;
  height: 100%;
}

.min-h-screen {
  background-color: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main content wrapper - added for sidebar push functionality */
.main-content-wrapper {
  display: flex;
  flex-direction: row;
  width: 100%;
  position: relative;
  min-height: 100vh; /* Ensure wrapper fills full viewport */
}

/* The main content area that will adjust when sidebar opens */
.flex-1.main-content-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #fafafa !important;
}

/* When sidebar is open on desktop, make main content scrollable */
@media (min-width: 640px) {
  body.sidebar-open .flex-1.main-content-area {
    min-height: 100vh; /* Ensure it fills full height */
    overflow-y: auto;
  }
  
  /* Remove footer fixes when sidebar is open - let it flow naturally */
  body.sidebar-open #footer-wrap {
    position: relative !important;
    margin-top: auto !important;
  }
}

/* When sidebar is open, ensure main content area fits perfectly */
body.sidebar-open .flex-1.main-content-area {
  padding-right: 0;
  margin-right: 0;
}

/* Search tags styling */
.bg-\[\#8d53ff\] {
  background-color: #8d53ff;
}

.text-\[\#a0a0a0\] {
  color: #a0a0a0;
}

/* Footer fixes for infinite scroll */
#footer-wrap {
  position: relative !important;
  z-index: 1;
  margin-top: auto;
  /* Prevent any sticky behavior */
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
}

/* Ensure footer stays behind sidebar on iOS Safari */
body.sidebar-open #footer-wrap {
  z-index: 0 !important;
}

/* Sidebar download button */
.sidebar-download-btn {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

/* Ensure the main body can grow with infinite scroll */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
  overflow: hidden;
}

.min-h-screen {
  flex: 1 0 auto;
}

/* Critical sidebar fixes */
.sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  height: 100dvh; /* Dynamic viewport height - works on iOS Safari */
  background-color: #111827;
  color: white;
  padding: 0.5rem;
  overflow-y: auto;
  z-index: 50;
  transform: translateX(100%);
  contain: layout style; /* Remove paint containment which might clip children */
}

@media (min-width: 640px) {
  .sidebar {
    width: 40%;
  }
  
  /* When sidebar is active, adjust content area width */
  body.sidebar-open .flex-1.main-content-area {
    width: 60%;
    padding-right: 0; /* Ensure no right padding */
  }
  
  /* When sidebar is active, push the content area to the left */
  body.sidebar-open .main-content-wrapper {
    padding-right: 40%;
  }
  
  /* Make sure content area stays scrollable when sidebar is open */
  body.sidebar-open {
    overflow: visible !important;
  }
  
  /* Ensure the grid fills the available space */
  body.sidebar-open #imageGrid {
    width: 100% !important;
    margin-right: 0 !important;
  }
}

/* Force sidebar visibility when active */
.sidebar.active {
  transform: translateX(0) !important;
}

/* Only restrict overflow on mobile */
@media (max-width: 639px) {
  body.sidebar-open {
    overflow: hidden;
  }
}

/* Dropdown menu fixes */
.dropdown {
  position: absolute;
  top: 100%;
  margin-top: 4px;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 10;
  width: auto;
  display: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
}

.dropdown.active {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* Reset and fix the grid layout - Mobile first approach */
#imageGrid {
  display: grid !important;
  grid-template-columns: 1fr !important; /* Default to single column for mobile */
  gap: 12px !important;
  padding: 12px !important;
  box-sizing: border-box !important; /* Ensure padding is included in width */
  flex: 1; /* Allow grid to expand to fill available space */
  align-content: start; /* Align content to the top */
}

/* Desktop view with multiple columns */
@media (min-width: 641px) {
  #imageGrid {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)) !important;
    gap: 16px !important;
    padding: 16px !important;
  }

  /* Photo view (inside album): 5-across with smaller min-width */
  #imageGrid.photo-view-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  }

  /* When sidebar is open, keep the same image size but compress into fewer columns */
  body.sidebar-open #imageGrid {
    grid-template-columns: repeat(auto-fill, 310px) !important;
    justify-content: start; /* Align to the start instead of center to avoid extra spacing */
    padding-right: 0 !important; /* Remove right padding */
    padding-bottom: 0 !important; /* Remove bottom padding to prevent white space */
  }

  body.sidebar-open #imageGrid.photo-view-grid {
    grid-template-columns: repeat(auto-fill, 240px) !important;
  }
}

/* These rules are now handled by the main desktop media query above */

/* Standard image container styles */
.image-container {
  position: relative !important;
  width: 100% !important;
  margin-bottom: 0 !important;
  overflow: hidden !important;
}

.image-container.sidebar-active {
  outline: 3px solid #C6007C;
  outline-offset: -3px;
  z-index: 1;
}

/* Action links bar - prevent text selection and ensure taps work on iOS */
.action-links-bar a,
.action-links-bar button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Album view - rounded corners */
.image-container:not(.photo-view) {
  border-radius: 8px !important;
  overflow: hidden !important;
}

/* Photo view - no container rounding, radius is on .image-item */
.image-container.photo-view {
  border-radius: 0 !important;
}

/* Image wrapper adjustments */
.image-wrapper {
  width: 100% !important;
  position: relative !important;
  display: block !important;
}

/* Fix the main image container */
.image-wrapper .flex.items-center.justify-center.bg-white,
.image-wrapper .relative {
  width: 100% !important;
  background-color: #fafafa !important; /* Changed from transparent to match body background */
  position: relative !important;
  display: block !important;
  overflow: hidden !important;
}

/* Album view image containers - rounded corners */
.image-container:not(.photo-view) .image-wrapper .flex.items-center.justify-center.bg-white,
.image-container:not(.photo-view) .image-wrapper .relative {
  border-radius: 8px !important;
}

/* Photo view image containers - no rounding */
.image-container.photo-view .image-wrapper .flex.items-center.justify-center.bg-white,
.image-container.photo-view .image-wrapper .relative {
  border-radius: 0 !important;
}

/* Album view images - rounded corners */
.image-container:not(.photo-view) .image-item {
  border-radius: 8px !important;
}

/* Style the images themselves */
.image-item {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}

/* On multi-column grid, constrain all image containers to same height */
@media (min-width: 641px) {
  #imageGrid .image-wrapper .aspect-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.67%; /* 3:2 ratio */
  }
  #imageGrid .image-wrapper .aspect-container .image-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* Album view images */
.image-container:not(.photo-view) .image-item {
}

/* Album name clamp - mobile: no clamp, desktop: max 2 lines */
@media (min-width: 641px) {
  .album-name-clamp {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* Photo view images - no rounded corners */
.image-container.photo-view .image-item {
  border-radius: 0 !important;
}

/* Sidebar and lightbox images - NO rounded corners */
.sidebar .image-item,
#sidebarImage,
#fullResImage,
.sidebar img {
  border-radius: 0 !important;
}

/* Fix the controls overlay (exclude album text which has .text-white) */
.image-wrapper .absolute.bottom-0:not(.text-white) {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background-color: rgba(0, 0, 0, 0.7) !important;
  padding: 10px !important;
  z-index: 10 !important;
}

/* Ensure controls show correctly on hover */
.group:hover .group-hover\:opacity-100 {
  opacity: 1 !important;
}

/* Fix the pay photo indicator */
.image-container.pay-photo::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 4px !important;
  background-color: #c6007e !important;
  z-index: 20 !important;
}

/* Remove any fixed height constraints */
.flex.items-center.justify-center.bg-white[style*="height"] {
  height: auto !important;
}
/* Full resolution modal */
#fullResModal {
  position: fixed;
  inset: 0;
  background-color: black;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

#fullResModal.opacity-100 {
  opacity: 1;
}

#fullResModal.hidden {
  display: none;
}

/* Loading indicator */
.loading-indicator {
  text-align: center;
  padding: 2rem;
  min-height: 100px;
}


.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #C6007C;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
  display: none;
}

.loading-indicator.active .spinner {
  display: block;
}

.loading-text {
  display: none;
}

.loading-indicator.active .loading-text {
  display: block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Photo preview tooltip */
.photo-preview {
  position: absolute;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  max-width: 300px;
  text-align: center;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
}

/* Fix hover behavior for image controls in photo view */
.image-wrapper .absolute.bottom-0:not(.text-white) {
  opacity: 0;
}

.image-wrapper:hover .absolute.bottom-0:not(.text-white) {
  opacity: 1;
}

/* Always show album titles (they have .text-white class) */
.image-wrapper .absolute.bottom-0.text-white {
  opacity: 1;
}

/* Sidebar action row: 40px outline circles + 56px pink download circle with hover tooltips */
.sidebar-actions .sb-act { position: relative; }
.sidebar-actions .sidebar-tip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}
.sidebar-actions .sb-act:hover .sidebar-tip { opacity: 1; }

/* Grid-card date/count badges (no backdrop-filter — too costly with 90+ cards) */
.gridcard-badge {
  top: 8px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Pagination (start page) */
.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #eaeaea;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background 0.12s;
}
.pg-btn:hover { background: #e5e7eb; }
.pg-btn--nav { width: 40px; color: #6b7280; }
.pg-btn--num { min-width: 40px; padding: 0 8px; }
.pg-btn--active {
  color: #fff;
  background: #0b0b0f;
  font-weight: 600;
  cursor: default;
}
.pg-btn--active:hover { background: #0b0b0f; }
.pg-btn--disabled {
  border-color: #f0f0f0;
  color: #d1d5db;
  cursor: default;
}
.pg-btn--disabled:hover { background: transparent; }
.pg-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 40px;
  font-size: 13px;
  color: #9ca3af;
}
.pg-perpage-label { font-size: 12px; color: #6b7280; margin-right: 4px; }
.pg-per {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  transition: background 0.12s;
}
.pg-per:hover { background: #e5e7eb; }
.pg-per--active {
  font-weight: 600;
  color: #0b0b0f;
  background: #f5f5f7;
  cursor: default;
}
.pg-per--active:hover { background: #f5f5f7; }

/* Collection header layout */
.coll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
  gap: 12px;
}
.coll-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.coll-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  flex-shrink: 0;
}
.coll-header-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
  white-space: nowrap;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.15s;
}
.coll-header-btn:hover { color: #374151; }
@media (max-width: 640px) {
  .coll-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .coll-header-actions {
    gap: 12px;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .coll-header-btn span { display: none; }
  .coll-header-btn {
    width: 36px;
    height: 36px;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
  }
}
/* When sidebar is open the queue page's content area shrinks; collapse the
   action row to icon-only chips and allow wrap so it stays usable. */
body.sidebar-open .coll-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
body.sidebar-open .coll-header-actions {
  flex-wrap: wrap;
  gap: 10px;
}
body.sidebar-open .coll-header-btn span { display: none; }
body.sidebar-open .coll-header-btn {
  width: 36px;
  height: 36px;
  justify-content: center;
  border-radius: 50%;
  background: #f3f4f6;
}

/* Collection photo hover actions */
.image-wrapper .collection-hover-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.image-wrapper:hover .collection-hover-actions {
  opacity: 1;
}
.coll-action-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.8);
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.coll-action-btn:hover {
  background: #C6007C;
  color: #fff;
}
.coll-action-btn.coll-action-remove:hover {
  background: #dc2626;
}
@media (max-width: 640px) {
  .image-wrapper .collection-hover-actions {
    opacity: 1;
  }
  .coll-action-btn {
    width: 30px;
    height: 30px;
  }
}

/* Make advanced search panel keep hover color when expanded */
#advancedSearchToggle.active {
  background-color: rgba(236, 72, 153, 0.1);
}

/* Mobile scrollable sections */
@media (max-width: 640px) {
  /* Make filter tags scrollable on mobile */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Hide scrollbars for cleaner look */
  .overflow-x-auto::-webkit-scrollbar {
    display: none;
  }
  
  /* Ensure filter tags don't wrap on mobile */
  .overflow-x-auto .inline-flex {
    flex-shrink: 0;
  }
  
  /* Simple filter modal - entire content scrolls naturally */
  #filterPanel {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-height: 100vh !important;
  }
}

/* Support for existing legacy styles */
.topmessage {
  background: #fffecc;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #e0e0a0;
  position: relative;
}

.topmessage-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 16px;
  height: 16px;
  background: url('close.png') no-repeat;
  cursor: pointer;
}

/* Ensure the admin counter badge has the correct background color */
.absolute.top-2.right-2 {
  background-color: #8D53F9 !important;
}

/* Language dropdown specific fixes */
#languageDropdown, #mobileLangDropdown {
  min-width: 150px;
  right: 0;
  left: auto; /* Override any left positioning */
}

/* Ensure hidden class works properly with dropdowns */
.dropdown.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* For mobile view on smaller screens */
@media (max-width: 640px) {
  #mobileLangDropdown {
    min-width: 120px;
    max-width: 150px;
    right: 0;
  }
}

/* Ensure main content and body are set up for scrolling */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

.min-h-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Make sure the main content area can scroll independently */
.main-content-area {
  overflow-y: auto;
  flex: 1;
}

/* Fix z-index issues to ensure content doesn't overlap sidebar */
.sidebar {
  z-index: 100; /* Increased z-index */
}

/* Saved carts dropdown positioning - MUST be higher than sidebar */
#savedCartsDropdown {
  position: fixed !important;
  width: 288px !important;
  max-height: 500px;
  display: block;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  clip: auto !important;
  clip-path: none !important;
  z-index: 10001 !important; /* Higher than sidebar z-index of 100 */
  overflow: hidden; /* Prevent content overflow */
}

#savedCartsDropdown.hidden {
  display: none !important;
}

/* Temporarily disable sidebar overflow when dropdown is open */
.sidebar.dropdown-open {
  overflow: visible !important;
}

#savedCartsDropdown #savedCartsList {
  max-height: 300px;
  overflow-y: auto;
  min-height: 0; /* Ensure flexbox works properly */
}

/* Custom scrollbar for the saved carts list */
#savedCartsDropdown #savedCartsList::-webkit-scrollbar {
  width: 4px;
}

#savedCartsDropdown #savedCartsList::-webkit-scrollbar-track {
  background: #374151;
}

#savedCartsDropdown #savedCartsList::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 2px;
}

#savedCartsDropdown #savedCartsList::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Ensure the dropdown stays within viewport on mobile */
@media (max-width: 640px) {
  #savedCartsDropdown {
    width: calc(100vw - 3rem);
    max-width: 220px;
  }
}

/* =========================================================================
   Filter modal (adv-modal) + date-group headers + header login button.
   Moved out of theme-bildbyran2/templates/header.inc's inline <style> so
   these rules ship in the cacheable CSS file instead of every HTML response.
   ========================================================================= */
#imageGrid .date-head{display:flex !important;align-items:center !important;gap:14px !important;padding:18px 4px 8px !important}
#imageGrid .date-head::before,#imageGrid .date-head::after{content:"";flex:1 1 0;height:1px;background:#e5e7eb;display:block}
#imageGrid .date-head > span{flex:0 0 auto;white-space:nowrap}
#imageGrid .date-head hr{display:none !important}
#imageGrid > div:empty{display:none !important}

.bb-header-login-btn{display:inline-flex;align-items:center;gap:8px;padding:14px 22px;border:1.5px solid #fff;border-radius:999px;background:#C6007C;color:#fff;font-size:14px;font-weight:500;line-height:1;transition:background-color .14s,border-color .14s;text-decoration:none}
.bb-header-login-btn .icon{fill:currentColor;color:#fff}
.bb-header-login-btn:hover{background:#a00068;border-color:#fff;color:#fff}
.bb-header-login-btn:hover .icon{color:#fff}

#filterOverlay.adv-backdrop{position:fixed;inset:0;z-index:100;background:rgba(0,0,0,0.32);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);opacity:0;pointer-events:none;transition:opacity .18s ease;display:block}
#filterOverlay.adv-backdrop.open{opacity:1;pointer-events:auto}
#filterPanel.adv-modal{position:fixed;top:200px;left:50%;transform:translate(-50%,-6px) scale(.98);width:min(640px,calc(100vw - 32px));background:#fff;border-radius:16px;box-shadow:0 24px 56px rgba(0,0,0,0.18),0 2px 8px rgba(0,0,0,0.08);z-index:120;opacity:0;pointer-events:none;transition:opacity .18s ease, transform .2s cubic-bezier(.2,.8,.3,1);padding:20px 22px 18px;font-family:inherit;max-height:calc(100vh - 24px);overflow-y:auto;overflow-x:hidden;box-sizing:border-box}
#filterPanel.adv-modal.open{opacity:1;pointer-events:auto;transform:translate(-50%,0) scale(1)}
#filterPanel.adv-modal h3{font-size:15px;font-weight:700;color:#0b0b0f;margin:0 0 10px;letter-spacing:-0.005em}
.adv-help-btn{position:absolute;top:14px;right:14px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;border-radius:9999px;border:none;background:#f1f1f4;color:#4b5563;font-size:14px;font-weight:700;cursor:pointer;line-height:1;transition:background .12s ease;font-family:inherit}
.adv-help-btn:hover{background:#e2e2e7;color:#1f2937}
.searchhelp-content{padding:1.25rem;color:#fff;overflow-y:auto;height:100%}
.searchhelp-content h2{font-size:18px;font-weight:600;margin:0 0 12px;color:#fff}
.searchhelp-content h3{font-size:11px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:#9ca3af;margin:18px 0 8px}
.searchhelp-content table{width:100%;border-collapse:collapse;font-size:13px;color:#e5e7eb}
.searchhelp-content th{text-align:left;padding:6px 10px 6px 0;font-weight:600;color:#9ca3af;font-size:11px;text-transform:uppercase;letter-spacing:.06em;border-bottom:1px solid #374151}
.searchhelp-content td{padding:7px 10px 7px 0;vertical-align:top;border-bottom:1px solid #1f2937}
.searchhelp-content td:first-child{color:#e5e7eb;font-family:ui-monospace,Menlo,monospace;font-size:12px;white-space:nowrap;width:38%}
.searchhelp-content .sh-close{position:absolute;top:14px;right:14px;background:transparent;border:none;color:#9ca3af;cursor:pointer;padding:6px}
.searchhelp-content .sh-close:hover{color:#fff}
.adv-chipsrow{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.adv-chip{display:inline-flex;align-items:center;gap:8px;padding:5px 8px 5px 12px;border-radius:5px;background:#9b5cff;color:#fff;font-size:12.5px;font-weight:500;line-height:1.3;letter-spacing:.005em;max-width:100%;overflow-wrap:anywhere}
.adv-chip > .x{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;border-radius:3px;background:rgba(255,255,255,0.18);cursor:pointer;font-size:10px;line-height:1}
.adv-chip > .x:hover{background:rgba(255,255,255,0.28)}
.fm-chip-empty{font-size:12.5px;color:#9ca3af;padding:5px 0}
.adv-div{height:1px;background:#eaeaea;margin:14px -22px 16px}
.adv-label{font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:#6b7280;margin:0 0 8px}
.adv-section{margin-bottom:16px}
.adv-pills{display:flex;flex-wrap:wrap;gap:8px}
.adv-pill{padding:6px 12px;border-radius:9999px;border:1px solid transparent;background:#f1f1f4;color:#1f2937;font-size:11.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;cursor:pointer;line-height:1;transition:all .12s ease;font-family:inherit}
.adv-pill:hover{background:#e7e7ec}
.adv-pill.on{background:#0b0b0f;color:#fff;border-color:#0b0b0f}
.adv-pill.on:hover{background:#0b0b0f}
.adv-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.adv-field label{display:block;font-size:10.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:#6b7280;margin:0 0 6px}
.adv-input{width:100%;height:34px;padding:0 10px;font-size:13px;border:1px solid #d7d7dc;border-radius:6px;background:#fff;color:#0b0b0f;outline:none;transition:border-color .12s,box-shadow .12s;font-family:inherit;box-sizing:border-box}
.adv-input:focus{border-color:#9b5cff;box-shadow:0 0 0 3px rgba(155,92,255,0.15)}
.adv-toggle-row{display:inline-flex;align-items:center;gap:10px;margin-right:18px;cursor:pointer;user-select:none}
.adv-sr{position:absolute;opacity:0;width:0;height:0;pointer-events:none}
.adv-switch{position:relative;width:34px;height:20px;border-radius:9999px;background:#d1d5db;transition:background .15s ease;flex-shrink:0;display:inline-block}
.adv-switch::after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:9999px;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,0.15);transition:left .15s ease}
input:checked + .adv-switch{background:#22c55e}
input:checked + .adv-switch::after{left:16px}
.adv-toggle-row .lbl{font-size:13px;color:#1f2937}
.adv-toggles{display:flex;flex-wrap:wrap;gap:4px 0}
.adv-expander{display:inline-flex;align-items:center;gap:6px;background:none;border:none;padding:0;cursor:pointer;font-size:11.5px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:#0b0b0f;font-family:inherit}
.adv-expander svg{transition:transform .18s ease}
#filterPanel.adv-expanded .adv-expander svg{transform:rotate(180deg)}
.adv-extra{display:none;margin-top:4px}
#filterPanel.adv-expanded .adv-extra{display:block}
.adv-expander .lbl-more{display:inline}
.adv-expander .lbl-less{display:none}
#filterPanel.adv-expanded .adv-expander .lbl-more{display:none}
#filterPanel.adv-expanded .adv-expander .lbl-less{display:inline}
.adv-foot{display:flex;align-items:center;justify-content:flex-end;gap:16px;margin-top:8px}
.adv-clear{background:none;border:none;font-size:13px;color:#6b7280;cursor:pointer;padding:6px 4px;font-family:inherit}
.adv-clear:hover{color:#0b0b0f}
.adv-submit{background:#c6007c;color:#fff;border:none;border-radius:9999px;padding:9px 32px;font-size:13px;font-weight:600;letter-spacing:.01em;cursor:pointer;box-shadow:0 2px 6px rgba(198,0,124,0.28);transition:background .12s;font-family:inherit}
.adv-submit:hover{background:#a80068}
#filterToggleHero.adv-active,#filterToggleSearchBar.adv-active{background:#f4ecff !important}
#filterToggleHero.adv-active svg,#filterToggleSearchBar.adv-active svg{color:#7a43e6 !important}
body.adv-open form:has(input[name="search"]){position:relative;z-index:110}
@media (max-width:640px){
  #filterPanel.adv-modal{top:auto !important;bottom:0;left:0 !important;right:0;transform:translateY(100%);width:100%;max-width:none;border-radius:16px 16px 0 0;max-height:75vh;max-height:75dvh;padding:16px 16px 0;display:flex;flex-direction:column;transition:transform .2s ease, max-height .22s ease, border-radius .22s ease}
  #filterPanel.adv-modal.open{transform:translateY(0)}
  #filterPanel.adv-modal.adv-expanded{max-height:100vh;max-height:100dvh;border-radius:0}
  #filterPanel.adv-modal .adv-foot{position:sticky;bottom:0;z-index:1;background:#fff;margin:8px -16px 0;padding:12px 16px calc(14px + env(safe-area-inset-bottom, 0px));box-shadow:0 -1px 0 #eaeaea;flex-wrap:wrap;gap:8px 12px}
  .adv-div{margin-left:-16px;margin-right:-16px}
  .adv-grid{grid-template-columns:1fr}
}
/* Stack the date Från/Till grid on tablets too — native iOS date inputs are
   ~300px wide, so 1fr 1fr collides on iPad Pro portrait. */
@media (max-width:900px) and (min-width:641px){
  .adv-grid{grid-template-columns:1fr}
}
