/* 
 * Kirimure - Solar Trajectory & World Ephemeris Studio
 * Kirimure Design System
 */

:root {
  --oceano-azul: #2c4f6e;
  --oceano-profundo: #152538;
  --por-do-sol-farol: #d3a859;
  --por-do-sol-glow: rgba(211, 168, 89, 0.28);
  --areia-fina: #e8d4b8;
  --espuma-da-onda: #dce5e8;
  --crista-da-onda: #f5f4f0;
  --renda: #ffffff;
  
  --noite-salvador: #1a2a3a;
  --noite-espaco: #0b141e;
  --entardecer-ondina: #4a5568;
  --chuva-em-salvador: #718096;

  --color-primary: var(--oceano-azul);
  --color-primary-glow: rgba(44, 79, 110, 0.12);
  --color-secondary: var(--por-do-sol-farol);
  --color-secondary-glow: rgba(211, 168, 89, 0.16);
  
  --color-success: #1e6b54;
  --color-success-glow: rgba(30, 107, 84, 0.15);
  --color-error: #b23a48;
  --color-error-glow: rgba(178, 58, 72, 0.15);
  --color-warning: #c68a4c;
  
  --text-bright: var(--noite-salvador);
  --text-main: var(--entardecer-ondina);
  --text-muted: var(--chuva-em-salvador);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-title: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-smooth: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.07);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.14);
  --shadow-card: 0 4px 24px rgba(44,79,110,.08);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

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

body {
  background-color: var(--crista-da-onda);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Glows */
body::before, body::after {
  content: '';
  position: absolute;
  width: 45vw;
  height: 45vw;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
}

body::before {
  top: -12vw;
  left: -10vw;
  background: var(--oceano-azul);
}

body::after {
  bottom: -10vw;
  right: -10vw;
  background: var(--por-do-sol-farol);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--crista-da-onda);
}
::-webkit-scrollbar-thumb {
  background: var(--espuma-da-onda);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--chuva-em-salvador);
}

/* App Container */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(220, 229, 232, 0.85);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.header-brand-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand h1 {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  line-height: 1;
}

.logo-dot {
  color: var(--por-do-sol-farol);
  font-size: 2.2rem;
  line-height: 0;
  display: inline-block;
  margin-left: 1px;
}

/* Header Controls & Nav */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Top Navigation Location Picker */
.location-picker-wrap {
  display: flex;
  align-items: center;
  background: var(--crista-da-onda);
  border: 1px solid var(--espuma-da-onda);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.45rem;
  gap: 0.4rem;
}

.location-picker-wrap label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  user-select: none;
  padding-left: 0.2rem;
}

.city-select {
  background: white;
  border: 1px solid var(--espuma-da-onda);
  border-radius: 4px;
  padding: 0.28rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-bright);
  outline: none;
  cursor: pointer;
  max-width: 220px;
  transition: var(--transition-smooth);
}

.city-select:focus {
  border-color: var(--oceano-azul);
  box-shadow: 0 0 0 2px var(--color-primary-glow);
}

.btn-gps-nav {
  background: white;
  border: 1px solid var(--espuma-da-onda);
  border-radius: 4px;
  padding: 0.28rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--oceano-azul);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-smooth);
  white-space: nowrap;
}

.btn-gps-nav:hover {
  background: var(--espuma-da-onda);
  border-color: var(--oceano-azul);
}

.btn-gps-nav svg {
  width: 12px;
  height: 12px;
}

/* Date Picker Wrap */
.date-picker-wrap {
  display: flex;
  align-items: center;
  background: var(--crista-da-onda);
  border: 1px solid var(--espuma-da-onda);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.45rem;
  gap: 0.35rem;
}

.date-picker-wrap label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  user-select: none;
  padding-left: 0.2rem;
}

.input-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-bright);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
}

.btn-nav-day {
  background: white;
  border: 1px solid var(--espuma-da-onda);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: var(--transition-smooth);
}
.btn-nav-day:hover {
  background: var(--espuma-da-onda);
  color: var(--oceano-azul);
}

/* Language selector */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--crista-da-onda);
  border: 1px solid var(--espuma-da-onda);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
}

.lang-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.lang-btn.active {
  color: var(--oceano-azul);
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.lang-sep {
  color: var(--espuma-da-onda);
  font-size: 0.75rem;
}

/* Presets & View Controls Bar */
.control-subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(220, 229, 232, 0.75);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.preset-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.subbar-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  margin-right: 0.25rem;
}

.btn-chip {
  background: white;
  border: 1px solid var(--espuma-da-onda);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-smooth);
}

.btn-chip:hover {
  background: var(--crista-da-onda);
  border-color: var(--por-do-sol-farol);
  color: var(--text-bright);
}

.btn-chip.active {
  background: var(--oceano-azul);
  border-color: var(--oceano-azul);
  color: white;
}

.view-toggles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.segmented-control {
  display: inline-flex;
  background: var(--espuma-da-onda);
  padding: 3px;
  border-radius: 999px;
}

.seg-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.seg-btn.active {
  background: white;
  color: var(--oceano-azul);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Map Studio Canvas Card */
.map-workspace-card {
  background: white;
  border: 1px solid rgba(220, 229, 232, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  min-height: 380px;
  max-height: 640px;
  background-color: var(--noite-espaco);
  overflow: hidden;
  cursor: crosshair;
}

#map-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Map HUD Overlays */
.map-hud-top {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hud-pill {
  background: rgba(15, 27, 40, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e9ee;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
}

.hud-pill-sun {
  border-color: rgba(211, 168, 89, 0.4);
  background: rgba(25, 25, 30, 0.85);
  color: #ffe6a3;
}

.hud-pill-sun .sun-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--por-do-sol-farol);
  box-shadow: 0 0 10px #ffc107, 0 0 18px #ff9800;
  display: inline-block;
  animation: pulse-sun 1.6s infinite alternate;
}

@keyframes pulse-sun {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 1; }
}

.map-hud-bottom {
  position: absolute;
  bottom: 0.85rem;
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 10;
}

.hud-legend {
  display: flex;
  gap: 0.75rem;
  pointer-events: auto;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 27, 40, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  color: #ccd5df;
}

.legend-color-box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.cursor-inspect-hud {
  background: rgba(15, 27, 40, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  pointer-events: auto;
  text-align: right;
  line-height: 1.35;
}

/* Timeline / Time Scrubber Controls Block */
.timeline-deck {
  background: #fcfbf8;
  border-top: 1px solid rgba(220, 229, 232, 0.8);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.timeline-row-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-play-pause {
  background: var(--oceano-azul);
  color: white;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(44, 79, 110, 0.25);
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.btn-play-pause:hover {
  background: #1e3850;
  transform: scale(1.05);
}

.btn-play-pause svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.slider-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #152538 0%, #2c4f6e 25%, #d3a859 50%, #2c4f6e 75%, #152538 100%);
  outline: none;
  cursor: pointer;
  transition: background 0.3s;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--por-do-sol-farol);
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
  cursor: grab;
  transition: transform 0.15s, border-color 0.2s;
}

.time-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.25);
  border-color: #ff9800;
}

.time-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--por-do-sol-farol);
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
  cursor: grab;
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  user-select: none;
}

.time-badge-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.time-badge {
  background: white;
  border: 1px solid var(--espuma-da-onda);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.time-badge-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: block;
}

.time-badge-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
}

/* Secondary Timeline Row: Speeds & Quick Toggles */
.timeline-row-secondary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.speed-control-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-speed {
  background: white;
  border: 1px solid var(--espuma-da-onda);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-speed.active {
  background: var(--oceano-azul);
  border-color: var(--oceano-azul);
  color: white;
}

.layer-toggles {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--oceano-azul);
  cursor: pointer;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* Cards */
.card {
  background: white;
  border: 1px solid rgba(220, 229, 232, 0.85);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
}

.card-title svg {
  width: 20px;
  height: 20px;
  color: var(--oceano-azul);
}

/* Observer Summary Banner inside Card 2 */
.observer-summary-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--crista-da-onda);
  border: 1px solid rgba(220, 229, 232, 0.75);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.observer-label-prefix {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.observer-coords-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(44, 79, 110, 0.1);
  color: var(--oceano-azul);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
}

/* Metrics Grid inside Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.metric-item {
  background: var(--crista-da-onda);
  border: 1px solid rgba(220, 229, 232, 0.6);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.metric-item.full-width {
  grid-column: 1 / -1;
}

.metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.2;
}

.status-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  width: fit-content;
}

.status-tag.day {
  background: rgba(211, 168, 89, 0.2);
  color: #8c6314;
}
.status-tag.twilight {
  background: rgba(44, 79, 110, 0.15);
  color: var(--oceano-azul);
}
.status-tag.night {
  background: rgba(26, 42, 58, 0.15);
  color: #1a2a3a;
}

/* Brand Attribution Card */
.brand-attribution-card {
  border: 1px solid rgba(211, 168, 89, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(232, 212, 184, 0.22) 100%);
}

.brand-attribution-card .card-title {
  color: var(--oceano-azul);
}

.brand-desc {
  font-size: 0.85rem;
  color: var(--entardecer-ondina);
  line-height: 1.5;
}

.brand-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--oceano-azul);
  text-decoration: none;
  transition: var(--transition-smooth);
  width: fit-content;
}

.brand-link-btn:hover {
  color: var(--por-do-sol-farol);
  transform: translateX(3px);
}

/* Accordion Science Guide */
.science-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.accordion-item {
  border: 1px solid rgba(220, 229, 232, 0.8);
  border-radius: var(--radius-md);
  background: #fdfdfc;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.accordion-item[open] {
  border-color: var(--oceano-azul);
  background: white;
}

.accordion-header {
  padding: 0.9rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  list-style: none;
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.accordion-item[open] .accordion-icon {
  transform: rotate(180deg);
  color: var(--oceano-azul);
}

.accordion-body {
  padding: 0.75rem 1.25rem 1.2rem;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--entardecer-ondina);
  border-top: 1px solid var(--crista-da-onda);
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.app-footer a {
  color: var(--oceano-azul);
  text-decoration: none;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 960px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-controls {
    width: 100%;
    justify-content: flex-start;
  }
  
  .timeline-row-main {
    flex-wrap: wrap;
  }
  
  .time-badge-group {
    width: 100%;
    justify-content: space-between;
  }

  .canvas-container {
    aspect-ratio: 16 / 9;
    min-height: 320px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0.75rem 0.75rem 2rem;
  }

  .header-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .location-picker-wrap, .date-picker-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .city-select {
    max-width: none;
    flex: 1;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .btn-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
  }
}

