/* =========================================================================
   Astrokartografi · Klasik Astroloji 3D Harita
   Şira Nur Uysal · sirauysal.com
   ========================================================================= */

:root {
  --navy: #0A1628;
  --navy-soft: #1a2942;
  --navy-line: #2a3954;
  --gold: #C9A962;
  --gold-soft: #d4b97a;
  --gold-dim: #A08840;
  --cream: #F5F0E8;
  --cream-warm: #ede5d6;
  --shadow-md: 0 4px 20px rgba(10, 22, 40, 0.15);
  --shadow-lg: 0 8px 40px rgba(10, 22, 40, 0.25);
  --panel-w-left: 320px;
  --panel-w-right: 360px;
  --topbar-h: 56px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Klasik gezegen renkleri */
  --planet-sun: #C9A962;
  --planet-moon: #C0C0C0;
  --planet-mercury: #9370DB;
  --planet-venus: #7CB342;
  --planet-mars: #D32F2F;
  --planet-jupiter: #1E4D8B;
  --planet-saturn: #424242;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--sans);
  background: var(--navy);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-soft); }

/* ========== TOP BAR ========== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--navy);
  color: var(--cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
  border-bottom: 1px solid var(--navy-line);
}
.topbar .brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.5px;
}
.topbar .brand a { color: var(--gold); }
.topbar .brand .sub {
  color: var(--cream);
  font-weight: 400;
  font-size: 14px;
  margin-left: 8px;
}
.topbar .breadcrumbs {
  font-size: 12px;
  color: rgba(245, 240, 232, 0.65);
}
.topbar .breadcrumbs a { color: rgba(245, 240, 232, 0.65); }
.topbar .breadcrumbs a:hover { color: var(--gold); }
.topbar .breadcrumbs .sep { opacity: 0.5; margin: 0 6px; }

.topbar .actions { display: flex; gap: 8px; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--gold);
  color: var(--navy);
}

/* ========== LAYOUT ========== */
.layout {
  position: absolute;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: var(--panel-w-left) 1fr;
}

.panel-left {
  background: var(--cream);
  color: var(--navy);
  border-right: 1px solid var(--gold-soft);
  overflow-y: auto;
  padding: 20px 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}
.panel-left::-webkit-scrollbar { width: 6px; }
.panel-left::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

.panel-left h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.panel-left .lede {
  font-size: 13px;
  color: var(--navy-soft);
  margin-bottom: 18px;
  line-height: 1.6;
}

/* ========== FORM ========== */
.birth-form { display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--navy-soft);
  font-weight: 600;
}
.form-group .optional {
  text-transform: none;
  letter-spacing: 0;
  color: #999;
  font-weight: 400;
  font-size: 11px;
}
.form-group .required { color: var(--planet-mars); }
.form-group small {
  font-size: 11px;
  color: var(--navy-soft);
  line-height: 1.4;
  margin-top: 2px;
}

input[type="text"],
input[type="date"],
input[type="time"] {
  padding: 9px 11px;
  border: 1px solid #d8cdb9;
  background: white;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--navy);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, 0.2);
}

/* Autocomplete results */
.form-group { position: relative; }
.autocomplete-results {
  position: absolute;
  top: calc(100% - 18px);
  left: 0; right: 0;
  background: white;
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-md);
  margin-top: 4px;
}
.autocomplete-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--cream-warm);
  color: var(--navy);
}
.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--cream-warm);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item .country {
  color: #999;
  font-size: 11.5px;
  margin-left: 4px;
}

/* Fieldsets */
fieldset {
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  padding: 10px 12px 12px;
  margin: 0;
}
fieldset legend {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  padding: 0 6px;
}
fieldset label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  cursor: pointer;
  padding: 3px 0;
  color: var(--navy);
}
fieldset input[type="checkbox"],
fieldset input[type="radio"] {
  width: 14px; height: 14px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* Planet glyph colors */
.planet-glyph {
  display: inline-block;
  width: 18px;
  text-align: center;
  font-size: 14px;
}
.planet-glyph[data-color="sun"] { color: var(--planet-sun); }
.planet-glyph[data-color="moon"] { color: var(--planet-moon); }
.planet-glyph[data-color="mercury"] { color: var(--planet-mercury); }
.planet-glyph[data-color="venus"] { color: var(--planet-venus); }
.planet-glyph[data-color="mars"] { color: var(--planet-mars); }
.planet-glyph[data-color="jupiter"] { color: var(--planet-jupiter); }
.planet-glyph[data-color="saturn"] { color: var(--planet-saturn); }

.planet-filters,
.angle-filters,
.house-system {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Submit button */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 6px;
}
.btn-primary:hover { background: var(--gold-soft); }
.btn-primary:disabled {
  background: #b0a285;
  cursor: not-allowed;
}

/* Chart summary */
.chart-summary {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(201, 169, 98, 0.1);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
}
.chart-summary h3 {
  font-family: var(--serif);
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--navy);
}
.chart-summary dl { display: grid; grid-template-columns: 80px 1fr; gap: 4px 10px; font-size: 12px; }
.chart-summary dt { color: var(--navy-soft); font-weight: 600; }
.chart-summary dd { color: var(--navy); }

/* ========== PANEL FOOTER ========== */
.panel-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--gold-soft);
  font-size: 11px;
  color: var(--navy-soft);
  line-height: 1.55;
}
.panel-footer .legal {
  margin-top: 6px;
  font-style: italic;
}

/* ========== GLOBE CONTAINER ========== */
.globe-container {
  position: relative;
  background: var(--navy);
}
#cesiumContainer {
  width: 100%;
  height: 100%;
}
.cesium-viewer-bottom { display: none !important; }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  z-index: 10;
  color: var(--cream);
}
.loading-overlay.hidden { display: none; }
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(201, 169, 98, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cesium-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--cream);
  text-align: center;
  padding: 30px;
  z-index: 11;
}
.cesium-fallback p { margin: 6px 0; max-width: 380px; }

/* ========== INTERPRETATION PANEL ========== */
.panel-right {
  position: absolute;
  top: 0; right: 0;
  width: var(--panel-w-right);
  height: 100%;
  background: var(--cream);
  color: var(--navy);
  border-left: 1px solid var(--gold-soft);
  overflow-y: auto;
  z-index: 20;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
  transform: translateX(0);
  transition: transform 0.3s ease;
}
.panel-right[hidden] {
  display: block;
  transform: translateX(100%);
  pointer-events: none;
}
.panel-right .panel-header {
  position: sticky;
  top: 0;
  padding: 16px 20px 12px;
  background: var(--cream);
  border-bottom: 1px solid var(--gold-soft);
  z-index: 1;
}
.panel-right .panel-header h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--navy);
  padding-right: 30px;
}
.panel-right .distance {
  font-size: 11.5px;
  color: var(--navy-soft);
  font-style: italic;
  display: block;
  margin-top: 4px;
}
.close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--navy-soft);
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background 0.15s;
}
.close-btn:hover { background: rgba(0,0,0,0.06); }

.panel-right .panel-body { padding: 14px 20px 20px; }
.panel-right section {
  margin-bottom: 16px;
}
.panel-right h4 {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.panel-right p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--navy);
}
.panel-right ul {
  list-style: none;
  font-size: 12px;
  color: var(--navy);
}
.panel-right ul li {
  padding: 3px 0;
  border-bottom: 1px solid rgba(201, 169, 98, 0.2);
}
.panel-right blockquote {
  font-style: italic;
  color: var(--navy-soft);
  padding-left: 12px;
  border-left: 2px solid var(--gold);
  font-size: 12.5px;
  line-height: 1.6;
}
.panel-right cite {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--gold-dim);
  font-style: normal;
  letter-spacing: 0.4px;
}

/* ========== ONBOARDING MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.85);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-content {
  background: var(--cream);
  color: var(--navy);
  border-radius: 8px;
  padding: 32px 32px 28px;
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-content h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
}
.modal-content p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--navy);
  margin-bottom: 12px;
}
.epistemic-notice {
  background: rgba(201, 169, 98, 0.12);
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  margin: 18px 0 22px;
  border-radius: 2px;
}
.epistemic-notice h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}
.epistemic-notice p {
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--navy);
}
.epistemic-notice p:last-child { margin-bottom: 0; }

/* ========== MOBILE FAB ========== */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 800;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1023px) {
  :root { --panel-w-left: 280px; --panel-w-right: 320px; }
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .panel-left {
    position: absolute;
    top: var(--topbar-h);
    left: 0; right: 0;
    height: calc(100% - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 850;
    border-right: none;
    box-shadow: var(--shadow-lg);
  }
  .panel-left.open { transform: translateX(0); }
  .panel-right {
    width: 100%;
    max-height: 60vh;
    height: auto;
    bottom: 0;
    top: auto;
    border-left: none;
    border-top: 1px solid var(--gold-soft);
    transform: translateY(100%);
  }
  .panel-right[hidden] {
    transform: translateY(100%);
  }
  .panel-right.open {
    transform: translateY(0);
  }
  .topbar .breadcrumbs { display: none; }
  .mobile-fab { display: flex; align-items: center; justify-content: center; }

  /* Globe takes 55% viewport on mobile */
  .globe-container { height: 55vh; }
  body { overflow-y: auto; }
  html, body { height: auto; min-height: 100%; }
  .layout { height: auto; min-height: calc(100vh - var(--topbar-h)); }
}

/* ========== UTILITY ========== */
[hidden] { display: none !important; }


/* ========== MOBILE: yorum paneli alttan açılır ========== */
@media (max-width: 768px) {
  .panel-right {
    bottom: 0;
    top: auto;
    height: auto;
    max-height: 65vh;
    width: 100%;
    transform: translateY(100%);
    border-left: none;
    border-top: 1px solid var(--gold-soft);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
  }
  .panel-right:not([hidden]) {
    transform: translateY(0);
  }
  /* Mobile FAB pozisyonunu yorum paneli açıkken kaldır */
  .panel-right:not([hidden]) ~ .mobile-fab,
  .mobile-fab.behind-panel {
    opacity: 0;
    pointer-events: none;
  }
}

/* ========== MOBILE TOUCH UX ========== */
@media (hover: none) and (pointer: coarse) {
  .icon-btn, .btn-primary, .close-btn, .mobile-fab {
    min-height: 44px;
    min-width: 44px;
  }
  fieldset label {
    padding: 6px 0; /* daha kolay tap target */
  }
}


/* ========== MOD SEÇİCİ (V2) ========== */
.mode-selector {
  display: flex;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  background: rgba(10, 22, 40, 0.06);
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
}
.mode-btn {
  flex: 1;
  padding: 8px 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--navy-soft);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  text-transform: none;
}
.mode-btn:hover:not(:disabled) {
  background: rgba(201, 169, 98, 0.12);
  color: var(--navy);
}
.mode-btn.active {
  background: var(--navy);
  color: var(--gold);
  box-shadow: 0 1px 4px rgba(10, 22, 40, 0.25);
}
.mode-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ========== TIMELINE PANEL (V2) ========== */
.timeline-panel {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 60px));
  background: rgba(10, 22, 40, 0.92);
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  padding: 12px 18px;
  z-index: 30;
  color: var(--cream);
  display: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
.timeline-panel.active { display: block; }
.timeline-panel .timeline-title {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 8px;
}
.timeline-panel input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  margin-bottom: 8px;
}
.timeline-panel .timeline-date {
  text-align: center;
  font-family: 'SF Mono', monospace;
  font-size: 13px;
  color: var(--cream);
  letter-spacing: 0.5px;
}
.timeline-panel .timeline-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}
.timeline-panel .timeline-controls button {
  background: transparent;
  border: 1px solid var(--gold-soft);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--sans);
}
.timeline-panel .timeline-controls button:hover {
  background: var(--gold);
  color: var(--navy);
}

/* Mode-specific note */
.mode-note {
  font-size: 11px;
  color: var(--gold-dim);
  font-style: italic;
  padding: 8px 10px;
  background: rgba(201, 169, 98, 0.08);
  border-left: 2px solid var(--gold);
  margin-bottom: 14px;
  border-radius: 2px;
  display: none;
}
.mode-note.active { display: block; }

/* ========== Mobile timeline ========== */
@media (max-width: 768px) {
  .timeline-panel {
    width: calc(100% - 24px);
    bottom: 80px; /* yorum panelinin üstünde */
    padding: 10px 14px;
  }
}
