/* UI Components - Dropdowns, Popups, Charts, etc. */

/* Footer */
.footer {
  font-size: 14px;
  color: #a0aec0;
  margin-top: auto;
  padding-bottom: 25px;
  padding-top: 20px;
  width: 100%;
  max-width: 1200px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.4;
}

.footer a {
  color: #a0aec0;
  text-decoration: underline;
}

.footer a:hover {
  text-decoration: underline;
}

.coffee-link {
  margin-top: 4px; /* tighter vertical spacing */
  text-align: center;
}

.coffee-link a {
  color: #a0aec0;
  text-decoration: none;
}

.coffee-link a:hover {
  color: white;
  text-decoration: none;
}

/* Location Dropdown */
.location-dropdown-wrapper {
  display: inline-block !important;
  position: relative;
  margin: 0;
  padding: 0;
  background: transparent;
  transition: all 0.3s ease;
  width: max-content !important; /* shrink to exactly the text width */
  cursor: pointer;
}

.location-dropdown-wrapper:hover {
  background: transparent;
}

.location-dropdown-display {
  color: white;
  font-size: 18px;
  font-weight: normal;
  display: inline-block;
  width: auto !important; /* size exactly to text */
  border-bottom: 1px solid rgba(148, 163, 184, 0.55) !important; /* subtle slate */
  padding-bottom: 1px;
  pointer-events: none;
  user-select: none;
  text-align: left;
  line-height: 1.2;
  white-space: nowrap; /* prevent wrapping that could add extra width */
  margin-right: 0 !important; /* spacing controlled by update-time */
}

.location-dropdown {
  position: absolute;
  top: 0;
  left: 0;
  width: fit-content !important; /* size to content */
  min-width: fit-content !important;
  max-width: none !important; /* no upper constraint */
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  background-color: transparent;
  border: none;
  color: white;
  padding: 0; /* no extra width from padding */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  white-space: nowrap; /* keep single line to match text */
  box-sizing: content-box; /* avoid width inflation */
}

.location-dropdown:hover {
  opacity: 0;
}

.location-dropdown:focus {
  outline: none;
  opacity: 0;
}

.location-dropdown:active {
  opacity: 0;
}

.location-dropdown option {
  background-color: #2d3748;
  color: white;
  padding: 8px;
}

/* Update time styling */
.update-time {
  margin-left: 10px !important; /* exact spacing from visible text */
  font-size: 14px;
  color: #a0aec0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.update-time:hover {
  color: white;
}

/* Share and About link styles */
.share-link {
  text-decoration: none;
  transition: all 0.2s ease;
  z-index: 9999;
  opacity: 0.8;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  right: 45px;
  width: 16px;
  height: 16px;
  padding: 0;
  box-sizing: border-box;
  transform: translateY(-50%);
}

.share-link:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

.about-link {
  text-decoration: none;
  transition: all 0.2s ease;
  z-index: 9999;
  opacity: 0.8;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  right: 15px;
  width: 16px;
  height: 16px;
  padding: 0;
  box-sizing: border-box;
  transform: translateY(-50%);
}

.about-link:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* Map sections for Valencia, Pobla, and Oliva */
#vlc-map-section, #oli-map-section, #far-map-section {
  margin-top: 20px;
}

.vlc-map-wrapper, .oli-map-wrapper, .far-map-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 600px;
  overflow: hidden;
}

.vlc-map-wrapper img, .oli-map-wrapper img, .far-map-wrapper img {
  width: 100%;
  height: auto; /* Natural aspect ratio like other maps */
  max-width: 100%;
  border-radius: 0;
}

/* Mobile map styling - stick to page borders */
@media (max-width: 767px) {
  #vlc-map-section, #oli-map-section, #far-map-section {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  
  .vlc-map-wrapper, .oli-map-wrapper, .far-map-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .vlc-map-wrapper img, .oli-map-wrapper img, .far-map-wrapper img {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }
}

.wind-arrows-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  grid-template-rows: repeat(14, 1fr);
}

@media (max-width: 767px) {
  .wind-arrows-overlay {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(10, 1fr);
  }
}

.wind-arrow {
  width: 20px;
  height: 20px;
  transform-origin: center;
  justify-self: center;
  align-self: center;
  background-image: url('data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjZmZmZmZmIiB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAxOTIwIDE5MjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmIj4KDTxnIGlkPSJTVkdSZXBvX2JnQ2FycmllciIgc3Ryb2tlLXdpZHRoPSIwIi8+Cg08ZyBpZD0iU1ZHUmVwb190cmFjZXJDYXJyaWVyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KDTxnIGlkPSJTVkdSZXBvX2ljb25DYXJyaWVyIj4gPHBhdGggZD0ibTEzMDQuODI0IDM0NS4wMDItODEuMjUgODEuMjQ5IDQ3Ni40NjYgNDc2LjU4MkgwdjExNC45MjJoMTcwMC4wNGwtNDc2LjQ2NiA0NzYuNDY1IDgxLjI1IDgxLjI1TDE5MjAgOTYwLjI5M3oiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPiA8L2c+Cg08L3N2Zz4=');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.5;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

/* Mobile: Map displays as last element */
@media (max-width: 767px) {
  #vlc-map-section, #oli-map-section, #far-map-section {
    margin-top: 15px;
    margin-bottom: 15px;
  }
}

/* Desktop: Map displays under video containers */
@media (min-width: 768px) {
  #vlc-map-section, #oli-map-section, #far-map-section {
    margin-top: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .vlc-map-wrapper, .oli-map-wrapper, .far-map-wrapper {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Chart Zoom Container */
.chart-zoom-container {
  position: relative;
  cursor: zoom-in;
  transition: transform 0.1s ease;
}

.chart-zoom-container.zooming {
  transform: scale(1.02);
}

.chart-zoom-container.zooming:active {
  transform: scale(0.98);
}

.chart-zoom-container img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  transition: transform 0.1s ease;
}

/* About Popup */
.about-popup {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.about-popup-content {
  background-color: #1a202c;
  margin: 5% auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.about-popup-close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #a0aec0;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
}

.about-popup-close:hover {
  color: white;
}

.about-popup h2 {
  color: white;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
}

.about-popup h3 {
  color: #e2e8f0;
  margin-top: 25px;
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 500;
}

.about-popup ul {
  padding-left: 20px;
  margin: 10px 0;
}

.about-popup li {
  color: #cbd5e0;
  margin-bottom: 8px;
  line-height: 1.5;
}

.about-popup li::marker {
  color: #718096;
}

.about-popup .highlight {
  color: #90cdf4;
  font-weight: 500;
}

.about-popup .section-frame {
  border: 1px solid #4a5568;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  background-color: rgba(45, 55, 72, 0.3);
}

.about-popup .section-frame h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #e2e8f0;
  font-size: 16px;
  font-weight: 600;
}

.about-popup p {
  color: #cbd5e0;
  line-height: 1.6;
  margin: 15px 0;
}

.about-popup p strong {
  color: #e2e8f0;
  font-weight: 600;
}

.about-popup .update-info {
  background-color: rgba(56, 178, 172, 0.1);
  border: 1px solid #38b2ac;
  border-radius: 6px;
  padding: 15px;
  margin: 20px 0;
}

.about-popup .update-info strong {
  color: #4fd1c7;
}

.about-popup * {
  box-sizing: border-box;
}

.about-popup h2,
.about-popup h3,
.about-popup p,
.about-popup li,
.about-popup div,
.about-popup span {
  text-align: left;
}

.about-popup h2,
.about-popup h3,
.about-popup .section-frame h3 {
  text-align: center;
}

/* Responsive adjustments for components */
@media (max-width: 767px) {
  .location-dropdown-wrapper {
    padding: 6px 10px;
    font-size: 14px;
  }
  
  .location-dropdown-display {
    font-size: 14px;
    min-width: 100px;
  }
  
  .about-popup-content {
    margin: 2% auto;
    padding: 20px;
    width: 95%;
    max-height: 90vh;
  }
  
  .about-popup h2 {
    font-size: 20px;
  }
  
  .about-popup h3 {
    font-size: 16px;
  }
}

/* Desktop header spacing: increase distance between location and update time */
@media (min-width: 768px) {
  .location-dropdown-wrapper {
    margin-right: 0; /* no extra margin on the location label */
  }
  .update-time {
    margin-left: 10px; /* exact 10px spacing from location */
  }
}

/* Mobile layout - page width and chart styling */
@media (max-width: 767px) {
  /* Fix page width to match chart images exactly */
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }
  
  .weather-section {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  
  .weather-container {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .weather-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    overflow: visible !important;
    min-height: auto !important;
    max-height: none !important;
  }
  
  .weather-item img {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 0px 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: block !important;
  }
  
.weather-info {
  width: auto !important;
  margin: 0 !important;
  padding: 15px !important;
  padding-top: 8px !important;
  box-sizing: border-box !important;
}

}
