/* WaymoSTL Styles - Feed-based UI */

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

:root {
  --primary: #00d4aa;
  --primary-dark: #00a884;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1e2d50;
  --text: #ffffff;
  --text-muted: #8892b0;
  --danger: #ff6b6b;
  --waymo: #00d4aa;
  --cruise: #ff9f43;
  --tesla: #e74c3c;
  --other: #a29bfe;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app {
  position: relative;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* Map - takes upper portion */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 55%;
}

/* Header */
.header {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(22, 33, 62, 0.95);
  padding: 12px 18px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 212, 170, 0.2);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.header .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Tab Navigation */
.tabs {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 8px;
  background: rgba(22, 33, 62, 0.95);
  padding: 6px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 212, 170, 0.2);
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.tab:hover {
  background: rgba(0, 212, 170, 0.1);
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: var(--bg-dark);
}

.tab-icon {
  font-size: 14px;
}

.tab-label {
  font-weight: 500;
}

/* Feed Panel - bottom sheet style */
.feed-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: var(--bg-dark);
  border-radius: 24px 24px 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.feed-panel.hidden {
  display: none;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.feed-title {
  font-size: 16px;
  font-weight: 600;
}

.feed-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* Sightings Feed - horizontal scroll */
.feed-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.feed-scroll::-webkit-scrollbar {
  display: none;
}

.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--text-muted);
  font-size: 16px;
  gap: 8px;
}

.feed-empty-sub {
  font-size: 13px;
  opacity: 0.7;
}

/* Sighting Card */
.sighting-card {
  flex-shrink: 0;
  width: 160px;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  scroll-snap-align: start;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sighting-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.sighting-card:active {
  transform: scale(0.98);
}

.card-photo {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
}

.card-photo.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-dark) 100%);
}

.card-info {
  padding: 12px;
}

.card-type {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.card-type.waymo { background: var(--waymo); color: var(--bg-dark); }
.card-type.cruise { background: var(--cruise); color: var(--bg-dark); }
.card-type.tesla { background: var(--tesla); color: var(--text); }
.card-type.other { background: var(--other); color: var(--bg-dark); }

.card-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* News Feed - vertical scroll */
.news-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-loading {
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.news-card {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.news-card:hover {
  background: var(--bg-card-hover);
}

.news-thumb {
  width: 80px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.news-info {
  flex: 1;
  min-width: 0;
}

.news-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-source {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* About Panel */
.about-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.about-content h2 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 12px;
}

.about-content h3 {
  font-size: 16px;
  margin-top: 20px;
  margin-bottom: 8px;
}

.about-content p {
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 14px;
}

.about-content ul {
  list-style: none;
  margin-top: 8px;
}

.about-content li {
  margin-bottom: 8px;
}

.about-content a {
  color: var(--primary);
  text-decoration: none;
}

.about-content a:hover {
  text-decoration: underline;
}

/* FAB (Floating Action Button) */
.fab {
  position: absolute;
  bottom: calc(48% + 20px);
  right: 20px;
  z-index: 30;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg-dark);
  border: none;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.4);
  transition: all 0.2s ease;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0, 212, 170, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

.fab-icon {
  font-weight: 300;
  line-height: 1;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  border-radius: 20px;
  padding: 20px;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.close-btn:hover {
  color: var(--text);
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.photo-upload {
  position: relative;
}

.photo-upload input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.photo-preview {
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed rgba(0, 212, 170, 0.3);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-icon {
  font-size: 28px;
}

.preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.preview-img.hidden {
  display: none;
}

.location-display {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
}

.location-display .loading {
  color: var(--text-muted);
}

.location-display .coords {
  font-family: monospace;
  color: var(--primary);
}

select, textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
}

select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.form-submit {
  width: 100%;
  background: var(--primary);
  color: var(--bg-dark);
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.form-submit:hover {
  background: var(--primary-dark);
}

.form-submit:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

/* Detail Modal */
.detail-modal {
  max-width: 360px;
}

.detail-photo {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 16px;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-type {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  width: fit-content;
}

.detail-type.waymo { background: var(--waymo); color: var(--bg-dark); }
.detail-type.cruise { background: var(--cruise); color: var(--bg-dark); }
.detail-type.tesla { background: var(--tesla); color: var(--text); }
.detail-type.other { background: var(--other); color: var(--bg-dark); }

.detail-time {
  font-size: 13px;
  color: var(--text-muted);
}

.detail-notes {
  font-size: 14px;
  line-height: 1.5;
}

/* Map Pulse Marker (simple dot) */
.pulse-marker {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  border: 3px solid rgba(0, 212, 170, 0.4);
  box-shadow: 0 0 12px var(--primary);
  animation: pulse 2s ease-in-out infinite;
}

.pulse-marker.waymo { background: var(--waymo); box-shadow: 0 0 12px var(--waymo); }
.pulse-marker.cruise { background: var(--cruise); box-shadow: 0 0 12px var(--cruise); }
.pulse-marker.tesla { background: var(--tesla); box-shadow: 0 0 12px var(--tesla); }
.pulse-marker.other { background: var(--other); box-shadow: 0 0 12px var(--other); }

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
  }
}

/* Map error state */
.map-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-dark);
  color: var(--text-muted);
  font-size: 16px;
  gap: 8px;
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

.toast.success {
  border-left: 4px solid var(--primary);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

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

/* Mobile Responsive */
@media (max-width: 600px) {
  #map {
    height: 45%;
  }

  .feed-panel {
    height: 58%;
  }

  .header {
    top: 10px;
    left: 10px;
    padding: 10px 14px;
  }

  .header h1 {
    font-size: 16px;
  }

  .header .subtitle {
    display: none;
  }

  .tabs {
    top: 10px;
    right: 10px;
    padding: 4px;
    gap: 4px;
  }

  .tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .tab-label {
    display: none;
  }

  .tab-icon {
    font-size: 16px;
  }

  .fab {
    bottom: calc(58% + 16px);
    right: 16px;
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  .sighting-card {
    width: 140px;
  }

  .card-photo {
    height: 100px;
  }

  .feed-scroll {
    padding: 12px 16px;
    gap: 10px;
  }

  .modal {
    padding: 16px;
    border-radius: 16px;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  #map {
    height: 40%;
  }

  .feed-panel {
    height: 63%;
  }

  .fab {
    bottom: calc(63% + 12px);
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .sighting-card {
    width: 130px;
  }

  .card-photo {
    height: 90px;
  }
}
