/* ---------- GENERAL ---------- */
.label-green {
  color: green;
  font-weight: bold;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
}


/* ---------- HEADER & NAVIGATION ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 0.5rem 1rem;
  border-bottom: 4px solid #b60000;
  z-index: 1000;
  position: relative;
}

nav {
  flex-grow: 1;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-logo {
  height: 50px;
  width: auto;
}

nav ul.navbar {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

nav ul.navbar li {
  position: relative;
}

nav ul.navbar li a {
  text-decoration: none;
  color: black;
  font-weight: bold;
  padding: 0.5rem;
  display: block;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  min-width: 200px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 2000;
  padding: 0;
}

.dropdown-content li {
  border-bottom: 1px solid #f0f0f0;
  list-style-type: none;
}

.dropdown-content li a {
  padding: 0.75rem 1rem;
  color: #333;
}

.dropdown-content li a:hover {
  background-color: #f8f8f8;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* ---------- PAGE LAYOUT ---------- */
.container {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  box-sizing: border-box;
}

/* ---------- SEARCH PANEL ---------- */
.search-panel {
  width: 60%;
  background: #f4f4f4;
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: calc(100vh - 100px);
}

.search-panel h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.search-panel label {
  display: block;
  margin-top: 1rem;
  font-weight: bold;
  color: #222;
}

.search-panel select,
.search-panel input[type="text"] {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.25rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 0.95rem;
  background-color: white;
  appearance: auto;
}

.search-panel input#species {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.25rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 0.95rem;
  background-color: white;
}

.search-panel input:focus,
.search-panel select:focus {
  border-color: #333;
  outline: none;
}

.search-panel button {
  margin-top: 1.5rem;
  padding: 0.6rem;
  font-size: 1rem;
  width: 100%;
  background-color: #2e7d32;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

.search-btn:hover {
  background-color: #1b5e20;
}

.reset-btn {
  background-color: #bbb;
}

.reset-btn:hover {
  background-color: #999;
}

/* ---------- MAP CONTAINER ---------- */
.map-container {
  width: 40%;
  min-width: 400px;
  height: 600px;
  border: 1px solid #ccc;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  background: white;
}

#map {
  width: 100%;
  height: 100%;
}

/* ---------- TABLES ---------- */
#results {
  padding: 1rem 0;
  overflow-y: auto;
  background: #fefefe;
  font-size: 0.9rem;
}

#results h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: #333;
}

#results-table,
#region-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

#results-table th,
#results-table td,
#region-results-table th,
#region-results-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
}

#results-table th,
#region-results-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

#results-table tr:hover,
#region-results-table tr:hover {
  background-color: #f9f9f9;
  cursor: pointer;
}

#results-table button {
  font-size: 1.1rem;
  background: none;
  border: none;
  cursor: pointer;
}

#results-table button:hover {
  color: #2e7d32;
}

/* ---------- TABS ---------- */
.tab-header {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.tab {
  padding: 0.4rem 1rem;
  border: 1px solid #888;
  background-color: #2e7d32;
  color: white;
  cursor: pointer;
  font-weight: bold;
  border-radius: 4px 4px 0 0;
}

.tab.active {
  background-color: #66bb6a;
  border-bottom: 2px solid #66bb6a;
}

/* ---------- GLOBAL CHART ---------- */
.fixed-chart {
  width: 95%;
  max-width: 1200px;
  margin: 2rem auto;
  border-top: 2px solid #ccc;
  padding-top: 1rem;
  background: #fdfdfd;
}

/* ---------- LEAFLET CONTROLS ---------- */
.leaflet-control-layers {
  background-color: #ffffffd0;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  padding: 5px;
  font-size: 0.9rem;
}

.leaflet-control-layers label {
  display: block;
  margin-bottom: 3px;
  font-weight: normal;
}

.leaflet-control-layers input[type="radio"] {
  margin-right: 6px;
}

/* ✅ FINAL FIX for Awesomplete width matching other fields */
.awesomplete {
  display: block;
  width: 100% !important;
}

.awesomplete input {
  width: 100% !important;
  padding: 0.6rem;
  border: 1px solid #aaa;
  border-radius: 4px;
  font-size: 0.95rem;
  background-color: white;
  box-sizing: border-box;
}

#tab-details ul {
  list-style-type: square;
  padding-left: 20px;
}

/* ---------- DETAILS PANEL STYLE IMPROVEMENT ---------- */
#tab-details {
  padding: 1rem;
  line-height: 1.8;
  font-size: 0.95rem;
}

#tab-details p,
#tab-details ul {
  margin: 0.75rem 0;
}

#tab-details strong {
  color: #2e7d32; /* Vert foncé */
  font-weight: bold;
}

#tab-details ul {
  list-style-type: square;
  padding-left: 1.5rem;
}

/* Separator between details sections */
hr.detail-separator {
  border: none;
  border-top: 1px solid #666;  /* darker for visibility */
  margin: 1rem 0;
  width: 100%;
}

#chord-container {
  margin-top: 10px; !important
    padding-top: 10px;
  text-align: center;
}
#chord-chart {
  width: 100%;
  height: 600px;
  margin-bottom: 180px; /* Augmente l'espacement sous le diagramme */
}

#chord-chart svg {
  overflow: visible !important;
}

.tab-button {
  background-color: #2e7d32; /* vert foncé = par défaut (non sélectionné) */
  color: white;
  font-weight: bold;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.tab-button.active {
  background-color: #66bb6a; /* vert clair quand sélectionné */
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  gap: 0.5rem;
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #999;
}

#endemism-results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

#endemism-results-table th,
#endemism-results-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
}

#endemism-results-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

#endemism-results-table tr:hover {
  background-color: #f9f9f9;
  cursor: pointer;
}

/* Dropdown menu wrapper */
.dropdown-wrapper {
  position: relative;
  width: 100%;
  margin-top: 0.5rem;
}

/* Dropdown button style */
.dropdown-button {
  width: 100%;
  height: 38px;
  padding: 0.6rem 2rem 0.6rem 0.6rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: #333;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 4px;
  text-align: left;
  appearance: none;
  background-image: none;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 8px 10px;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
}

/* Dropdown icon */
.dropdown-button::after {
  content: "▼";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #666;
}

/* Transparent version if needed */
.dropdown-button:not(:empty) {
  background-color: rgba(255, 255, 255, 0.85);
}

/* Dropdown menu list */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  padding: 0.5rem;
  display: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.dropdown-menu.show {
  display: block;
}

/* Checkbox item */
.checkbox-item {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  padding: 0.3rem;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.checkbox-item:hover {
  background-color: #f0f0f0;
}

.checkbox-item input[type="checkbox"] {
  margin: 0;
}

.checkbox-item label {
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

/* Harmonise la largeur des deux barres */
.dropdown-wrapper,
#family-select {
  width: 100%;
}

/* Supprime contour bleu du bouton d'onglet (focus) */
.tab-button:focus,
.tab-button:focus-visible,
.tab-button::-moz-focus-inner {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* Graph bar chart sizing */
#endemism-bar-chart {
  height: 250px !important;
  max-height: 300px;
}

/* Styles pour les noms d'espèces cliquables */
.clickable-name {
  color: #2e7d32;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 2px 4px;
  border-radius: 3px;
}

.clickable-name:hover {
  background-color: #e8f5e8;
  color: #1b5e20;
  text-decoration: none;
  transform: scale(1.02);
}

.clickable-name:active {
  background-color: #c8e6c9;
  transform: scale(0.98);
}

/* Animation pour l'effet de surbrillance temporaire */
.clickable-name.highlighted {
  background-color: #ffeb3b !important;
  animation: highlightPulse 1.5s ease-out;
}

@keyframes highlightPulse {
  0% {
    background-color: #ffeb3b;
    box-shadow: 0 0 5px rgba(255, 235, 59, 0.7);
  }
  50% {
    background-color: #fff176;
    box-shadow: 0 0 10px rgba(255, 235, 59, 0.9);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}


/* ADD THESE STYLES TO YOUR EXISTING style.css FILE */

/* Bottom section layout - mirrors the top layout */
.bottom-layout {
  display: flex;
  gap: 1rem;
  padding: 0;
  box-sizing: border-box;
}

/* Chart container - same width as search panel (60%) */
.bottom-chart-container {
  width: 60%;
  background: #f4f4f4;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  position: relative;
  min-height: 500px;
  box-sizing: border-box;
}

.bottom-chart-container h4 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: #2e7d32;
  font-weight: bold;
}

/* Image container - same width as map container (40%) */
.bottom-image-container {
  width: 40%;
  min-width: 400px;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  text-align: center;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  box-sizing: border-box;
}

.bottom-image-container h4 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: #2e7d32;
  font-weight: bold;
  width: 100%;
}

.bottom-image-container img {
  width: 100%;
  height: auto;
  max-height: 600px; /*Increased from 450*/
  object-fit: contain;
  border: 1px solid #ccc;
  border-radius: 4px;
  border-radius: 4px;
  margin-top: 0.5rem;
}

/* Enhanced image placeholder */
.image-placeholder {
  width: 100%;
  height: 300px;
  background: #e0e0e0;
  border: 2px dashed #999;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-style: italic;
  border-radius: 4px;
  flex-direction: column;
  gap: 0.5rem;
}

/* Donut chart sizing for bottom section */
#endemism-donut-chart {
  width: 100% !important;
  height: 400px !important;
  max-height: 400px;
}

/* Update existing fixed-chart styles */
.fixed-chart {
  width: 95%;
  max-width: 1400px;
  margin: 2rem auto;
  padding-top: 1rem;
  background: #fdfdfd;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 2rem 1rem;
}

/* Responsive layout for bottom section */
@media (max-width: 1200px) {
  .bottom-layout {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .bottom-chart-container,
  .bottom-image-container {
    width: 100%;
    min-width: auto;
  }
}

#iucn-donut-chart {
  width: 100% !important;
  height: 400px !important;
  max-height: 400px;
}

.iucn-box {
  display: inline-block;
  width: 30px;
  height: 20px;
  text-align: center;
  font-weight: bold;
  color: white;
  border: 1px solid #333;
  margin-right: 6px;
}

#iucn-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 1rem;
}

#iucn-results-table th,
#iucn-results-table td {
  border: 1px solid #ccc;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

#iucn-results-table th {
  background-color: #f4f4f4;
  font-weight: bold;
  text-transform: capitalize;
}

#iucn-results-table tbody tr:nth-child(even) {
  background-color: #fafafa;
}

.species-link {
  color: #2e7d32;
  text-decoration: none;
  cursor: pointer;
}

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

/* 🔍 Marker highlight effect */
.leaflet-marker-icon.highlight {
  transform: scale(1.4);
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 0 6px #2196F3);
  z-index: 999 !important;
}

/*endemism*/
/* Styles pour les noms d'espèces cliquables */
.clickable-name {
  color: #2e7d32;
  cursor: pointer;
  text-decoration: none;  /* Changed from underline to none */
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 2px 4px;
  border-radius: 3px;
}

.clickable-name:hover {
  background-color: #e8f5e8;
  color: #1b5e20;
  text-decoration: underline;  /* Changed from none to underline */
  transform: scale(1.02);
}

.clickable-name:active {
  background-color: #c8e6c9;
  transform: scale(0.98);
}

/* Animation pour l'effet de surbrillance temporaire */
.clickable-name.highlighted {
  background-color: #ffeb3b !important;
  animation: highlightPulse 1.5s ease-out;
}

@keyframes highlightPulse {
  0% {
    background-color: #ffeb3b;
    box-shadow: 0 0 5px rgba(255, 235, 59, 0.7);
  }
  50% {
    background-color: #fff176;
    box-shadow: 0 0 10px rgba(255, 235, 59, 0.9);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}


/* Header arrow styles */
.sort-label {
  font-weight: bold;
  white-space: nowrap;
  display: inline-block;
  text-align: center;
}
.sort-label::before {
  content: "▼ ";
  color: hsl(0, 80%, 50%); /* red for ascending */
}
.sort-label::after {
  content: " ▲";
  color: hsl(120, 70%, 40%); /* green for descending */
}
 
/* Layout & spacing for semantic classes */
.title-spacing {
  margin-top: 1rem;
}

.table-title {
  margin-top: 2rem;
}


.container.vertical {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Optional fallback coloring classes for rows (in case JS gradient fails) */
.highlight-full {
  background-color: #e0f7e9 !important;
}
.highlight-none {
  background-color: #fdecea !important;
}
.highlight-partial {
  background-color: #fff8e1 !important;
}

/* Completely remove DataTables built-in sort icons */
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after,
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before {
  content: "" !important;
  display: none !important;
}

#karyo-table td,
#karyo-table th {
  text-align: center;
  vertical-align: middle;
}

/* Make donut charts resize responsively inside their container */
.gauge-container canvas {
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* Ensure the layout keeps equal spacing and alignment */
.gauge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.gauge-container {
  flex: 1 1 30%;
  min-width: 250px;
  padding: 1rem;
  text-align: center;
  box-sizing: border-box;
}

/* ========== REGION MAP AND CHARTS SECTION ========== */
.region-interactive-section {
  margin-top: 2rem;
  padding: 1rem;
}

.region-grid {
  display: flex;
  gap: 1rem;
  height: 500px;
}

/* Left container - Analytics */
.region-analytics {
  flex: 1;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.region-title {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 1rem;
  text-align: center;
}

.region-donut {
  height: 200px !important;
  margin-bottom: 1rem;
}

.separator {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1rem 0;
}

.region-bar {
  flex: 1;
  min-height: 200px !important;
}

/* Right container - Map */
.region-map {
  flex: 1;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#moroccoMap {
  width: 100%;
  height: 100%;
}

/* Leaflet map adjustments */
.leaflet-container {
  background: #e9f9e9 !important;
  height: 100%;
}

.leaflet-tooltip {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
}

/* Responsive design */
@media (max-width: 1200px) {
  .region-grid {
    flex-direction: column;
    height: auto;
  }

  .region-analytics,
  .region-map {
    width: 100%;
    height: 400px;
  }
}

#moroccoMap {
  width: 100%;
  height: 100%;
  min-height: 420px;
  padding: 0;
  margin: 0 auto;
  border-radius: 10px;
  background: #ddd;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#moroccoMapContainer {
  position: relative;
}

.map-header-label {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: darkgreen;
  font-weight: bold;
  font-size: 16px;
  background-color: white;
  padding: 4px 12px;
  border: 2px solid green;
  border-radius: 5px;
}

.region-tooltip {
  background-color: rgba(0, 100, 0, 0.8);
  color: white;
  font-weight: bold;
  font-size: 13px;
  border-radius: 4px;
  padding: 4px 8px;
}
.leaflet-interactive:focus {
  outline: none !important;
}



.logo-title a img:hover {
  transform: scale(1.04);
  transition: transform 0.2s ease;
}

.ados-link {
  color: #1976d2; /* same blue as author names */
  font-weight: bold;
  text-decoration: none;
  transition: all 0.3s ease;
}

.ados-link:hover {
  text-decoration: underline;
  background-color: rgba(25, 118, 210, 0.08); /* soft blue hover background */
}

