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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  background: #f8f9fa;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Search Bar */
#search-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 24px);
  max-width: 720px;
}

#search-container {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 28px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.1);
  padding: 0 8px 0 16px;
  height: 48px;
  transition: box-shadow 0.2s;
}

#search-container:focus-within {
  box-shadow: 0 4px 12px rgba(0,0,0,0.2), 0 2px 4px rgba(0,0,0,0.1);
}

#search-container:focus-within + #search-results:not(:empty) {
  display: block;
}

#search-icon {
  flex-shrink: 0;
  margin-right: 8px;
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: #202124;
  background: transparent;
}

#search-input::placeholder {
  color: #9aa0a6;
}

#locate-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#locate-btn:hover {
  background: #f1f3f4;
}

/* Search Results Dropdown */
#search-results {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  margin-top: 4px;
  max-height: 320px;
  overflow-y: auto;
}

#search-results.hidden {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f5f5f5;
}

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

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

.search-result-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.search-result-text {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-address {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-loading {
  padding: 16px;
  text-align: center;
  color: #5f6368;
  font-size: 13px;
}

/* Sun Banner */
#sun-banner {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 480px;
}

#sun-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  border: 1px solid #ffe082;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #5d4037;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
}

#sun-banner-content.future {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border-color: #90caf9;
  color: #1565c0;
}

#sun-banner-content.night {
  background: linear-gradient(135deg, #263238, #37474f);
  color: #b0bec5;
  border-color: #455a64;
}

#sun-icon-banner {
  font-size: 16px;
}

/* Map */
#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.leaflet-control-attribution {
  font-size: 10px !important;
  opacity: 0.7;
}

/* Loading Overlay */
#loading-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: white;
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#loading-overlay.hidden {
  display: none;
}

#loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: #ff9800;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#loading-text {
  font-size: 14px;
  color: #5f6368;
  font-weight: 500;
}

/* Custom Markers */
.patio-marker {
  position: relative;
  cursor: pointer;
  transition: transform 0.15s;
}

.patio-marker:hover {
  transform: scale(1.15);
}

.marker-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  position: relative;
}

.marker-dot.sunny {
  background: linear-gradient(135deg, #ff9800, #f57c00);
}

.marker-dot.partial {
  background: linear-gradient(135deg, #ffc107, #ff9800);
}

.marker-dot.shade {
  background: linear-gradient(135deg, #90a4ae, #607d8b);
}

.marker-dot.soon {
  background: linear-gradient(135deg, #ffca28, #ffa726);
}

.marker-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  color: #333;
}

.marker-sun-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4caf50;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

/* Time Slider */
#time-slider-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: white;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
  padding: 10px 16px 14px;
  transition: transform 0.3s;
}

#time-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.time-btn {
  background: #e8f0fe;
  color: #1a73e8;
  border: none;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.time-btn:hover {
  background: #d2e3fc;
}

.time-btn.active {
  background: #1a73e8;
  color: white;
}

.time-btn.hidden {
  visibility: hidden;
}

#time-display {
  text-align: center;
  flex: 1;
}

#time-display-date {
  font-size: 12px;
  color: #5f6368;
}

#time-display-time {
  font-size: 16px;
  font-weight: 700;
  color: #202124;
  margin-left: 6px;
}

#time-slider-track {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
}

#time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  position: relative;
  z-index: 2;
}

#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff9800;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: grab;
  transition: transform 0.1s;
}

#time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

#time-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

#time-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff9800;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: grab;
}

#time-slider-progress {
  position: absolute;
  top: 50%;
  left: 0;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff9800, #ffc107);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

#time-ticks {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 6px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 0;
}

.time-tick {
  position: absolute;
  top: -4px;
  width: 1px;
  height: 14px;
  background: #ccc;
}

.time-tick.day-start {
  width: 2px;
  height: 18px;
  top: -6px;
  background: #999;
}

#time-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  padding: 0 2px;
}

.time-label {
  font-size: 10px;
  color: #9aa0a6;
  font-weight: 500;
}

.time-label.day-label {
  font-weight: 700;
  color: #5f6368;
}

/* Bottom Sheet */
#bottom-sheet {
  position: absolute;
  bottom: 94px;
  left: 0;
  right: 0;
  z-index: 1000;
  background: white;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 55vh;
  display: flex;
  flex-direction: column;
}

#bottom-sheet.collapsed {
  transform: translateY(calc(100% - 110px));
}

#bottom-sheet.fully-collapsed {
  transform: translateY(calc(100% - 20px));
}

#bottom-sheet.expanded {
  transform: translateY(0);
}

#sheet-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
}

#handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #dadce0;
}

#sheet-content {
  padding: 0 16px 16px;
  overflow-y: auto;
  flex: 1;
}

#sheet-header {
  margin-bottom: 12px;
}

#sheet-title {
  font-size: 18px;
  font-weight: 600;
  color: #202124;
}

#sheet-subtitle {
  font-size: 13px;
  color: #5f6368;
  margin-top: 2px;
}

/* Filter Chips */
#filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  border: 1px solid #dadce0;
  background: white;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: #3c4043;
  transition: all 0.15s;
}

.filter-chip:hover {
  background: #f1f3f4;
}

.filter-chip.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #1a73e8;
}

/* Patio List */
#patio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.patio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid #f1f3f4;
}

.patio-card:hover {
  background: #f8f9fa;
}

.patio-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.patio-card-icon.sunny {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
}

.patio-card-icon.shade {
  background: linear-gradient(135deg, #eceff1, #cfd8dc);
}

.patio-card-icon.soon {
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
}

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

.patio-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patio-card-meta {
  font-size: 12px;
  color: #5f6368;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.patio-card-address {
  font-size: 11px;
  color: #80868b;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patio-card-sun {
  text-align: right;
  flex-shrink: 0;
}

.sun-time-left {
  font-size: 14px;
  font-weight: 700;
}

.sun-time-left.sunny {
  color: #e65100;
}

.sun-time-left.shade {
  color: #607d8b;
}

.sun-time-left.soon {
  color: #f9a825;
}

.sun-label {
  font-size: 11px;
  color: #5f6368;
}

/* Detail Panel */
#detail-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  background: white;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

#detail-panel.visible {
  transform: translateX(0);
}

#detail-panel.hidden {
  transform: translateX(100%);
}

#detail-close {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 16px;
  background: white;
  border: none;
  border-bottom: 1px solid #f1f3f4;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  color: #1a73e8;
  font-weight: 500;
  z-index: 1;
}

#detail-content {
  padding: 16px;
}

.detail-hero {
  text-align: center;
  padding: 20px 0;
}

.detail-hero-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.detail-hero h2 {
  font-size: 22px;
  color: #202124;
  margin-bottom: 4px;
}

.detail-hero-type {
  font-size: 14px;
  color: #5f6368;
}

.detail-hero-address {
  font-size: 13px;
  color: #80868b;
  margin-top: 4px;
}

.detail-sun-status {
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  border-radius: 16px;
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}

.detail-sun-status.shade {
  background: linear-gradient(135deg, #eceff1, #e0e0e0);
}

.detail-sun-status.future {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
}

.detail-sun-big {
  font-size: 32px;
  font-weight: 800;
  color: #e65100;
}

.detail-sun-status.shade .detail-sun-big {
  color: #455a64;
}

.detail-sun-status.future .detail-sun-big {
  color: #1565c0;
}

.detail-sun-desc {
  font-size: 14px;
  color: #5d4037;
  margin-top: 4px;
}

.detail-sun-status.shade .detail-sun-desc {
  color: #546e7a;
}

.detail-sun-status.future .detail-sun-desc {
  color: #1976d2;
}

/* Sun Timeline */
.sun-timeline {
  margin: 20px 0;
}

.sun-timeline h3 {
  font-size: 15px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 12px;
}

.timeline-bar-container {
  position: relative;
  height: 40px;
  background: #f1f3f4;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.timeline-sun-segment {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 4px;
}

.timeline-sun-segment.full-sun {
  background: linear-gradient(180deg, #ffb74d, #ff9800);
}

.timeline-sun-segment.partial-sun {
  background: linear-gradient(180deg, #ffe082, #ffca28);
}

.timeline-now-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 48px;
  background: #d32f2f;
  border-radius: 2px;
  z-index: 2;
}

.timeline-now-label {
  position: absolute;
  top: -20px;
  font-size: 10px;
  font-weight: 700;
  color: #d32f2f;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-selected-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 48px;
  background: #1a73e8;
  border-radius: 2px;
  z-index: 2;
}

.timeline-selected-label {
  position: absolute;
  top: -20px;
  font-size: 10px;
  font-weight: 700;
  color: #1a73e8;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9aa0a6;
}

/* 3-Day Forecast */
.forecast-section {
  margin: 20px 0;
}

.forecast-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 12px;
}

.forecast-day {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f4;
}

.forecast-day:last-child {
  border-bottom: none;
}

.forecast-day-name {
  width: 80px;
  font-size: 14px;
  font-weight: 500;
  color: #202124;
}

.forecast-bar-wrap {
  flex: 1;
  height: 24px;
  background: #f1f3f4;
  border-radius: 6px;
  overflow: hidden;
}

.forecast-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.forecast-bar-fill.high {
  background: linear-gradient(90deg, #ff9800, #ff6d00);
}

.forecast-bar-fill.medium {
  background: linear-gradient(90deg, #ffca28, #ff9800);
}

.forecast-bar-fill.low {
  background: linear-gradient(90deg, #90a4ae, #b0bec5);
}

.forecast-hours {
  width: 60px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: #202124;
}

.forecast-cloud {
  font-size: 11px;
  color: #9aa0a6;
  width: 40px;
  text-align: center;
}

.detail-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
  color: #3c4043;
}

.detail-info-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.directions-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.directions-btn:hover {
  background: #1557b0;
}

.gmaps-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: #f8f9fa;
  color: #1a73e8;
  border: 1px solid #dadce0;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.gmaps-link:hover {
  background: #e8f0fe;
}

/* Responsive */
@media (min-width: 768px) {
  #bottom-sheet {
    left: 12px;
    right: auto;
    width: 380px;
    bottom: 100px;
    border-radius: 16px;
    max-height: calc(100vh - 200px);
  }

  #bottom-sheet.collapsed {
    transform: translateY(calc(100% - 140px));
  }

  #bottom-sheet.fully-collapsed {
    transform: translateY(calc(100% - 20px));
  }

  #detail-panel {
    left: auto;
    right: 0;
    width: 400px;
    border-left: 1px solid #e0e0e0;
    box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  }
}

@keyframes sunGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,152,0,0.4); }
  50% { box-shadow: 0 0 16px rgba(255,152,0,0.7); }
}

.marker-dot.sunny {
  animation: sunGlow 2s ease-in-out infinite;
}
