/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sun: #f59e0b;
  --sun-glow: #fbbf24;
  --bg: #0f172a;
  --card: #1e293b;
  --card2: #334155;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --good: #22c55e;
  --ok: #f59e0b;
  --bad: #ef4444;
  --radius: 16px;
}

html {
  font-size: 16px;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html[dir="rtl"] body {
  direction: rtl;
}

/* ── Language bar ── */
.lang-bar {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 10px 16px 0;
}
.lang-btn {
  background: var(--card);
  color: var(--text2);
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  min-height: 36px;
  transition: all 0.2s;
}
.lang-btn.active {
  background: var(--sun);
  color: #000;
  font-weight: 600;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 20px 16px 10px;
}
.hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
}
.tagline {
  color: var(--text2);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ── Search ── */
.search-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  max-width: 500px;
  margin: 0 auto;
}
.search-bar input {
  flex: 1;
  background: var(--card);
  border: 2px solid var(--card2);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  min-height: 48px;
}
.search-bar input:focus {
  border-color: var(--sun);
}
.gps-btn,
.search-btn {
  background: var(--card);
  border: 2px solid var(--card2);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 1.2rem;
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}
.gps-btn:hover,
.search-btn:hover {
  border-color: var(--sun);
}

/* ── Map ── */
.map-wrap {
  position: relative;
  margin: 10px 16px;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
#map {
  width: 100%;
  height: 350px;
  background: var(--card);
}

/* ── Sun badge (floats on map) ── */
.sun-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 2px solid var(--sun);
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
html[dir="rtl"] .sun-badge {
  right: auto;
  left: 12px;
}
.sun-hours {
  font-size: 2rem;
  font-weight: 800;
  color: var(--sun);
  line-height: 1;
}
.sun-label {
  font-size: 0.7rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Arrow hint ── */
.arrow-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.82rem;
  color: var(--sun-glow);
  pointer-events: none;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chips ── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  justify-content: center;
  max-width: 600px;
  margin: 0 auto;
}
.chip {
  background: var(--card);
  color: var(--text2);
  border: 2px solid var(--card2);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s;
  user-select: none;
}
.chip.active {
  background: var(--sun);
  color: #000;
  border-color: var(--sun);
  font-weight: 600;
}

/* ── Date row ── */
.date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  max-width: 400px;
  margin: 0 auto;
  justify-content: center;
}
.date-row label {
  color: var(--text2);
  font-size: 0.9rem;
}
.date-row input {
  background: var(--card);
  border: 2px solid var(--card2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  outline: none;
  min-height: 44px;
}
.date-row input:focus {
  border-color: var(--sun);
}

/* ── Report ── */
.report {
  max-width: 600px;
  margin: 10px auto;
  padding: 0 16px 40px;
}

/* ── Verdict ── */
.verdict-card {
  text-align: center;
  padding: 24px 16px;
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 14px;
}
.verdict-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
}
.verdict-emoji {
  font-size: 3rem;
}
.score-ring {
  position: relative;
  width: 72px;
  height: 72px;
}
.score-ring svg {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
}
.score-bg {
  fill: none;
  stroke: var(--card2);
  stroke-width: 6;
}
.score-fill {
  fill: none;
  stroke: var(--sun);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}
.score-num {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sun);
}
.score-of {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 40%);
  font-size: 0.65rem;
  color: var(--text2);
}
.verdict-text {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 8px;
}
.verdict-sub {
  color: var(--text2);
  font-size: 0.9rem;
  margin-top: 4px;
}
.verdict-card.good {
  border: 2px solid var(--good);
}
.verdict-card.ok {
  border: 2px solid var(--ok);
}
.verdict-card.bad {
  border: 2px solid var(--bad);
}

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-icon {
  font-size: 1.3rem;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text2);
  text-align: center;
  line-height: 1.2;
}

/* ── Direction card ── */
.direction-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.direction-icon {
  font-size: 1.4rem;
}

/* ── Morning vs Afternoon ── */
.period-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.period-card h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text2);
}
.period-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.period-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.period-side.right {
  align-items: center;
}
.period-label {
  font-size: 0.72rem;
  color: var(--text2);
}
.period-hours {
  font-size: 1rem;
  font-weight: 700;
}
.period-bar {
  flex: 1;
  height: 24px;
  background: var(--card2);
  border-radius: 12px;
  display: flex;
  overflow: hidden;
}
.period-fill {
  height: 100%;
  transition: width 0.4s ease;
}
.morning-fill {
  background: #f97316;
  border-radius: 12px 0 0 12px;
}
.afternoon-fill {
  background: #8b5cf6;
  border-radius: 0 12px 12px 0;
}
.peak-info {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text2);
  text-align: center;
}

/* ── Season comparison ── */
.season-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.season-card h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text2);
}
.season-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}
.season-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  background: var(--card2);
}
.season-emoji {
  font-size: 1.4rem;
}
.season-name {
  font-size: 0.7rem;
  color: var(--text2);
}
.season-hours {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sun);
}
.season-item.best {
  border: 2px solid var(--sun);
  background: rgba(245, 158, 11, 0.1);
}

/* ── Tips ── */
.tips-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.tips-card h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text2);
}
.tips-list {
  list-style: none;
  padding: 0;
}
.tips-list li {
  padding: 6px 0;
  font-size: 0.88rem;
  color: var(--text);
  border-bottom: 1px solid var(--card2);
  line-height: 1.4;
}
.tips-list li:last-child {
  border-bottom: none;
}

/* ── Sun timeline ── */
.timeline-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.timeline-section h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text2);
}
.timeline {
  display: flex;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  gap: 1px;
}
.timeline .t-block {
  flex: 1;
  transition: background 0.3s;
}
.t-block.sun-on {
  background: var(--sun);
}
.t-block.sun-off {
  background: var(--card2);
}
.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text2);
  margin-top: 4px;
  padding: 0 2px;
}

/* ── Humidity ── */
.humidity-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.humidity-icon {
  font-size: 1.4rem;
}

/* ── Chart ── */
.chart-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.chart-section h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text2);
}
#chart {
  width: 100%;
  height: auto;
}

/* ── Sides detail (two sides) ── */
.sides-detail {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.sides-detail > h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text2);
}

/* Combined summary */
.sides-summary {
  text-align: center;
  padding: 10px;
  margin-bottom: 12px;
  background: var(--card2);
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--text2);
  line-height: 1.5;
}
.sides-summary strong {
  color: var(--sun);
}

/* Side panels */
.side-panel {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 2px solid var(--card2);
}
.side-panel:last-child {
  margin-bottom: 0;
}

.side-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.92rem;
}
.side-a-header {
  background: rgba(245, 158, 11, 0.1);
}
.side-b-header {
  background: rgba(139, 92, 246, 0.1);
}

.side-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.side-a-dot {
  background: #f59e0b;
}
.side-b-dot {
  background: #8b5cf6;
}

.side-panel-title {
  color: var(--text);
}
.side-panel-color {
  font-size: 0.75rem;
  color: var(--text2);
  font-weight: 400;
}
.side-badge {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
html[dir="rtl"] .side-badge {
  margin-left: 0;
  margin-right: auto;
}
.side-badge.good {
  background: var(--good);
  color: #000;
}
.side-badge.ok {
  background: var(--ok);
  color: #000;
}
.side-badge.bad {
  background: var(--bad);
  color: #fff;
}
.side-badge.best {
  background: var(--sun);
  color: #000;
}

.side-panel-body {
  padding: 12px 14px;
}

.side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.side-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.side-stat-label {
  font-size: 0.7rem;
  color: var(--text2);
}
.side-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.side-period {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--text2);
}
.side-period strong {
  color: var(--text);
}

.side-timeline-wrap {
  margin-bottom: 8px;
}
.side-timeline {
  height: 20px;
  border-radius: 6px;
}

.side-humidity {
  font-size: 0.82rem;
  text-align: center;
  padding: 6px 0;
  color: var(--text2);
}

/* ── Leaflet custom arrow marker ── */
.arrow-marker {
  width: 80px;
  height: 80px;
  position: relative;
  cursor: grab;
}
.arrow-marker:active {
  cursor: grabbing;
}
.arrow-marker svg {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

/* rotation handle ring around arrow */
.rotation-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%);
  border: 3px dashed rgba(245, 158, 11, 0.4);
  border-radius: 50%;
  pointer-events: none;
}

/* ── Mobile ── */
@media (max-width: 540px) {
  .hero h1 {
    font-size: 1.3rem;
  }
  .tagline {
    font-size: 0.85rem;
  }
  #map {
    height: 300px;
  }
  .arrow-hint {
    font-size: 0.75rem;
  }
  .verdict-emoji {
    font-size: 2.4rem;
  }
  .verdict-text {
    font-size: 1.1rem;
  }
  .score-ring {
    width: 60px;
    height: 60px;
  }
  .score-ring svg {
    width: 60px;
    height: 60px;
  }
  .score-num {
    font-size: 1.2rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-value {
    font-size: 1rem;
  }
  .season-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .period-side {
    min-width: 50px;
  }
}

@media (max-width: 380px) {
  #map {
    height: 260px;
  }
  .chip {
    font-size: 0.82rem;
    padding: 6px 12px;
  }
  .stats-grid {
    gap: 6px;
  }
  .stat-card {
    padding: 10px 8px;
  }
}

/* ── SEO Content (visible to crawlers, subtle to users) ── */
.seo-content {
  max-width: 600px;
  margin: 30px auto;
  padding: 20px 16px;
  color: var(--text2);
  font-size: 0.85rem;
  line-height: 1.6;
}
.seo-content h2 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 8px;
}
.seo-content h3 {
  font-size: 0.95rem;
  color: var(--text);
  margin: 16px 0 6px;
}
.seo-content p {
  margin-bottom: 8px;
}
.seo-content ul {
  padding-left: 20px;
  margin-bottom: 8px;
}
.seo-content li {
  margin-bottom: 3px;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 24px 16px 32px;
  color: var(--text2);
  font-size: 0.82rem;
  border-top: 1px solid var(--card2);
  max-width: 600px;
  margin: 10px auto 0;
}
.footer-sub {
  margin-top: 4px;
  font-size: 0.72rem;
  opacity: 0.7;
}
