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

html, body {
  height: 100%;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  background: #FAFAF8;
}

#search-container {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  width: 50vw;
}

#search-bar {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

#search-input {
  flex-grow: 1;
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: none;
  outline: none;
  background: #fff;
  color: #222;
}

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

#search-btn {
  padding: 10px 14px;
  font-size: 15px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#search-btn:hover {
  background: #1d4ed8;
}

#favorites-btn {
  padding: 10px 14px;
  font-size: 18px;
  border: none;
  cursor: pointer;
  background: #f59e0b;
  color: #fff;
  font-weight: 600;
  transition: background 0.15s;
}

#favorites-btn:hover {
  background: #d97706;
}

#camera-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: none;
  background: #000;
  color: #fff;
  z-index: 2000;
  padding: 0;
}

#camera-modal[open] {
  display: block;
}

#camera-modal::backdrop {
  background: transparent;
}

#modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  z-index: 1;
  border-radius: 4px;
  padding: 4px 8px;
}

#modal-fav-btn {
  position: absolute;
  bottom: 24px;
  right: calc(50% + 4px);
  font-size: 28px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s, border-color 0.15s;
}

#modal-fav-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.65);
}

#modal-fav-btn.is-favorite {
  color: #f59e0b;
  border-color: #f59e0b;
}

#modal-share-btn {
  position: absolute;
  bottom: 24px;
  left: calc(50% + 4px);
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s, border-color 0.15s;
}

#modal-share-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.65);
}

#modal-share-btn.copied {
  border-color: #22c55e;
  color: #22c55e;
}

#modal-body {
  position: relative;
  width: 100%;
  height: 100%;
}

#modal-body video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

#video-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#video-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#video-caption {
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  font-family: monospace;
}

#video-status {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  font-family: monospace;
  min-height: 1.4em;
}

#video-delay-warning {
  position: absolute;
  bottom: 90px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-family: sans-serif;
  pointer-events: none;
}

#video-delay-warning[hidden] {
  display: none;
}

/* --- Search results dropdown --- */

#search-results {
  background: #fff;
  max-height: 300px;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  margin-top: 2px;
  font-family: sans-serif;
}

#search-results[hidden] {
  display: none;
}

.search-section-label {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-section-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(136, 136, 136, 0.3);
  border-top-color: #888;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.search-result-item {
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f0f4ff;
}

.search-result-item .result-name {
  flex: 1;
  font-size: 15px;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item .result-type {
  font-size: 12px;
  color: #999;
  flex-shrink: 0;
}

/* --- Favorites dropdown --- */

#favorites-results {
  background: #fff;
  max-height: 300px;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  margin-top: 2px;
  margin-left: auto;
  width: 260px;
  font-family: sans-serif;
}

#favorites-results[hidden] {
  display: none;
}

/* --- Bottom action bar --- */

#bottom-actions {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

#map-share-btn {
  background: #fff;
  color: #333;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
}

#map-share-btn:hover {
  background: #f0f4ff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

#map-share-btn.copied {
  color: #16a34a;
}

#update-btn {
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
}

#update-btn:hover {
  background: #ea6c0a;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

#update-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

#update-btn[hidden] {
  display: none;
}
