* {
  font-family: Arial, sans-serif;
}


/* General styling */
input,textarea,select {
  border: 1px solid #ccc;
  padding: 8px;
  border-radius: 2px;
  font-size: 16px;
}

label {
  display: block;
  margin-bottom: 2px;
}

button {
  padding: 8px;
}

/* Modal styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

#editModal {
  z-index: 1000;
}

#orangutanSearchModal {
  z-index: 1100;
}

#zooSearchModal {
  z-index: 1100;
}

#countrySearchModal {
  z-index: 1100;
}

.modal-content {
  background-color: #fefefe;
  padding: 20px;
  border: 1px solid #888;
  width: 500px;
  text-align: left;
}

.close {
  float: right;
  font-size: 20px;
  cursor: pointer;
}

/* Validation */
button:disabled {
  background-color: #ddd;
  cursor: not-allowed;
  border-radius: 2px;
}


/* Dropdown Search */
.dropdown-container {
  align-items: center;
  gap: 8px;
  position: relative;
  width: 450px;
  margin-bottom: 17px;
}

.dropdown-header {
  display: flex;
  width: 300px;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccc;
  padding: 8px;
  background-color: #f9f9f9;
}

.dropdown-toggle {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

.clear-button {
  background: none;
  border: none;
  color: #6f99c6;
  cursor: pointer;
  font-size: 14px;
}

.entity-submit-button {
  display: block;
  margin-top: 15px;
}

.clear-button:hover {
  text-decoration: underline;
}

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: #fff;
  border: 1px solid #ccc;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.dropdown.show {
  display: block;
}

.dropdown-search {
  width: 100%;
  padding-left: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
  font-size: 16px;
  height: auto;
  border: none;
  border-bottom: 2px solid #ccc;
  box-sizing: border-box;
  outline: none;
}

.item-main {
  flex-shrink: 0;
  display: table-cell;
  min-width: 290px; 
  padding: 15px;
}

.dropdown-items {
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: #cccccc #f5f5f5;
  max-height: calc(18.15em);
  overflow-x: hidden; 
  display: block;
  width: 100%;
  border-collapse: collapse;
}

.item-additional {
  flex-grow: 1;
  font-size: 0.9em;
  text-align: right; 
  white-space: nowrap;
  color: #838383;
  display: table-cell;
  width: 20px;
  text-align: right; 
  padding-left: 0px;
  padding-right: 15px;
  padding-top: 15px;
  padding-bottom: 15px;
  white-space: nowrap;
  max-height: calc(5 * 2.5em);
  overflow-y: auto;
}

.dropdown-item.selected .item-additional {
  color: white;
}

.dropdown-items::-webkit-scrollbar {
  width: 6px;
}

.dropdown-items::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.dropdown-items::-webkit-scrollbar-thumb {
  background-color: #cccccc;
  border-radius: 10px;
  border: 1px solid #f5f5f5;
}

.dropdown-items::-webkit-scrollbar-thumb:hover {
  background-color: #aaaaaa;
}

.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  display: table-row;
}

.dropdown-item:hover {
  background-color: #ffc38c;
}

.dropdown-item.selected {
  background-color: #bd722b;
  color: white;
}

/* Validation */
.highlight-missing {
  border-color: red !important;
  box-shadow: 0 0 2px red;
}

fieldset {
  margin-bottom: 15px;
}

/* Add Entity Form (Collapsible) */
fieldset {
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
}

.toggle-icon[aria-expanded="true"] {
  transform: rotate(90deg);
}

.form-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  padding: 0;
}

.collapsible-form.expanded .form-content {
  max-height: none;
  padding: 10px 0;
  overflow: visible;
}

.form-legend {
  display: flex;
  align-items: center;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1.5;
}

.toggle-icon {
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-right: 10px;
  transition: transform 0.2s ease, background-color 0.2s ease;
  line-height: 0;
  color: #6c757d;
}

.toggle-icon:hover {
  background-color: #e0e0e0;
}

/* Profile Pic Upload */
.profile-image-container {
  position: relative;
  width: 192px;
  height: 192px;
  margin-bottom: 20px;
  margin-left: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-image {
  width: 192px;
  height: 192px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.profile-image-container:hover .profile-image {
  transform: scale(1.05);
}

.upload-form {
  position: relative;
  width: 100%;
  height: 100%;
}

.upload-label {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.upload-input {
  display: none;
}

/* Delete Profile Pic Button */
.delete-profile-pic-button {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
  transition: all 0.2s ease;
  top: 5px;
  right: 5px;
}

.delete-profile-pic-button:hover {
  background: rgba(220, 53, 69, 1);
  transform: scale(1.1);
}

.profile-image-wrapper:hover .delete-profile-pic-button {
  display: flex;
}

/* Upload Hover Text */
.upload-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
  display: none;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.profile-image-container:hover .upload-text {
  display: block;
}

.profile-image-container:hover .delete-form:hover ~ .upload-text {
  display: none;
}

/* New Profile Page Layout */
.profile-page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0px;
  box-sizing: border-box;
  /* Account for: title-header (~80px) + nav (~50px) + secondary header (~40px) + padding */
  height: calc(100vh - 185px);
  overflow: hidden;
}

.profile-title {
  margin: 0 0 4px 0;
  font-size: 24px;
  color: var(--primary-base);
  font-weight: 600;
}

.profile-grid-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  grid-template-rows: auto auto;
  gap: 0px 10px;
  height: auto;
  grid-template-areas: 
    "sidebar timeline"
    "sidebar family";
  transform-origin: top center;
}

/* Scale down at higher zoom levels */
@media (min-resolution: 1.25dppx) {
  .profile-grid-layout {
    transform: scale(0.95);
  }
}

@media (min-resolution: 1.5dppx) {
  .profile-grid-layout {
    transform: scale(0.9);
  }
}

@media (min-resolution: 2dppx) {
  .profile-grid-layout {
    transform: scale(0.85);
  }
}

.profile-widget {
  background: white;
  border: 1px solid #e8e9ea;
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s ease;
}

.profile-widget:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.widget-title {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-base);
  border-bottom: 1px solid #e8e9ea;
  padding-bottom: 6px;
  flex-shrink: 0;
}

.timeline-widget .widget-title {
  text-align: right;
}

/* Details Panel with HTML Table */
.details-panel {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 6px;
  margin-top: 0px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e9ecef;
}

.details-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
}

.details-table tr:last-child td {
  border-bottom: none;
}

.details-table .detail-label {
  font-weight: 600;
  color: #5a6c7d;
  font-size: 14px;
  width: 40%;
  background: #f8f9fa;
}

.details-table .detail-value {
  color: #2c3e50;
  font-size: 14px;
  font-weight: 500;
  background: white;
}

.zoo-link {
  color: var(--primary-base);
  text-decoration: none;
  font-weight: 600;
}

.zoo-link:hover {
  text-decoration: underline;
}

.floating-details-panel .detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.floating-details-panel .detail-label {
  font-weight: 600;
  color: #5a6c7d;
  margin-right: 8px;
}

.floating-details-panel .detail-value {
  color: #2c3e50;
  text-align: right;
  flex: 1;
}

/* Large Profile Image */
.profile-image-large {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid #f0f2f4;
  transition: border-color 0.2s ease;
}

.profile-image-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
}

/* Sidebar Widget - Full Height */
.profile-sidebar {
  grid-area: sidebar;
  background: #f0f2f5;
  border: 2px solid #d0d3d8;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  overflow: hidden;
}

/* Image + Details Row */

/* Remove old profile-image-container styles */

.profile-image-wrapper {
  position: relative;
  width: 185px;
  height: 185px;
  flex-shrink: 0;
  margin-left: 20px;
}

.profile-image-square {
  width: 185px;
  height: 185px;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid #f0f2f4;
  transition: border-color 0.2s ease;
}


.detail-item {
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Map */
.sidebar-map-container {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  padding-bottom: 20px;
}

.sidebar-map {
  height: 120px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e8e9ea;
}

.sidebar-map {
  flex: 1;
  min-height: 180px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e8e9ea;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-image {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-base);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.profile-name-details {
  flex: 1;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary-base);
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.profile-details-table {
  flex: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid #f1f3f4;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 500;
  color: #5a6c7d;
  font-size: 11px;
}

.detail-value {
  font-size: 11px;
  text-align: right;
  font-weight: 500;
  color: #2c3e50;
}

.widget-admin-controls {
  margin-top: auto;
  text-align: left;
  padding: 12px;
}

.action-button.compact {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 4px;
  background: var(--primary-base);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.action-button.compact:hover {
  background: var(--primary-600);
}

/* Widget 2: Family Tree */
.family-tree-widget {
  grid-area: family;
  text-align: center;
  display: flex;
  flex-direction: column;
  background: white;
  max-height: 300px;
  border: 1px solid #e8e9ea;
  border-radius: 8px;
  padding: 6px;
  overflow: visible;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  margin-top: 120px;
}

#family-tree-container {
  display: block;
  width: 400px;
  height: 300px;
  margin: 8px auto;
  background: #f0f2f5 !important;
  border: 2px solid #d0d3d8 !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  position: relative;
}

.family-tree-loading {
  color: #5a6c7d;
  font-style: italic;
}


.family-tree-error {
  color: #dc3545;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Family Tree SVG Styles */
.family-tree-node {
  transition: all 0.2s ease;
}

.family-tree-node:hover {
  filter: brightness(1.1);
  transform: scale(1.1);
}

.node-circle {
  transition: all 0.2s ease;
}

.node-label {
  font-size: 11px;
  fill: #333;
  font-weight: 500;
  pointer-events: none;
}

/* Family Tree Tooltip */
.family-tree-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  z-index: 1000;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
}

.family-tree-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

/* Bottom Area - Split Timeline and Map */
.bottom-area {
  grid-area: bottom;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

/* Widget 3: Timeline (70% width) */
.timeline-widget {
  grid-area: timeline;
  background: #f0f2f5;
  border: 2px solid #d0d3d8;
  border-radius: 12px;
  padding: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-top: 0px;
  margin-bottom: -120px;
  min-height: 225px;
}

.map-widget {
  grid-area: map;
  background: white;
  border: 1px solid #e8e9ea;
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.map-widget {
  grid-area: map;
  background: white;
  border: 1px solid #e8e9ea;
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.profile-map-panel {
  flex-grow: 1;
  min-height: 200px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.profile-map-panel:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.small-map-container {
  flex-grow: 1;
  border-radius: 4px;
  background: #f8f9fa;
  border: 1px solid #e8e9ea;
  cursor: pointer;
  transition: border-color 0.2s ease;
  min-height: 120px;
}

.small-map-container:hover {
  border-color: var(--primary-base);
}

.map-info {
  margin-top: 4px;
  text-align: center;
  display: block;
}

.zoo-name-link {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-base);
  text-decoration: none;
  transition: color 0.2s ease;
}

.zoo-name-link:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

.no-location {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a6c7d;
  font-style: italic;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #e8e9ea;
  font-size: 10px;
}

.timeline-controls {
  margin-bottom: 4px;
  text-align: center;
}

#timeline-container {
  flex-grow: 1;
  overflow: hidden;
  position: relative;
  min-height: 120px;
  background: #fafbfc;
  border: 1px solid #f0f2f4;
  border-radius: 4px;
}

.timeline-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #5a6c7d;
  font-style: italic;
  font-size: 10px;
}

.timeline-empty, .timeline-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #5a6c7d;
  font-style: italic;
  font-size: 10px;
}

.timeline-error {
  color: #dc3545;
}

/* Timeline Content */
.timeline-content {
  height: 100%;
  position: relative;
  padding: 20px 0;
  overflow: visible;
}

.timeline-track {
  position: absolute;
  top: 20%;
  left: 5%;
  right: 5%;
  height: 3px;
  background: linear-gradient(to right, #e0e0e0, #bbb, #e0e0e0);
  border-radius: 2px;
  transform: translateY(-50%);
}

.timeline-marker {
  position: absolute;
  top: 20%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 10;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.timeline-dot:hover {
  transform: scale(1.3);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Event Type Colors */
.timeline-dot.event-birth {
  background: #28a745;
}

.timeline-dot.event-death {
  background: #dc3545;
}

.timeline-dot.event-transfer-in {
  background: #007bff;
}

.timeline-dot.event-transfer-out {
  background: #fd7e14;
}

.timeline-dot.event-lost {
  background: #ffc107;
}

.timeline-dot.event-other {
  background: #6c757d;
}

/* Timeline Detail Boxes for Major Events */
.timeline-detail-box {
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: #f8f9fa;
  border: 2px solid #6c757d;
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-width: 140px;
  max-width: none;
  width: max-content;
  pointer-events: none;
  z-index: 9999;
  font-size: 11px;
  overflow: visible;
}

.timeline-detail-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #6c757d;
}

/* Speech bubble tail pointing down (for boxes above line) */
.timeline-detail-box.above::after {
  top: 100%;
  border-top-color: #6c757d;
  border-bottom: none;
}

/* Speech bubble tail pointing up (for boxes below line) */
.timeline-detail-box.below::after {
  top: -16px;
  border-top: none;
  border-bottom-color: #6c757d;
}

.detail-box-main {
  font-weight: 600;
  color: #333;
  margin-bottom: 3px;
  font-size: 11px;
  line-height: 1.3;
}

.detail-box-date {
  color: #666;
  font-size: 9px;
  margin-bottom: 3px;
}

.detail-box-details {
  color: #666;
  font-style: italic;
  font-size: 9px;
  line-height: 1.2;
  margin-top: 2px;
}

/* Timeline Today Line */
.timeline-today-line {
  position: absolute;
  top: 10%;
  bottom: 70%;
  width: 2px;
  background: #dc3545;
  z-index: 25;
  transform: translateX(-50%);
}

.timeline-today-label {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: #dc3545;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

/* Timeline Popup */
.timeline-popup {
  position: absolute;
  bottom: 25px;
  left: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 180px;
  max-width: 250px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 100;
  font-size: 12px;
}

.timeline-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.timeline-popup.pinned {
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

.timeline-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: white;
}

.timeline-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 8px;
}

.timeline-popup-header strong {
  color: #333;
  font-size: 13px;
}

.timeline-popup-date {
  color: #666;
  font-size: 11px;
  white-space: nowrap;
}

.timeline-popup-zoo {
  color: #555;
  margin-bottom: 4px;
  font-size: 11px;
}

.timeline-popup-details {
  color: #666;
  font-style: italic;
  margin-bottom: 6px;
  font-size: 11px;
  line-height: 1.3;
}

.timeline-popup-actions {
  text-align: center;
  padding-top: 6px;
  border-top: 1px solid #eee;
}

.timeline-edit-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  cursor: pointer;
}

.timeline-edit-btn:hover {
  background: #0056b3;
}

/* Timeline Labels */
.timeline-labels {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
}

.timeline-label {
  position: absolute;
  font-size: 10px;
  color: #666;
  font-weight: 500;
}

.timeline-label.start {
  left: 0;
}

.timeline-label.end {
  right: 0;
}

.timeline-label.center {
  left: 50%;
  transform: translateX(-50%);
}

/* Second layer of timeline labels */
.timeline-label.layer-2 {
  top: 20px;
}

/* Map Modal Styles */
.map-modal {
  display: flex;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
}

.map-modal-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  height: 90%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
}

.map-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
}

.map-modal-header h3 {
  margin: 0;
  color: #333;
}

.map-modal-close {
  font-size: 24px;
  cursor: pointer;
  color: #666;
  font-weight: bold;
}

.map-modal-close:hover {
  color: #000;
}

.map-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
  font-style: italic;
  background: #f8f9fa;
  border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .profile-grid-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: 
      "profile family"
      "map timeline";
  }
  
  .profile-details-widget {
    grid-area: profile;
  }
}

@media (max-width: 768px) {
  .profile-page-container {
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 10px;
  }
  
  .profile-grid-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    grid-template-areas: 
      "sidebar"
      "timeline"
      "family";
    gap: 10px;
  }
  
  .profile-sidebar {
    grid-row: auto; /* Reset spanning for mobile */
  }
  
  .timeline-widget {
    margin-top: 0;
    margin-bottom: 0; /* Reset negative margins for mobile */
    min-height: 400px; /* Make timeline much taller for mobile */
  }
  
  .family-tree-widget {
    margin-top: 0; /* Reset margin for mobile */
  }
  
  #family-tree-container {
    width: 100%;
    max-width: 350px;
    margin: 10px auto;
  }
  
  /* Mobile table responsiveness */
  table {
    width: 100%;
    table-layout: fixed;
    word-wrap: break-word;
  }
  
  .data-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .data-table table {
    min-width: 100%;
    font-size: 0.8em;
  }
  
  .data-table th,
  .data-table td {
    padding: 4px 2px;
    font-size: 0.8em;
  }
  
  .display-table {
    font-size: 0.8em;
  }
  
  .display-table th,
  .display-table td {
    padding: 4px 2px;
    font-size: 0.8em;
  }
  
  .profile-widget {
    min-height: 200px;
  }
  
  .profile-image {
    width: 80px;
    height: 80px;
  }
}

/* Zoo Profile Styling - SCOPED TO ZOO PAGES ONLY */
.zoo-profile-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0px 10px;
}

.zoo-header {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 6px;
  margin: 0 0 3px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


.zoo-info-grid {
  display: grid;
  grid-template-columns: 1fr 600px;
  gap: 15px;
  align-items: start;
}

.zoo-left h1 {
  margin: 0 0 4px 0;
  color: #2c3e50;
  font-size: 1.4em;
  padding: 0;
}

.zoo-address {
  color: #6c757d;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.zoo-location {
  color: #495057;
  font-size: 0.9em;
  font-weight: 500;
}

.zoo-map {
  height: 250px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e8e9ea;
}

/* Two column layout for holdings */
.holdings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 5px;
}

/* Holdings Sections */
.holdings-section {
  background: rgba(97, 51, 1, 0.276);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.zoo-profile-container h2 {
  margin: 0 0 3px 0;
  color: #2c3e50;
  font-size: 1.1em;
}

.holdings-summary {
  color: #6c757d;
  margin-bottom: 8px;
  font-size: 0.9em;
}

.holdings-species-breakdown {
  color: #495057;
  margin-bottom: 8px;
  font-size: 0.85em;
}

/* Zoo Page Orangutan Cards */
.zoo-profile-container .orangutan-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.zoo-profile-container .orangutan-card {
  background: #ffffff;
  border: 1px solid rgba(97, 51, 1, 0.82);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.zoo-profile-container .orangutan-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  text-decoration: none;
}

.zoo-profile-container .orangutan-card-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e8e9ea;
  flex-shrink: 0;
}

.zoo-profile-container .orangutan-card-info {
  flex: 1;
  min-width: 0;
}

.zoo-profile-container .orangutan-card-name {
  font-size: 0.95em;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 2px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoo-profile-container .orangutan-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8em;
  color: #6c757d;
}

.zoo-profile-container .orangutan-card-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoo-profile-container .orangutan-card-detail span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapsible Holdings */
.cards-container {
  margin-top: 8px;
}

.cards-container.collapsed .orangutan-card:nth-child(n+7) {
  display: none;
}

.show-more-btn {
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  text-align: center;
  cursor: pointer;
  font-size: 0.9em;
  color: #495057;
  margin-top: 8px;
  transition: background-color 0.2s ease;
}

.show-more-btn:hover {
  background: #dee2e6;
}

.cards-container:not(.collapsed) .show-more-btn .show-text {
  display: none;
}

.cards-container.collapsed .show-more-btn .hide-text {
  display: none;
}

/* Zoo Profile Mobile Responsive */
@media (max-width: 768px) {
  .zoo-info-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .zoo-map {
    height: 150px;
  }
  
  .holdings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .zoo-profile-container .orangutan-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .zoo-profile-container .orangutan-card {
    padding: 12px;
  }
  
  .zoo-profile-container .orangutan-card-image {
    width: 50px;
    height: 50px;
  }
  
  .zoo-details {
    grid-template-columns: 1fr;
  }
  
  .zoo-profile-container {
    padding: 12px;
  }
  
  .holdings-section {
    padding: 16px;
  }
  
  .zoo-profile-container .cards-container.collapsed .orangutan-card:nth-child(n+4) {
    display: none;
  }
}
  
  .profile-title {
    font-size: 24px;
  }
  
  .map-modal-content {
    width: 95%;
    height: 95%;
  }
}

/* Contact Page Styling */
.contact-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
}

.contact-disclaimer {
  text-align: center;
  color: #495057;
  font-style: italic;
  margin-bottom: 20px;
  padding: 10px;
  background: rgba(97, 51, 1, 0.276);
  border-radius: 8px;
  border: 1px solid rgba(97, 51, 1, 0.82);
  width: 340px;
  margin: 0 auto 20px auto;
}

.contact-form {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(97, 51, 1, 0.82);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: 340px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9em;
}

.form-group input,
.form-group textarea {
  width: 300px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 16px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(97, 51, 1, 0.82);
}

.submit-btn {
  background: var(--primary-base);
  color: white;
  padding: 8px 20px;
  border: none;
  border-radius: 2px;
  font-size: 16px;
  cursor: pointer;
}

.submit-btn:hover {
  background: rgba(97, 51, 1, 0.8);
}

@media (max-width: 480px) {
  .profile-page-container {
    padding: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .profile-grid-layout {
    gap: 8px;
  }
  
  .profile-widget {
    padding: 12px;
    min-height: 150px;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal scrolling */
  }
  
  .timeline-widget {
    min-height: 400px; /* Extra tall for mobile timeline */
    font-size: 0.7em; /* Scale down font for mobile - 30% smaller */
  }
  
  .timeline-widget .timeline-svg text {
    font-size: 7px; /* Smaller text in timeline */
  }
  
  .timeline-widget foreignObject {
    font-size: 7px; /* Smaller labels */
  }
  
  .timeline-widget {
    overflow: visible !important;
  }
  
  .profile-title {
    font-size: 20px;
    margin-bottom: 8px;
  }
}

/* Legacy styles (keep for backwards compatibility) */
.orangutan-profile {
  display: flex;
  flex-direction: row;
  align-items: flex-start; 
  gap: 5px;
}

.orangutan-profile-details,
.family-tree {
  flex: 1;
  max-width: 25%;
}

.orangutan-profile-details {
  display: flex;
  flex-direction: column;
}

.orangutan-profile-table {
  margin-left: 10px;
  width: 80%;
  border-collapse: collapse;
}

.orangutan-profile-table td {
  padding: 5px;
  color: #333;
  font-size: 16px;
}

.family-tree {
  text-align: center;
}

.family-tree h2 {
  margin-left: 22px;
  font-size: 20px;
}
* {
  font-family: Arial, sans-serif;
}

/* Table styles */
.display-table{
  border-collapse: collapse;
  margin: 25px;
  font-size: 1em;
  min-width: auto;
  max-width: 100%;
  border-radius: 7px 7px 0 0;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.15);
}

.display-table thead tr{
  background-color: var(--primary-base);
  color: white;
  text-align: left;
  font-weight: bold;
}

.display-table tbody tr {
  border-bottom: 1px solid rgba(97, 51, 1, 1);
  text-align: left;
  padding: 2px;
}

.display-table th,
.display-table td{
  padding: 10px 15px;
}

.display-table tbody tr:nth-of-type(even)  {
  background-color: rgba(97, 51, 1, 0.276);
}

.display-table tbody tr:last-of-type  {
  border-bottom:  3px solid  rgba(97, 51, 1, 0.82);
}

.display-table tbody tr:nth-of-type(even):hover {
  background-color: rgba(144, 74, 0, 0.346);
}

.display-table tbody tr:nth-of-type(odd):hover {
  background-color: rgba(244, 220, 186, 0.62);
}

.display-table tbody tr a {
  color: #337ab7;
  transition: color 0.3s ease, transform 0.01s ease;
  display: inline-block;
}

.display-table tbody tr a:hover {
  color: #174c92;
  text-decoration: underline;
  transform: scale(1.04);
  overflow: visible;
}



/* navbar tabs*/
nav a, nav span{
  display: inline-block;
  padding: 10px 15px;
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

nav a.active, nav span.active{
  border-color: #333;
  background-color: #fff;
  font-weight: bold;
  color: #000;
  z-index: 1;
}

nav a.active:hover {
  background-color: #fff;
  color: #000;
}

.action-button {
  border: 1px solid;
  width: 35px;
  border-radius: 8px;
  border-color: #915220;
  color: #633810;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  cursor: pointer;
}

.action-button:hover {
  background-color: var(--primary-50);
}

.edit-button:hover {
  background-color: var(--primary-200);
}


.delete-button:hover {
  background-color: var(--primary-200);
}

button:focus {
  outline: 2px solid var(--primary-50);
}


.site-description {
  font-size: 18px;
  color: #333;
  margin: 20px auto;
  padding: 10px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  width: 80%;
}

.restore-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.restore-button-container form {
  margin: 10px;
  width: 300px;
}

.restore-button-container button {
  width: 100%;
  padding: 10px;
  background-color: #bd722b;
  border: none;
  border-radius: 5px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.restore-button-container button:disabled {
  background-color: #999;
  cursor: not-allowed;
}

/* Marquee */
.marquee-container {
  overflow: hidden;
  width: 100%;
  max-width: 80%;
  margin: 20px auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f9f9f9;
  padding: 0;
}

.marquee-content {
  display: inline-block;
  white-space: nowrap;
  animation: scroll-marquee linear infinite;
  animation-duration: 120s; 
}

.marquee-content img {
  display: inline-block;
  height: 200px;
  vertical-align: middle;
  border: none;
  margin: 0;
  padding: 0;
}

@keyframes scroll-marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Modern Header - High specificity to override any conflicts */
.title-header {
  background: linear-gradient(135deg, var(--primary-base) 0%, #8b5a2b 100%) !important;
  color: white !important;
  padding: 16px 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

/* Ensure old .title styles don't interfere */
header.title-header {
  background: linear-gradient(135deg, var(--primary-base) 0%, #8b5a2b 100%) !important;
  padding: 16px 0 !important;
}

.title-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.logo-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.site-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.site-logo:hover {
  transform: scale(1.05);
}

.title-container h1 {
  margin: 0;
  font-size: 2.5em;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-marquee {
  flex: 1;
  height: 50px;
  overflow: hidden;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.marquee-wrapper {
  width: 100%;
  overflow: hidden;
}

/* Landing Page Layout */
.landing-layout {
  height: calc(100vh - 200px); /* Account for header + nav + some margin */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  gap: 0;
  min-height: 0;
  position: relative;
}

.left-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-section {
  flex: 1;
  padding: 15px;
  padding-right: 10px;
  min-height: 0;
  transition: padding-right 0.3s ease;
}

.main-content.sidebar-collapsed .map-section {
  padding-right: 15px;
}

.map-main {
  height: 100% !important;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e0e0;
}

.map-description-section {
  flex-shrink: 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-top: 1px solid #dee2e6;
  padding: 12px 20px;
  margin-left: 20px;
  margin-right: 10px;
  margin-bottom: 15px;
  border-radius: 0 0 8px 8px;
}

.map-description {
  margin: 0;
  color: #495057;
  font-size: 13px;
  line-height: 1.4;
  max-width: none;
}

/* Sidebar Panel */
.sidebar-panel {
  width: 350px;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-left: 1px solid #e0e0e0;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-panel.collapsed {
  transform: translateX(100%);
}

.sidebar-toggle {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e0e0e0;
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #666;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--primary-base);
}

.sidebar-toggle i {
  transition: transform 0.3s ease;
}

.sidebar-panel.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

.panel-content {
  flex: 1;
  padding: 15px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Stats Section */
.stats-section {
  flex-shrink: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-item {
  text-align: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  border: 1px solid #f0f0f0;
}

.stat-number {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-base);
  line-height: 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  margin-top: 2px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.species-breakdown {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  border: 1px solid #f0f0f0;
}

.species-item {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  text-align: center;
  flex: 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.species-item span {
  font-weight: 700;
  color: #555;
}

/* Search Section */
.search-section {
  flex-shrink: 0;
}

.search-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}


.search-button {
  width: 100%;
  padding: 8px 16px;
  background: var(--primary-base);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background-color 0.2s ease;
}

.search-button:hover {
  background: #8b5a2b;
}

.advanced-search-link {
  display: block;
  text-align: center;
  font-size: 12px;
  color: #666;
  text-decoration: none;
  transition: color 0.2s ease;
}

.advanced-search-link:hover {
  color: var(--primary-base);
}

/* News Section */
.news-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.news-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
  flex-shrink: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.news-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  margin-bottom: 12px;
}

.news-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  border: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.news-item:hover {
  background: rgba(255, 255, 255, 0.9);
}

.news-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
  margin-top: 2px;
  flex-shrink: 0;
}

.news-icon.birth {
  color: #28a745;
}

.news-icon.death {
  color: #dc3545;
}

.news-icon.transfer {
  color: #007bff;
}

.news-content {
  flex: 1;
  min-width: 0;
}

.news-text {
  margin: 0 0 2px 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: #333;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.news-date {
  font-size: 11px;
  color: #888;
}

.view-all-news {
  flex-shrink: 0;
  display: block;
  text-align: center;
  font-size: 12px;
  color: #666;
  text-decoration: none;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
  transition: color 0.2s ease;
}

.view-all-news:hover {
  color: var(--primary-base);
}

/* Search Results Page - Compact Design */
.search-results-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px;
}

.search-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.search-header h1 {
  margin: 0 0 5px 0;
  color: var(--primary-base);
  font-size: 24px;
}

.search-summary {
  font-size: 13px;
  color: #666;
}

.search-form-section {
  margin-bottom: 20px;
}

.search-form-section .collapsible-form {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 0;
}

.search-form-section .form-legend {
  font-size: 16px;
  padding: 10px 15px;
  margin: 0;
  background: #f8f9fa;
  border-radius: 6px 6px 0 0;
}

.search-form-section .form-content {
  padding: 0 15px;
}

.search-form-section .collapsible-form.expanded .form-content {
  padding: 15px;
}

.search-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.filter-group label {
  font-size: 0.9em;
  font-weight: 500;
  color: #495057;
}

.filter-group input,
.filter-group .dropdown-header {
  height: 40px;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 16px;
  background-color: #fff;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Make hybrid dropdown consistent with filter form styling */
.filter-group .dropdown-container {
  width: 100%;
  margin-bottom: 0;
}

.filter-group .dropdown-toggle {
  font-size: 16px;
  background: none;
  border: none;
  text-align: left;
  flex-grow: 1;
}

.filter-group .clear-button {
  font-size: 0.8em;
}

/* Add extra spacing for specific labels that need more room */
.filter-group label[for="has_orangutans_filter"] {
  margin-bottom: 8px;
}

/* Make cities dropdown wider to accommodate city names and countries */
.filter-group .dropdown-container[data-name="city"] {
  min-width: 300px;
}

.filter-group .dropdown-container[data-name="city"] .dropdown-header {
  min-width: 300px;
}

.filter-group .dropdown-container[data-name="city"] .dropdown {
  min-width: 300px;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

.filter-actions button {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}

.filter-actions button:hover {
  background: #0056b3;
}

.clear-filters {
  color: #6c757d;
  text-decoration: none;
  font-size: 0.9em;
}

.clear-filters:hover {
  color: #495057;
  text-decoration: underline;
}

.filter-section {
  margin-bottom: 20px;
}

.filter-section details {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
}

.filter-section summary {
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 10px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 15px 0;
}

.filter-grid div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-grid label {
  font-weight: 500;
}

.filter-grid input,
.filter-grid select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.search-input-group .search-input {
  flex: 1;
  min-width: 250px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.advanced-search-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s ease;
}

.advanced-search-btn:hover {
  background: #5a6268;
}

.results-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.results-section {
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.results-section h2 {
  background: var(--primary-base);
  color: white;
  margin: 0;
  padding: 10px 15px;
  font-size: 16px;
  font-weight: 600;
}

.results-table-container {
  overflow-x: auto;
}

.results-table {
  margin: 0;
  box-shadow: none;
  border-radius: 0;
  font-size: 14px;
}

.results-table th {
  background: #f8f9fa;
  color: #333;
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  padding: 8px 12px;
  font-size: 13px;
}

.results-table td {
  padding: 6px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.results-table tbody tr:hover {
  background-color: #f8f9fa;
}

.status-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  display: inline-block;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
}

.status-badge.alive {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-badge.deceased {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-badge.unknown {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  color: #856404;
  border: 1px solid #ffeaa7;
}

.species-breakdown-mini {
  font-size: 11px;
  color: #666;
  line-height: 1.2;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.no-results h2 {
  color: #999;
  margin-bottom: 8px;
  font-size: 18px;
}

/* Compact table styling */
.results-table a {
  color: var(--primary-base);
  text-decoration: none;
  font-weight: 500;
}

.results-table a:hover {
  text-decoration: underline;
  color: #8b5a2b;
}

/* Sortable Table Styling */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.2s ease;
}

.sortable:hover {
  background-color: #e9ecef !important;
}

.sort-indicator {
  margin-left: 5px;
  font-size: 10px;
  color: #999;
}

.sortable.asc .sort-indicator::after {
  content: "▲";
  color: var(--primary-base);
}

.sortable.desc .sort-indicator::after {
  content: "▼";
  color: var(--primary-base);
}

.sortable:not(.asc):not(.desc) .sort-indicator::after {
  content: "▲▼";
  color: #ccc;
}

/* Two-column layout for results */
@media (min-width: 1200px) {
  .results-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch; /* Changed from start to stretch for equal height */
  }
  
  .results-section {
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  
  .results-table-container {
    flex: 1; /* Allow table container to fill available space */
  }
}

/* Advanced Search Modal - Compact */
.advanced-search-modal {
  max-width: 600px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 15px;
}

.modal-header h2 {
  margin: 0;
  color: var(--primary-base);
  font-size: 18px;
}

.advanced-search-sections {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.search-section {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  background: #f8f9fa;
}

.search-section h3 {
  margin: 0 0 10px 0;
  color: var(--primary-base);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 5px;
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 3px;
  color: #333;
  font-size: 12px;
}

.form-group input,
.form-group select {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-base);
  box-shadow: 0 0 0 1px rgba(189, 114, 43, 0.3);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
}

.clear-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.clear-btn:hover {
  background: #5a6268;
}

.search-btn {
  background: var(--primary-base);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.search-btn:hover {
  background: #8b5a2b;
}

/* Search Form Styling */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .title-container {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .logo-title-group {
    gap: 12px;
  }
  
  .site-logo {
    width: 50px;
    height: 50px;
  }
  
  .title-container h1 {
    font-size: 2em;
  }
  
  .header-marquee {
    width: 100%;
    max-width: 400px;
  }
  
  .main-content {
    flex-direction: column;
  }
  
  .left-column {
    height: 50vh;
    min-height: 300px;
    flex-shrink: 0;
  }
  
  .map-section {
    flex: 1;
    min-height: 250px;
    display: flex;
    flex-direction: column;
  }
  
  .map-main {
    flex: 1;
    min-height: 200px;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    visibility: visible !important;
  }
  
  .landing-layout {
    height: auto;
    min-height: calc(100vh - 200px);
    overflow: visible;
  }
  
  .map-section {
    flex: 1;
    padding: 15px;
    padding-right: 15px;
  }
  
  .map-description-section {
    margin: 0 15px 15px 15px;
    border-radius: 8px;
  }
  
  .sidebar-panel {
    width: 100%;
    height: 40vh;
    transform: none;
    border-left: none;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  }
  
  .sidebar-panel.collapsed {
    transform: translateY(100%);
  }
  
  .sidebar-toggle {
    left: 50%;
    top: -40px;
    transform: translateX(-50%);
    width: 60px;
    height: 36px;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    border-top: 1px solid #e0e0e0;
  }
  
  .sidebar-toggle i {
    transform: rotate(90deg);
  }
  
  .sidebar-panel.collapsed .sidebar-toggle i {
    transform: rotate(-90deg);
  }
  
  .panel-content {
    gap: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .species-breakdown {
    flex-direction: column;
    gap: 4px;
  }
  
  .species-item {
    text-align: left;
  }
}

/* Zoo Popup Styles */
.zoo-popup {
  font-size: 14px;
}

.zoo-popup h4 {
  margin: 0 0 8px 0;
  color: var(--primary-base);
  font-size: 16px;
}

.zoo-popup .zoo-location {
  margin: 0 0 8px 0;
  color: #666;
  font-size: 13px;
}

.zoo-popup .zoo-holdings {
  margin: 0 0 12px 0;
  font-size: 13px;
}

.zoo-popup .zoo-link {
  display: inline-block;
  color: var(--primary-base);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
}

.zoo-popup .zoo-link:hover {
  text-decoration: underline;
}

.zoo-info-popup {
  border-radius: 8px;
}

.zoo-info-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.12);
}

.zoo-info-popup .leaflet-popup-content {
  margin: 12px;
}

/* Custom marker icon */
.custom-div-icon {
  background: transparent;
  border: none;
}
