/* Organizations Page Styles - Minimal Custom CSS */

/* Lock minimum page width for Organizations page */
body {
  min-width: 400px;
  overflow-x: hidden; /* clip content under 400px instead of scrolling */
}

/* Organization card styling - matches event card patterns */
.org-card {
  border-radius: 18px;
  border: 1px solid var(--dark-green);
  box-shadow: 0 4px 6px rgba(0,0,0,0.07);
  transition: background-color 0.1s ease;
  background: white;
  overflow: hidden;
  min-width: 400px;
}

.org-card:hover {
  background-color: rgba(122, 145, 122, 0.05);
}

.org-card.org-card--alt {
  border-color: var(--light-green);
}

/* Logo container - fixed width, flexible height */
.org-logo-container {
  width: 200px;
  min-height: 200px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  background: white;
  border-right: 1px solid var(--dark-green);
  align-self: stretch;
}

.org-card.org-card--alt .org-logo-container {
  border-right-color: var(--light-green);
}

.org-logo-container img {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  width: auto;
  height: auto;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  object-fit: contain;
  object-position: center;
  margin: auto;
}

/* Logo placeholder for organizations without logos */
.org-logo-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--beige);
  font-family: 'Calistoga', cursive;
  font-size: 2rem;
  font-weight: bold;
  color: var(--dark-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile layout - consistent horizontal layout */
@media (max-width: 991.98px) {
  .org-logo-container.mobile-logo {
    width: 120px;
    min-height: 120px;
    flex-shrink: 0;
    border-right: 1px solid var(--dark-green);
  }

  .org-card.org-card--alt .org-logo-container.mobile-logo {
    border-right-color: var(--light-green);
  }
}



/* Organization links styling */
.org-links .btn {
  font-family: 'Calistoga', cursive;
  font-size: 0.875rem;
}

/* Categories/badges styling */
.org-categories .badge {
  background-color: var(--light-green) !important;
  color: var(--beige);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
}

.org-card.org-card--alt .org-categories .badge {
  background-color: var(--dark-green) !important;
}

/* Ensure consistent spacing and typography */
.org-card h2 {
  color: var(--dark-green);
  font-family: 'Calistoga', cursive;
  font-weight: 400;
}

.org-card p {
  color: var(--text-dark);
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
}

/* Organizations list container */
.organizations-list {
  max-width: 1200px;
  margin: 0 auto;
  min-width: 400px;
}

/* Listing note banner */
.org-listing-note {
  background: var(--beige, #f9f5e3);
  border: 1px solid var(--dark-green, #4d614d);
  border-radius: 0.375rem;
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--dark-green, #4d614d);
  font-family: 'Calistoga', 'Inter', sans-serif;
  font-size: 1.1rem;
}

.org-listing-note a {
  color: var(--dark-green, #4d614d);
  font-weight: 600;
  text-decoration: underline;
}

/* Organization navigation - custom full-width wrapping layout */
.org-nav {
  margin-bottom: 2rem;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  min-width: 400px;
}

.org-nav .action-buttons-container {
  display: flex;
  justify-content: center;
}

#org-badge-nav {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  border-radius: 0.375rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#org-badge-nav .btn {
  flex: 1 1 auto;
  min-width: 0;
  width: calc(100% / 6); /* Force 6 buttons per row for even distribution */
  border-radius: 0 !important;
  white-space: nowrap;
  position: relative;
  margin-left: 0 !important; /* Override Bootstrap's negative margin */
  /* Keep all borders by default */
}

/* Remove right border from buttons that aren't last in their row to avoid double borders */
#org-badge-nav .btn:not(:nth-child(6n)):not(:last-child) {
  border-right-width: 0;
}

/* Remove bottom border from first row buttons to avoid double borders */
#org-badge-nav .btn:nth-child(-n+6) {
  border-bottom-width: 0;
}

/* Responsive: Switch to 4 buttons per row below 970px */
@media (max-width: 969px) {
  #org-badge-nav .btn {
    width: calc(100% / 4); /* 4 buttons per row */
  }

  /* Reset 6-per-row rules */
  #org-badge-nav .btn:nth-child(6n) {
    border-right-width: 0;
  }
  #org-badge-nav .btn:nth-child(6) {
    border-top-right-radius: 0 !important;
  }
  #org-badge-nav .btn:nth-child(7) {
    border-bottom-left-radius: 0 !important;
  }
  #org-badge-nav .btn:nth-child(-n+6) {
    border-bottom-width: 1px; /* Restore for middle row */
  }

  /* Override the default right border removal for 4-per-row layout */
  #org-badge-nav .btn:not(:nth-child(4n)):not(:last-child) {
    border-right-width: 0;
  }

  /* Apply 4-per-row rules - ensure last button in each row gets right border */
  #org-badge-nav .btn:nth-child(4n) {
    border-right-width: 1px !important; /* Force right border with !important */
  }

  /* Top row corners (first 4 buttons) - only button 4 gets top-right corner */
  #org-badge-nav .btn:nth-child(4) {
    border-top-right-radius: 0.375rem !important;
  }

  /* Force ALL corners to be square for interior buttons */
  #org-badge-nav .btn:nth-child(6),
  #org-badge-nav .btn:nth-child(7) {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }

  /* Bottom row corners - only button 9 gets bottom-left, last button gets bottom-right */
  #org-badge-nav .btn:nth-child(9) {
    border-bottom-left-radius: 0.375rem !important;
  }

  /* Remove bottom border from first two rows to avoid double borders */
  #org-badge-nav .btn:nth-child(-n+8) {
    border-bottom-width: 0;
  }

  /* Special handling for single row case with 4-per-row */
  #org-badge-nav .btn:first-child:nth-last-child(-n+4) {
    border-bottom-left-radius: 0.375rem !important;
  }
  #org-badge-nav .btn:last-child:nth-child(-n+4) {
    border-bottom-right-radius: 0.375rem !important;
  }
}

/* Top row corners */
#org-badge-nav .btn:first-child {
  border-top-left-radius: 0.375rem !important;
}

#org-badge-nav .btn:nth-child(6) {
  border-top-right-radius: 0.375rem !important;
}

/* Bottom row corners - only for the actual last row */
#org-badge-nav .btn:nth-child(7) {
  border-bottom-left-radius: 0.375rem !important;
}

#org-badge-nav .btn:last-child {
  border-bottom-right-radius: 0.375rem !important;
}

/* Special case: if only one row (6 or fewer buttons total) */
#org-badge-nav .btn:first-child:nth-last-child(-n+6) {
  border-top-left-radius: 0.375rem !important;
  border-bottom-left-radius: 0.375rem !important;
}

#org-badge-nav .btn:last-child:nth-child(-n+6) {
  border-top-right-radius: 0.375rem !important;
  border-bottom-right-radius: 0.375rem !important;
}

/* Remove incorrect bottom-left radius from 6th button */
#org-badge-nav .btn:nth-child(6) {
  border-bottom-left-radius: 0 !important;
}

/* Hidden class for filtering */
.org-card.hidden {
  display: none !important;
}

/* Organization links styling - connected button group like filter bar */
.org-links {
  display: flex;
  gap: 0 !important; /* Override gap-2 to connect buttons */
}

.org-links .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  width: 40px;
  height: 40px;
  border-radius: 0;
  border-right-width: 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* First button - left rounded corners */
.org-links .btn:first-child {
  border-top-left-radius: 0.375rem;
  border-bottom-left-radius: 0.375rem;
}

/* Last button - right rounded corners and restore right border */
.org-links .btn:last-child {
  border-top-right-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  border-right-width: 1px;
}

.org-links .btn svg {
  fill: currentColor;
}

.org-links .btn:hover {
  z-index: 2;
  border-right-width: 1px; /* Restore border on hover */
}