/* Mobile-specific styles - Updated v2.1 */

/* Mobile-only elements - hidden by default */
.mobile-only {
  display: none;
}

/* Use single WindGuru container for both mobile and desktop */
#windguru-container {
  display: block !important;
}

/* Mobile styling */
@media (max-width: 767px) {
  #windguru-container {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  
  /* Hide desktop-specific containers */
  #desktop-windguru-container,
  .desktop-widget {
    display: none !important;
  }
}

/* Desktop styling */
@media (min-width: 768px) {
  #windguru-container {
    margin: 15px 0;
    padding: 0;
    width: 100%;
    display: block !important;
  }
  
  /* Show desktop video containers */
  #desktop-webcam-container,
  .desktop-widget {
    display: block !important;
  }
  
  /* Hide only the duplicate desktop windguru container */
  #desktop-windguru-container {
    display: none !important;
  }
}

@media (max-width: 767px) {
  /* Ensure WindGuru widget scales properly on mobile */
  #windguru-container iframe,
  #windguru-container table,
  #windguru-container div[id*="wg_fwdg_"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    transform: scale(1) !important;
  }
}

/* Full-bleed mobile video containers: stick to page borders */
@media (max-width: 767px) {
  #valencia-livecam-container,
  #pobla-livecam-container,
  #oliva-livecam-container {
    display: block;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
  }

  /* Inner wrappers override inline styles to remove margins and fill viewport */
  #valencia-container,
  #pobla-container,
  #oliva-container {
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    height: 200px !important; /* keep existing height */
  }

  /* Ensure the video fills full-bleed container */
  #valencia-container video,
  #pobla-container video,
  #oliva-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
}

/* Ensure mobile video containers are hidden on desktop */
@media (min-width: 768px) {
  .mobile-only {
    display: none !important;
  }
}

/* Mobile layout - show charts prominently with text below */
@media (max-width: 767px) {
  /* Force auto width for location text and wrapper */
  .location-dropdown-wrapper {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  #location-display.location-dropdown-display {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .weather-container {
    flex-direction: column;
    gap: 0;
    padding: 0;
  }
  
  .weather-item {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
  }
  
  /* Chart images should be prominent on mobile */
  .weather-item img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    margin: 0;
    border-radius: 0;
  }
  
  /* Weather info text below charts */
  .weather-info {
    width: 100%;
    text-align: left;
    margin: 0;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 14px;
    line-height: 1.4;
  }
}

/* Mobile video specific styling */
.mobile-video-container {
  width: 100%;
  margin-top: 10px;
  background-color: transparent;
}

/* Video container positioning */
#valencia-container,
#pobla-container,
#oliva-container {
  position: relative !important;
  width: 100% !important;
  height: 200px !important;
  background-color: #000 !important;
  border-radius: 0px !important;
  overflow: hidden !important;
}

#valencia-container video,
#pobla-container video,
#oliva-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
  background: #000 !important;
  padding-bottom: 5px;
}

/* Fullscreen video styling */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: black;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile fullscreen specific fixes */
.fullscreen-overlay video {
  width: 100vw !important;
  height: 100vh !important;
  object-fit: cover;
  border-radius: 0 !important;
}

/* Video styling - ensure no rounded corners and muted */
video {
  border-radius: 0 !important;
}

/* Video containers - ensure no rounded corners */
div[id*="-container"] video {
  border-radius: 0 !important;
}

/* All video-related elements - ensure no rounded corners */
video, 
video * {
  border-radius: 0 !important;
}

/* Video placeholder overlay - positioned over video */
.video-placeholder-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(8px) !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: white !important;
  z-index: 10 !important;
  transition: all 0.3s ease !important;
}

.video-placeholder-overlay:hover {
  background: rgba(15, 23, 42, 0.98) !important;
  transform: scale(1.01) !important;
}

.video-placeholder-overlay.hidden {
  display: none !important;
}

.video-placeholder-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0 !important;
}

/* Location indicator dots (mobile only) */
.location-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 1000;
}

.location-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.location-indicator .dot.active {
  background-color: white;
}

/* Debug info (mobile only) */
.debug-info {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 9999;
  display: none; /* Hidden by default */
}

/* Preloader */
.preloader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.preloader {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile responsive adjustments for header and dropdown */
@media (max-width: 767px) {
  h1 {
    height: 45px;
    padding: 10px 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    margin: 0;
    position: relative;
  }
  
  .weather-section {
    padding: 0;
    margin-top: 0;
  }
  
  /* Dropdown wrapper - just contains the location name */
  .location-dropdown-wrapper {
    background: transparent !important;
    margin: 0;
    padding: 0;
  }
  
  .location-dropdown-wrapper:hover {
    background: transparent !important;
    transform: none;
  }
  
  .location-dropdown-display {
    font-size: 18px;
    font-weight: normal;
    border-bottom: 1px solid white;
    padding-bottom: 1px;
    cursor: pointer;
    color: white;
  }
  
  .location-dropdown {
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
  }
  
  /* Update time - positioned next to location with proper styling */
  h1 .update-time {
    font-size: 10px !important;
    color: rgba(255, 255, 255, 0.7) !important;
    background: transparent !important;
    margin-left: 12px !important;
    margin-right: 0 !important;
    white-space: nowrap !important;
    padding: 0 !important;
    border: none !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
  }
  
  /* Right side buttons - properly centered in header */
  h1 .share-link {
    position: absolute !important;
    top: 50% !important;
    right: 45px !important;
    left: auto !important;
    width: 18px !important;
    height: 18px !important;
    transform: translateY(-50%) !important;
    opacity: 0.8 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  h1 .about-link {
    position: absolute !important;
    top: 50% !important;
    right: 15px !important;
    left: auto !important;
    width: 18px !important;
    height: 18px !important;
    transform: translateY(-50%) !important;
    opacity: 0.8 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}
