@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400&display=swap');

body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  color: #2B4251;
}

strong { font-weight: 400; }

#spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,1.0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.logo-container {
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo {
  max-width: 200px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.loader {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #5C8098;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  z-index: 0;
  touch-action: none;
}

.tooltip {
  position: absolute;
  background: white;
  padding: 6px 10px;
  border: 1px solid #AEAEAE;
  font-size: 13px;
  color: #2B4251;
  pointer-events: none;
  display: none;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1;
  max-width: 300px;
}

/* Sidebar container */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background-color: white;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar.show {
  opacity: 1;
  visibility: visible;
}

.sidebar-content {
  position: relative;
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100vh;
  scrollbar-width: thin;
  scrollbar-color: #888 #ffffff;
}

.close-btn {
  position: absolute;
  top: 5px;
  right: 10px;
  background: none;
  border: none;
  font-size: 28px;
  color: #5C8098;
  cursor: pointer;
  z-index: 11;
}

.sidebar h2 {
  margin: 10px 0 5px;
  font-size: 20px;
  font-weight: 400;
  color: #2B4251;
}

.sidebar h3 {
  margin: 5px 0 15px;
  font-size: 16px;
  font-weight: 400;
  color: #5C8098;
}

.sidebar h4 {
  margin: 15px 0 8px;
  font-size: 14px;
  font-weight: 400;
  color: #2B4251;
  border-bottom: 1px solid #E0E6EA;
  padding-bottom: 4px;
}

.tabs {
  display: flex;
  margin-top: 10px;
  font-weight: 300;
  border-bottom: 1px solid #AEAEAE;
}

.tab {
  flex: 1;
  padding: 10px 0;
  cursor: pointer;
  text-align: center;
  color: #5C8098;
  font-size: 14px;
  font-weight: 300;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease-in-out;
}

.tab:hover {
  background: #F5F8FA;
}

.tab.active {
  color: #2B4251;
  font-weight: 300;
  border-bottom: 2px solid #8CB2CB;
}

.tab-content {
  margin-top: 15px;
  font-size: 14px;
  color: #2B4251;
  font-weight: 300;
  line-height: 1.4em;
}

.risk-description {
  margin-bottom: 20px;
}

.risk-description p {
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.commodities-section {
  margin-bottom: 20px;
}

.commodities-list {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}

.commodities-list li {
  margin: 4px 0;
  padding: 0;
  line-height: 1.3;
}

.commodity-category {
  margin-bottom: 15px;
  padding: 8px 15px 10px 15px;
  background: #F8FAFB;
  border-radius: 6px;
  border-left: 4px solid #8CB2CB;
}

.commodity-category:last-child {
  margin-bottom: 0;
}

.commodity-category strong {
  display: block;
  margin-bottom: 6px;
  color: #2B4251;
}

.case-studies-section {
  margin-bottom: 20px;
}

.case-study {
  margin-bottom: 20px;
  padding: 10px 15px 12px 15px;
  background: #F8FAFB;
  border-radius: 6px;
  border-left: 4px solid #5C8098;
}

.case-study h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 400;
  color: #2B4251;
  border: none;
  padding: 0;
}

.case-study p {
  margin: 0;
  line-height: 1.5;
  font-size: 13px;
}

.references {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #E0E6EA;
}

.references h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 400;
  color: #2B4251;
  border: none;
  padding: 0;
}

.references div {
  margin: 5px 0;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.references a {
  color: #5C8098;
  text-decoration: none;
  word-break: break-all;
}

.references a:hover {
  text-decoration: underline;
  color: #2B4251;
}

/* Filter Panel */
.filter-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 250px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  padding: 10px;
  z-index: 5;
  font-family: 'Poppins', sans-serif;
  transition: box-shadow 0.2s ease;
}

.filter-panel:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.filter-panel h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  color: #2B4251;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.filter-panel.collapsed h3 {
  margin: 0;
  padding: 12px 10px;
}

.filter-panel h3:hover {
  background: #F5F8FA;
  color: #5C8098;
}

.toggle-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
  color: #5C8098;
}

.filter-panel.collapsed .toggle-arrow {
  transform: rotate(-90deg);
}

#filter-content {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 400px;
  opacity: 1;
}

.filter-panel.collapsed #filter-content {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-group label {
  display: block;
  font-size: 13px;
  font-weight: 300;
  color: #2B4251;
  margin-bottom: 4px;
}

.filter-group select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #AEAEAE;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Poppins', sans-serif;
  background: white;
  color: #2B4251;
  min-height: 32px;
}

.filter-group select[multiple] {
  height: 100px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.filter-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.filter-btn:not(.clear) {
  background: #5C8098;
  color: white;
}

.filter-btn:not(.clear):hover {
  background: #4A6B7F;
}

.filter-btn.clear {
  background: #E0E6EA;
  color: #2B4251;
}

.filter-btn.clear:hover {
  background: #D0D6DA;
}

/* Tablet styles */
@media (max-width: 1024px) {
  .sidebar {
    width: 350px;
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .filter-panel {
    display: none;
  }

  .sidebar {
    width: 100%;
    height: 90vh;
    bottom: 0;
    top: auto;
    right: 0;
    left: 0;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.15);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .sidebar-content {
    max-height: 90vh;
    padding: 15px;
  }

  .sidebar h2 {
    font-size: 18px;
    margin: 5px 0 5px;
    padding-right: 30px;
  }

  .close-btn {
    top: 10px;
    right: 15px;
    font-size: 24px;
  }

  .tab {
    padding: 8px 5px;
    font-size: 13px;
  }

  .tab-content {
    font-size: 13px;
    margin-top: 12px;
  }

  .case-study {
    padding: 8px 12px 10px 12px;
    margin-bottom: 15px;
  }

  .case-study h4 {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .case-study p {
    font-size: 12px;
  }

  .commodity-category {
    padding: 6px 12px 8px 12px;
    margin-bottom: 12px;
  }

  .commodities-list li {
    font-size: 12px;
  }

  .references {
    margin-top: 15px;
    padding-top: 12px;
  }

  .references h4 {
    font-size: 13px;
  }

  .references div {
    font-size: 12px;
  }

  .loading-logo {
    max-width: 150px;
    max-height: 60px;
  }
}

/* Very small mobile devices */
@media (max-width: 480px) {
  .sidebar {
    height: 90vh;
  }

  .sidebar-content {
    max-height: 90vh;
    padding: 12px;
  }

  .sidebar h2 {
    font-size: 16px;
  }

  .tab {
    padding: 6px 3px;
    font-size: 12px;
  }

  .tab-content {
    font-size: 12px;
  }

  .filter-panel {
    width: 110px;
    padding: 10px;
  }

  .filter-panel h3 {
    font-size: 13px;
  }

  .filter-group select[multiple] {
    height: 50px;
  }

  .loading-logo {
    max-width: 120px;
    max-height: 50px;
  }

  .logo-container {
    margin-bottom: 20px;
  }
}