/* ============================================
   OliveOilMedNet Catalog
   ============================================ */
:root {
  --blue: #173f96;
  --blue-light: #009ee3;
  --green: #6f8f3a;
  --green-light: #8bb535;
  --font: 'Urbanist', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================
   LOADING SCREEN
   ============================================ */
#oomn-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f2f5 0%, #e8ecf4 100%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#oomn-loader.loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.loader-olive svg {
  display: block;
}

.loader-ring {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.loader-ring--outer {
  stroke: var(--blue);
  stroke-dasharray: 180 60;
  animation: loader-spin 1.4s linear infinite;
  transform-origin: 40px 40px;
}

.loader-ring--inner {
  stroke: var(--green);
  stroke-dasharray: 100 50;
  animation: loader-spin 1s linear infinite reverse;
  transform-origin: 40px 40px;
}

.loader-leaf {
  fill: var(--green-light);
  opacity: 0.7;
  animation: loader-pulse 1.2s ease-in-out infinite alternate;
  transform-origin: 40px 40px;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

@keyframes loader-pulse {
  0% { opacity: 0.4; transform: scale(0.85); }
  100% { opacity: 0.9; transform: scale(1.1); }
}

.loader-brand {
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: 0.5px;
}

.loader-sub {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--green);
  animation: loader-dots 1.5s steps(4, end) infinite;
}

@keyframes loader-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

body {
  font-family: var(--font);
  background: #f0f2f5;
  color: #1a1a1a;
}

/* ---- VIEWS ---- */
.oomn-view {
  max-width: 100%;
  margin: 0;
  padding: 0;
}

/* ============================================
   3D FLIPBOOK CONTAINER
   ============================================ */
.oomn-view--catalog {
  max-width: 100%;
  padding: 0;
  display: flex;
  flex-direction: row;
  height: 100vh;
}

#flipbook-wrapper {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

#flipbook-container {
  flex: 1;
  min-height: 0;
  min-width: 0;
}


/* ---- Custom Toolbar ---- */
#flipbook-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  background: var(--blue);
  border-top: 1px solid rgba(255,255,255,0.1);
}

#flipbook-toolbar button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.8);
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#flipbook-toolbar button:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}

#flipbook-toolbar button.tb-active {
  background: rgba(255,255,255,0.25);
  color: white;
}

#tb-page {
  color: rgba(255,255,255,0.9);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.tb-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.2);
  margin: 0 0.3rem;
}

/* ---- Right Sidebar ---- */
#right-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 0.5rem;
  background: transparent;
  z-index: 1;
  position: absolute;
  top: 0;
  right: 0;
}

.rs-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 2px 6px rgba(23,63,150,0.25);
}

.rs-btn:hover {
  background: var(--blue-light);
  transform: scale(1.1);
}

.rs-btn.tb-active {
  background: var(--blue-light);
  box-shadow: 0 2px 10px rgba(0,158,227,0.4);
}

/* ---- Search Bar ---- */
#search-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255,255,255,0.52);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  overflow: hidden;
  max-height: 400px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
}

#search-bar.search-bar--hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

#search-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 2px solid var(--blue-light);
}

#search-icon {
  color: var(--blue-light);
  font-size: 0.9rem;
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.95rem;
  color: #1a1a1a;
  background: transparent;
}

#search-input::placeholder {
  color: #aaa;
}

#search-count {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  background: rgba(0,158,227,0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  white-space: nowrap;
}

#search-count:empty {
  display: none;
}

#search-close {
  background: var(--blue);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
  flex-shrink: 0;
}

#search-close:hover {
  background: #c0392b;
  color: white;
}

#search-results {
  max-height: 280px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: 0.1s;
  border-bottom: 1px solid #f5f5f5;
}

.search-result:hover {
  background: rgba(0,158,227,0.06);
}

.search-result-page {
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  background: var(--blue-light);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-result-text {
  font-size: 0.82rem;
  color: #555;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-text mark {
  background: rgba(0,158,227,0.2);
  color: var(--blue);
  font-weight: 600;
  border-radius: 2px;
  padding: 0 2px;
}

/* ============================================
   CULTIVARS
   ============================================ */
#cultivar-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

#cultivar-filters select,
#cultivar-filters input {
  font-family: var(--font);
  padding: 0.6rem 1rem;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

#cultivar-filters select:focus,
#cultivar-filters input:focus {
  outline: none;
  border-color: var(--blue-light);
}

#cultivar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.cultivar-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cultivar-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

.cultivar-card-head {
  background: var(--green);
  color: white;
  padding: 1rem 1.2rem;
}

.cultivar-card-head h3 {
  font-size: 1.2rem;
  font-weight: 800;
}

.cultivar-card-head small {
  opacity: 0.85;
}

.cultivar-card-body {
  padding: 1rem 1.2rem;
}

.cultivar-card-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 0.85rem;
}

.cultivar-card-row:last-child { border: none; }

.cultivar-card-label {
  color: var(--blue-light);
  font-weight: 600;
  font-size: 0.78rem;
}

.cultivar-card-value {
  text-align: right;
  max-width: 55%;
}

.cultivar-card-oil {
  text-align: center;
  font-size: 2rem;
  font-weight: 100;
  color: var(--green);
  padding: 0.5rem;
}

.cultivar-card-tags {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem 1rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
}

.tag-use { background: rgba(0,158,227,0.1); color: var(--blue-light); }
.tag-pdo { background: rgba(111,143,58,0.1); color: var(--green); }
.tag-ai  { background: rgba(23,63,150,0.1);  color: var(--blue); }

/* ---- Modal ---- */
#cultivar-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  justify-content: center;
  align-items: center;
}

#cultivar-modal .modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

#cultivar-modal .modal-box {
  position: relative;
  background: white;
  border-radius: 12px;
  max-width: 850px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 16px 50px rgba(0,0,0,0.25);
}

#cultivar-modal .modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #999;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

#cultivar-modal .modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f2f5;
}

.detail-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--blue);
}

.detail-location {
  color: var(--green);
  margin-top: 0.2rem;
}

.detail-oil {
  font-size: 2.5rem;
  font-weight: 100;
  color: var(--green);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.detail-field {
  padding: 0.6rem 0;
  border-bottom: 1px solid #f5f5f5;
}

.detail-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

/* ============================================
   TOC PANEL (Sommaire)
   ============================================ */
#toc-panel {
  width: 280px;
  min-width: 280px;
  background: white;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease, opacity 0.2s ease;
}

#toc-panel.side-panel--hidden {
  width: 0;
  min-width: 0;
  opacity: 0;
  border-right: none;
  pointer-events: none;
}

#toc-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  background: #fff;
  color: var(--blue);
  padding: 0.8rem 0.9rem;
  border-bottom: 2px solid var(--blue);
}

#toc-logo {
  width: 100%;
  height: auto;
  display: block;
}

.toc-header-sub {
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--blue);
  text-align: center;
}

#toc-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0;
}

.toc-section {
  padding: 0.55rem 0.8rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  background: var(--green);
  cursor: pointer;
  transition: 0.15s;
  margin: 0.25rem 0.5rem;
  border-radius: 5px;
}

.toc-section:hover {
  background: var(--green-light);
}

.toc-section.toc-blue {
  background: var(--blue);
}

.toc-section.toc-blue:hover {
  background: var(--blue-light);
}

/* ---- Expandable children ---- */
.toc-section { display: flex; align-items: center; gap: 0.4rem; }

.toc-arrow {
  font-size: 0.55rem;
  transition: 0.2s;
  flex-shrink: 0;
}

.toc-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.toc-children--open {
  max-height: 2000px;
}

.toc-child {
  padding: 0.4rem 0.8rem 0.4rem 1.6rem;
  cursor: pointer;
  transition: 0.15s;
  border-left: 3px solid transparent;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--blue);
}

.toc-child:hover {
  background: rgba(0,158,227,0.06);
  border-left-color: var(--blue-light);
}

.toc-cultivar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem 0.4rem 1.6rem;
  cursor: pointer;
  transition: 0.15s;
  border-left: 3px solid transparent;
  font-size: 0.78rem;
}

.toc-cultivar:hover {
  background: rgba(0,158,227,0.06);
  border-left-color: var(--blue-light);
}

.toc-cultivar-name {
  font-weight: 600;
  color: var(--blue);
}

.toc-cultivar-country {
  font-size: 0.7rem;
  color: var(--green);
  font-weight: 500;
}

.toc-cultivar-flag {
  font-size: 1rem;
  line-height: 1;
}

/* Flag images (replace emoji flags everywhere). Scale with surrounding text. */
.flag-img {
  height: 0.95em;
  width: auto;
  vertical-align: -0.12em;
  border-radius: 2px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18);
}

/* Inside the round map markers, size flags to fit the 32px dot. */
.map-marker-dot .flag-img {
  height: auto;
  width: 19px;
  box-shadow: none;
  vertical-align: middle;
}

/* Flag before a country sub-item in the TOC (e.g. section 5). */
.toc-child-flag {
  margin-right: 0.4rem;
}

.toc-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  margin-left: 0.3rem;
  background: rgba(0,158,227,0.15);
  color: var(--blue-light);
  cursor: help;
  vertical-align: middle;
  position: relative;
}

.toc-badge--ai {
  background: rgba(23,63,150,0.12);
  color: var(--blue);
}

#toc-tooltip {
  position: fixed;
  background: #333;
  color: white;
  font-size: 0.68rem;
  font-weight: 500;
  font-family: var(--font);
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: none;
}

/* ============================================
   THUMBNAILS PANEL
   ============================================ */
#thumbs-panel {
  width: 220px;
  min-width: 220px;
  background: white;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease, opacity 0.2s ease;
}

#thumbs-panel.side-panel--hidden {
  width: 0;
  min-width: 0;
  opacity: 0;
  border-left: none;
  pointer-events: none;
}

#thumbs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--blue);
  color: white;
  padding: 0.8rem 1rem;
  font-weight: 800;
  font-size: 1rem;
}

#thumbs-header button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: 0.15s;
}

#thumbs-header button:hover {
  color: white;
  background: rgba(255,255,255,0.15);
}

#thumbs-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.thumb-item {
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: 0.15s;
  position: relative;
}

.thumb-item:hover {
  border-color: var(--blue-light);
}

.thumb-item img {
  width: 100%;
  display: block;
}

.thumb-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  text-align: center;
}

/* ============================================
   OVERLAYS (carte, comparateur, timeline)
   ============================================ */
#map-overlay,
#compare-overlay,
#timeline-overlay,
#aroma-overlay,
#network-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease;
}

#map-overlay.overlay--hidden,
#compare-overlay.overlay--hidden,
#timeline-overlay.overlay--hidden,
#aroma-overlay.overlay--hidden,
#network-overlay.overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: var(--blue);
  color: white;
}

.overlay-title {
  font-weight: 800;
  font-size: 1.1rem;
}

.overlay-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}

.overlay-close:hover {
  background: rgba(255,255,255,0.3);
}

/* ---- Map ---- */
#map-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* --- Map sidebar --- */
#map-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  z-index: 800;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  font-size: 0.82rem;
}

.map-sb-tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid #e5e5e5;
  background: #fafafa;
}

.map-sb-tab {
  flex: 1;
  padding: 0.7rem 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid transparent;
  transition: 0.15s;
}

.map-sb-tab:hover {
  color: #333;
}

.map-sb-tab--active {
  color: var(--green);
  border-bottom-color: var(--green);
  background: white;
}

.map-sb-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.map-sb-pane--active {
  display: block;
}

.map-sb-count {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 1px 6px;
  background: #ddd;
  color: #555;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
}

.map-sb-prod-item {
  padding-bottom: 0.45rem;
  line-height: 1.2;
}

.map-sb-prod-loc {
  display: block;
  font-size: 0.7rem;
  color: #888;
  font-weight: 400;
  margin-top: 2px;
}

.map-sb-prod-item.map-sb-active .map-sb-prod-loc {
  color: rgba(255,255,255,0.85);
}
.map-sb-group {
  margin-bottom: 0.5rem;
}
.map-sb-country {
  padding: 0.4rem 0.75rem;
  font-weight: 700;
  font-size: 0.78rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.map-sb-item {
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  padding: 0.35rem 0.75rem 0.35rem 1.25rem;
  cursor: pointer;
  color: #333;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}
.map-sb-item:hover {
  background: rgba(23,63,150,0.08);
}
.map-sb-item.map-sb-active {
  background: #173f96;
  color: #fff;
  font-weight: 600;
}
.map-sb-has-aroma::after {
  content: '●';
  font-size: 0.5rem;
  color: #6f8f3a;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.map-sb-active.map-sb-has-aroma::after {
  color: #b5d76a;
}

/* Marker animations */
.map-marker-custom {
  background: none !important;
  border: none !important;
}

.map-marker-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.map-marker-dot:hover {
  transform: scale(1.25);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 100 !important;
}

/* Pulse ring behind marker */
.map-marker-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: marker-pulse 2.5s ease-out infinite;
}

@keyframes marker-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Staggered entrance animation */
.map-marker-entrance {
  animation: marker-drop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Producer markers (smaller pin) */
.map-producer-marker {
  background: transparent;
  border: none;
}

.map-producer-pin {
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.15s;
}

.map-producer-pin:hover {
  transform: rotate(-45deg) scale(1.3);
}

.map-popup--producer .map-popup-header h4 {
  font-size: 0.95rem;
}

/* Producers dropdown list inside cultivar popup */
.map-popup-prod-list {
  margin-top: 0.4rem;
  border-top: 1px solid #f0f0f0;
  max-height: 180px;
  overflow-y: auto;
}

.map-popup-prod-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: white;
  border: none;
  border-bottom: 1px solid #f5f5f5;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: #333;
  transition: 0.12s;
}

.map-popup-prod-item:hover {
  background: #f8f9fa;
  color: var(--green);
}

.map-popup-prod-item:last-child { border-bottom: none; }

.map-popup-prod-loc {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: #888;
  margin-top: 2px;
}

.map-popup-prod-toggle--open {
  background: var(--green-dark, #5a7530) !important;
}

/* Network / MoU overlay */
#network-body {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  height: calc(100% - 50px);
  background: #fafafa;
}

.net-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.net-kpi {
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border-left: 4px solid var(--green);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.net-kpi-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
}

.net-kpi-lbl {
  font-size: 0.78rem;
  color: #666;
  font-weight: 600;
}

.net-kpi-lbl small {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  color: #999;
  margin-top: 2px;
}

.net-intro {
  background: white;
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.net-intro p {
  margin: 0 0 1rem;
  line-height: 1.55;
  color: #333;
  font-size: 0.92rem;
}

.net-cta {
  background: var(--blue);
  color: white;
  border: none;
  padding: 0.7rem 1.2rem;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.15s;
}

.net-cta:hover {
  background: var(--blue-light);
}

.net-section-title {
  margin: 1.5rem 0 0.8rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.net-badge {
  background: var(--blue);
  color: white;
  font-size: 0.7rem;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 700;
}

.net-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.net-group {
  background: white;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.net-group-head {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--green);
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.5rem;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.net-group-count {
  margin-left: auto;
  background: #f0f0f0;
  color: #666;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.net-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.83rem;
  color: #333;
  line-height: 1.5;
}

.net-list li {
  margin-bottom: 0.25rem;
}

.net-quote {
  margin-top: 2rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  color: white;
  border-radius: 10px;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: center;
}

/* Toggle producers button on the map */
.map-toggle-producers button {
  width: 30px;
  height: 30px;
  background: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 30px;
  text-align: center;
  transition: 0.15s;
}

.map-toggle-producers button:hover {
  background: #f0f0f0;
}

.map-toggle-producers button.map-toggle-active {
  background: var(--green);
  color: white;
}

/* KPI panel - pushed right of the sidebar (220px) */
.leaflet-bottom.leaflet-left {
  left: 230px;
}

.map-kpi-panel {
  background: white;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  font-family: var(--font);
  min-width: 180px;
}

.map-kpi-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--blue-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.4rem;
}

.map-kpi-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.map-kpi-num {
  font-weight: 800;
  color: var(--green);
  font-size: 0.95rem;
}

.map-kpi-lbl {
  font-size: 0.7rem;
  color: #666;
}

.map-kpi-countries {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  font-size: 0.78rem;
  color: #555;
}

.map-kpi-flag {
  white-space: nowrap;
}

@keyframes marker-drop {
  0% { opacity: 0; transform: translateY(-30px) scale(0.3); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

#map-container .leaflet-popup {
  animation: popup-appear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popup-appear {
  0% { opacity: 0; transform: scale(0.7) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

#map-container .leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 0;
  overflow: hidden;
}

#map-container .leaflet-popup-content {
  margin: 0;
  min-width: 240px;
}

#map-container .leaflet-popup-tip {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#map-container .leaflet-popup-close-button {
  color: white !important;
  font-size: 22px !important;
  font-weight: 700;
  top: 4px !important;
  right: 6px !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 10;
}

.map-popup {
  font-family: var(--font);
}

.map-popup-header {
  background: var(--green);
  color: white;
  padding: 0.6rem 0.8rem;
}

.map-popup-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.map-popup-header small {
  opacity: 0.85;
  font-size: 0.75rem;
}

.map-popup-body {
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.map-popup-body .popup-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.map-popup-body .popup-row:last-child {
  border-bottom: none;
}

.map-popup-body .popup-label {
  color: var(--blue-light);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.map-popup-body .popup-row span:last-child {
  color: #333;
  font-size: 0.78rem;
  line-height: 1.3;
}

.map-popup-aroma {
  padding: 0.35rem 0;
  border-top: 1px solid #f0f0f0;
}
.map-popup-aroma-title {
  color: var(--blue-light);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.25rem;
}
.map-popup-aroma canvas {
  width: 100% !important;
  height: auto !important;
}

.map-popup-footer {
  display: flex;
}

.map-popup-go,
.map-popup-producers {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  color: white;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  border: none;
  transition: 0.15s;
}

.map-popup-go {
  background: var(--blue);
}

.map-popup-go:hover {
  background: var(--blue-light);
}

.map-popup-producers {
  background: var(--green);
}

.map-popup-producers:hover {
  filter: brightness(1.1);
}

.map-popup-prev,
.map-popup-next {
  padding: 0.5rem 0.7rem;
  background: var(--green);
  color: white;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.2);
  transition: 0.15s;
}

.map-popup-prev:hover,
.map-popup-next:hover {
  background: var(--green-light);
}

.map-popup-nav--disabled {
  opacity: 0.35;
  cursor: default;
}

.map-popup-nav--disabled:hover {
  background: var(--green);
}

/* ---- Comparateur ---- */
#compare-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f0f2f5;
}

#compare-selectors {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

#compare-selectors select {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  min-width: 180px;
  cursor: pointer;
}

#compare-selectors select:focus {
  outline: none;
  border-color: var(--blue-light);
}

#compare-grid {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.compare-row {
  display: grid;
  border-bottom: 1px solid #f0f0f0;
}

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

.compare-cell {
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
}

.compare-cell--label {
  background: #f8f9fa;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--blue-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.compare-cell--header {
  background: var(--green);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.8rem 1rem;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.compare-cell--header small {
  font-weight: 400;
  opacity: 0.85;
  font-size: 0.75rem;
}

.compare-cell--catalog {
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
}

.compare-btn {
  width: 100%;
  padding: 0.4rem 0.5rem;
  color: white;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.72rem;
  cursor: pointer;
  border: none;
  border-radius: 3px;
  transition: 0.15s;
}

.compare-btn-cat { background: var(--blue); }
.compare-btn-cat:hover { background: var(--blue-light); }

.compare-btn-prod { background: var(--green); }
.compare-btn-prod:hover { filter: brightness(1.1); }

.compare-btn-disabled {
  background: #e5e5e5;
  color: #999;
  cursor: not-allowed;
}

.compare-oil-bar {
  display: inline-block;
  height: 8px;
  border-radius: 4px;
  background: var(--green);
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ---- Timeline ---- */
#timeline-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  background: #f0f2f5;
}

.timeline-chart {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 1.5rem;
  overflow-x: auto;
}

.timeline-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #f5f5f5;
  min-height: 36px;
}

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

.timeline-row--header {
  font-weight: 700;
  font-size: 0.72rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e0e0e0;
}

.timeline-name {
  width: 180px;
  min-width: 180px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.timeline-name .tl-flag {
  font-size: 0.9rem;
}

.timeline-months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  flex: 1;
  min-width: 400px;
}

.timeline-month {
  text-align: center;
  padding: 0.3rem 0;
  font-size: 0.72rem;
  position: relative;
}

.timeline-month--active {
  position: relative;
}

.timeline-month--active::before {
  content: '';
  position: absolute;
  inset: 4px 2px;
  border-radius: 4px;
  opacity: 0.85;
}

/* ---- Charts ---- */
#chart-comparison {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 1.5rem;
  min-height: 450px;
}

/* ============================================
   AROMAGRAM OVERLAY
   ============================================ */
#aroma-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#aroma-selectors {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

#aroma-selectors select {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  min-width: 200px;
  cursor: pointer;
}

#aroma-selectors select:focus {
  outline: none;
  border-color: var(--blue-light);
}

/* Custom flag dropdown (compare + aromagram selectors) - renders image flags
   that native <option> cannot show. Panel is body-attached + position:fixed. */
.flag-select {
  position: relative;
  font-family: var(--font);
  font-size: 0.9rem;
  min-width: 200px;
  cursor: pointer;
  outline: none;
}
.flag-select__trigger {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  white-space: nowrap;
}
.flag-select:focus .flag-select__trigger,
.flag-select--open .flag-select__trigger {
  border-color: var(--blue-light);
}
.flag-select__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flag-select__caret {
  margin-left: auto;
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #888;
}
.flag-select__placeholder { color: #999; }

.flag-select__panel {
  position: fixed;
  z-index: 99999;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 0.25rem;
}
.flag-select__opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.flag-select__opt:hover { background: #f0f4ff; }
.flag-select__opt.is-selected { background: #e6eefc; font-weight: 600; }

#aroma-chart-wrap {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#aroma-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.aroma-chart-box {
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  padding: 1.5rem;
  flex: 1;
  min-width: 280px;
  max-width: 600px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#aroma-legend {
  margin-top: 1rem;
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--font);
  font-size: 0.85rem;
}

.aroma-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.aroma-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

#aroma-body .aroma-empty {
  color: #999;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1rem;
}

.aroma-dl-btns {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: 0.75rem;
}

.aroma-dl-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.15s;
}

.aroma-dl-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #oomn-nav { flex-direction: column; gap: 0.5rem; }
  #cultivar-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; }
  #cultivar-filters { flex-direction: column; }
  #flipbook-controls { gap: 0.5rem; }
  #flipbook-controls button { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
  #pdf-toolbar { gap: 0.3rem; padding: 0.4rem 0.5rem; }
  #pdf-search { width: 120px; }
  #toc-panel { display: none; }
}
