/* ===============================
   MAP TABS COMPONENT
   Reusable tabbed map interface
   Following Don Norman principles:
   - Clear affordances (tabs look clickable)
   - Visibility (active state clearly shown)
   - Feedback (smooth transitions, loading states)
   - Mapping (icons match content)
================================ */

.map-tabs-section {
  padding: var(--section-padding-y) var(--section-padding-x);
}

@media (max-width: 900px) {
  .map-tabs-section {
    padding: var(--section-padding-y-tablet) var(--section-padding-x-tablet);
  }
}

.map-tabs-container {
  max-width: 1400px;
  margin: 0 auto;
}

.map-tabs-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 3rem;
  text-align: center;
  color: currentColor;
}

@media (max-width: 900px) {
  .map-tabs-title {
    margin-bottom: 2rem;
  }
}

/* ===============================
   TAB NAVIGATION
   Clear affordances - tabs look clickable
================================ */

.map-tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 600px) {
  .map-tabs-nav {
    flex-direction: column;
    gap: 0;
    border-bottom: none;
  }
}

.map-tab-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: currentColor;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  opacity: 0.7;
  min-height: 44px; /* Touch target */
}

.map-tab-button:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

.map-tab-button:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.map-tab-button.active {
  opacity: 1;
  border-bottom-color: currentColor;
  background: rgba(0, 0, 0, 0.05);
  font-weight: 700;
}

.map-tab-button i {
  font-size: 1.2rem;
}

@media (max-width: 600px) {
  .map-tab-button {
    width: 100%;
    justify-content: center;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    border-left: 3px solid transparent;
    border-right: none;
    border-top: none;
  }
  
  .map-tab-button.active {
    border-left-color: currentColor;
    border-bottom-color: rgba(0, 0, 0, 0.1);
  }
}

/* ===============================
   TAB PANELS
   Visibility - only active panel shown
================================ */

.map-tabs-content {
  position: relative;
  min-height: 500px;
}

.map-tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.map-tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===============================
   MAP EMBED WRAPPER
   Responsive iframe/embed container
================================ */

.map-embed-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.05);
}

.map-embed-wrapper iframe,
.map-embed-wrapper embed,
.map-embed-wrapper object {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 16px;
}

/* Allow AllTrails embeds to be full height if needed */
.map-embed-wrapper > div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .map-embed-wrapper {
    padding-bottom: 75%; /* Taller on mobile */
  }
}

/* ===============================
   GPX DAY SELECTOR
   Per-day GPX tabs (Fredag, Lørdag, Søndag)
================================ */

.map-gpx-day-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.map-gpx-day-button {
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.05);
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: currentColor;
}

.map-gpx-day-button:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.25);
}

.map-gpx-day-button.active {
  background: rgba(0, 0, 0, 0.1);
  border-color: currentColor;
  font-weight: 700;
}

.map-gpx-day-panels {
  position: relative;
}

.map-gpx-day-panel {
  display: none;
}

.map-gpx-day-panel.active {
  display: block;
}

/* ===============================
   GPX MAP CONTAINER
   Leaflet map container
================================ */

.map-gpx-container {
  position: relative;
  width: 100%;
  height: 600px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  background: #f0f0f0;
}

@media (max-width: 900px) {
  .map-gpx-container {
    height: 500px;
  }
}

@media (max-width: 600px) {
  .map-gpx-container {
    height: 400px;
  }
}

/* Leaflet map styles */
.map-gpx-container .leaflet-container {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  font-family: inherit;
}

/* Loading state - Feedback */
.map-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: currentColor;
  opacity: 0.7;
}

.map-loading i {
  font-size: 2rem;
  animation: spin 1s linear infinite;
}

.map-loading span {
  font-size: 1rem;
  font-weight: 500;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Hide loading when map is loaded */
.map-gpx-container.map-loaded .map-loading {
  display: none;
}

/* ===============================
   ACCESSIBILITY
   Screen reader support
================================ */

.map-tab-panel[aria-hidden="true"] {
  display: none;
}

.map-tab-panel[aria-hidden="false"] {
  display: block;
}

/* ===============================
   ERROR STATES
   Feedback for errors
================================ */

.map-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  padding: 2rem;
  text-align: center;
  color: currentColor;
  opacity: 0.7;
}

.map-error i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--color-red, #840f27);
}

.map-error-message {
  font-size: 1.1rem;
  font-weight: 500;
}

