/* ============ Design tokens ============ */
* { box-sizing: border-box; }

:root {
  --brand: #0f766e;
  --brand-dark: #0b5b54;
  --brand-light: #14b8a6;
  --bg: #f4f6f5;
  --card-bg: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 2px 16px rgba(15, 23, 22, 0.08);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; }

/* ============ Top bar ============ */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar .source-file {
  font-size: 11px;
  opacity: 0.75;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 9px;
  border-radius: 20px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.24); }
.nav-btn.active { background: #fff; color: var(--brand-dark); }

.day-select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  max-width: 46vw;
}
.day-select option { color: #1f2937; }

.location-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.location-btn:hover { background: rgba(255, 255, 255, 0.24); }

/* ---- Location modal ---- */
.location-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 22, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.location-modal.hidden { display: none; }

.location-box {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  padding: 26px 28px;
  max-width: 380px;
  width: 100%;
}
.location-box h3 { font-size: 18px; color: var(--brand-dark); margin-bottom: 8px; }
.location-box p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }

.location-divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0;
  position: relative;
}
.location-divider::before, .location-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  border-top: 1px solid var(--border);
}
.location-divider::before { left: 0; }
.location-divider::after { right: 0; }

.location-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 8px;
}

.city-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 160px;
  overflow-y: auto;
}
.city-result-item {
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
}
.city-result-item:hover { background: #eef2f1; }

.location-note { font-size: 12px; color: var(--muted); text-align: center; }

.pill-btn.full { width: 100%; text-align: center; margin-bottom: 4px; }
.pill-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.pill-btn.ghost:hover { background: #f3f4f6; }

.loading-note { font-size: 13px; color: var(--muted); margin: 0; }

/* ============ Content / panels ============ */
.content {
  flex: 1 1 auto;
  padding: 22px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.panel.hidden { display: none; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

/* ---- Overview: calendar heading ---- */
.overview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.overview-heading h2 {
  font-size: 22px;
  color: var(--brand-dark);
}

.external-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  border: 1px solid var(--brand);
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.15s ease, color 0.15s ease;
}
.external-link:hover { background: var(--brand); color: #fff; }

/* ---- Calendar grid ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cal-blank { visibility: hidden; }

.cal-day {
  position: relative;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 10px;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.cal-day:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--dot-color);
}
.cal-day-num { font-size: 15px; font-weight: 600; }
.cal-day-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot-color);
}

/* ---- Σημερινή ημέρα: "φωσφορίζον" εφέ ---- */
@keyframes today-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.45), 0 0 10px 2px rgba(15, 118, 110, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(15, 118, 110, 0), 0 0 16px 5px rgba(15, 118, 110, 0.55); }
}
.cal-day.is-today {
  border-color: var(--brand);
  border-width: 2px;
  background: #fff;
  animation: today-glow 2.2s ease-in-out infinite;
}
.day-list-row.is-today {
  box-shadow: 0 0 0 2px var(--brand) inset;
  animation: today-glow 2.2s ease-in-out infinite;
}
.today-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  padding: 2px 9px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 6px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* ---- Day list (secondary view within overview) ---- */
.list-card h3 {
  font-size: 15px;
  color: var(--brand-dark);
  margin-bottom: 12px;
}
.day-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}
.day-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  background: #fafafa;
  border-radius: 8px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}
.day-list-row:hover { background: #f0f2f1; }
.day-list-num { font-weight: 600; color: var(--ink); }
.day-list-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.day-list-row.cat-ideal .day-list-badge   { background: #eef2ff; color: #4338ca; }
.day-list-row.cat-vgood .day-list-badge   { background: #ecfdf5; color: #047857; }
.day-list-row.cat-good .day-list-badge    { background: #f7fee7; color: #4d7c0f; }
.day-list-row.cat-medium .day-list-badge  { background: #fffbeb; color: #b45309; }
.day-list-row.cat-marginal .day-list-badge{ background: #fff7ed; color: #c2410c; }
.day-list-row.cat-low .day-list-badge     { background: #fef2f2; color: #b91c1c; }

/* ---- Day detail header ---- */
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.day-nav { display: flex; gap: 8px; }

.pill-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.pill-btn:hover { background: #eef2f1; border-color: var(--brand-light); }

/* ---- Verdict card ---- */
.verdict-card {
  background: var(--cat-bg, #f4f6f5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.verdict-date {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}
.verdict-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}
.verdict-category {
  font-size: 20px;
  font-weight: 800;
  color: var(--cat-fg, var(--brand-dark));
}
.verdict-score {
  font-size: 12px;
  font-weight: 700;
  color: var(--cat-fg, var(--brand-dark));
  background: rgba(255, 255, 255, 0.6);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ---- Info cards grid ---- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 6px rgba(15, 23, 22, 0.05);
}
.info-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--muted); }
.info-row strong { color: var(--ink); font-weight: 600; }
.info-note { font-size: 13px; color: var(--muted); margin: 0; }

/* ---- Timeline (Πορεία Ημέρας) ---- */
.timeline-card { grid-column: 1 / -1; }

.timeline {
  position: relative;
  height: 46px;
  border-radius: 10px;
  overflow: visible;
  margin-top: 6px;
}

.tl-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
}

.tl-sun, .tl-moon {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%) scale(0.3);
  opacity: 0;
  transition: left 1.1s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s ease, opacity 0.6s ease;
}
.tl-sun.tl-animate-in, .tl-moon.tl-animate-in {
  left: var(--tl-left);
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.tl-sun {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6cf, #ffb703 70%);
  box-shadow: 0 0 14px 4px rgba(255, 183, 3, 0.65);
  animation: sun-pulse 3s ease-in-out infinite;
}
@keyframes sun-pulse {
  0%, 100% { box-shadow: 0 0 14px 4px rgba(255, 183, 3, 0.55); }
  50%      { box-shadow: 0 0 20px 7px rgba(255, 183, 3, 0.85); }
}

.tl-moon {
  width: 24px;
  height: 24px;
}
.tl-moon-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(90deg, #4b5563 0%, #4b5563 calc(100% - var(--illum)), #f4f6f5 calc(100% - var(--illum)), #f4f6f5 100%);
  box-shadow: 0 0 8px 2px rgba(244, 246, 245, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.15);
  animation: moon-rotate 6s ease-in-out infinite;
}
@keyframes moon-rotate {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.15); }
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}

/* ---- Mini bar (σε κάθε κάρτα λυκόφωτος/μήκους ημέρας/σελήνης) ---- */
.mini-bar {
  position: relative;
  height: 22px;
  margin: 4px 0 14px;
}
.mini-bar-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  transform: translateY(-50%);
  background: #eef0ef;
  border-radius: 4px;
}
.mini-bar-seg {
  position: absolute;
  top: 50%;
  height: 6px;
  transform: translateY(-50%) scaleX(0);
  transform-origin: left center;
  border-radius: 4px;
  animation: mini-bar-grow 0.7s ease forwards;
}
@keyframes mini-bar-grow {
  to { transform: translateY(-50%) scaleX(1); }
}
.mini-bar-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 13px;
  line-height: 1;
  animation: mini-marker-pop 0.5s 0.4s ease forwards;
}
@keyframes mini-marker-pop {
  to { transform: translate(-50%, -50%) scale(1); }
}
.mini-bar-ticks {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}

/* ---- Πρωτράκτορας γωνίας ήλιου ---- */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; }
.gauge-needle {
  transform-origin: 10px 42px;
  animation: needle-in 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes needle-in {
  from { opacity: 0; transform: rotate(-40deg); }
  to   { opacity: 1; transform: rotate(0deg); }
}
.gauge-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- Δίσκος φάσης σελήνης (κάρτα Σελήνη) ---- */
.moon-disc-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
.moon-disc {
  border-radius: 50%;
  background: linear-gradient(90deg, #4b5563 0%, #4b5563 calc(100% - var(--illum)), #f4f6f5 calc(100% - var(--illum)), #f4f6f5 100%);
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 10px 2px rgba(148, 163, 184, 0.4), inset 0 0 8px rgba(0, 0, 0, 0.15);
  animation: moon-disc-in 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes moon-disc-in {
  from { opacity: 0; transform: scale(0.4) rotate(-30deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ============ Footer ============ */
.footer {
  text-align: center;
  padding: 14px;
  font-size: 11px;
  color: var(--muted);
}
.footer a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.footer a:hover { text-decoration: underline; }

/* ============ Scroll-to-top ============ */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 25;
}
.to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ============ Upload page ============ */
.upload-wrap {
  max-width: 480px;
  margin: 60px auto;
  background: var(--card-bg);
  padding: 30px 34px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.upload-wrap h1 { font-size: 21px; color: var(--brand); margin-bottom: 12px; }
.upload-wrap p { color: var(--muted); line-height: 1.5; }
.upload-wrap code { background: #eef3f0; padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.upload-wrap input[type="password"],
.upload-wrap input[type="file"] {
  width: 100%;
  padding: 10px;
  margin: 8px 0 18px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}
.upload-wrap button {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease;
}
.upload-wrap button:hover { background: var(--brand-dark); }
.upload-wrap button:active { transform: scale(0.98); }
.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.flash.error { background: #fdecea; color: #a52222; border: 1px solid #f5c2c0; }
.flash.success { background: #e9f7ef; color: #1c6b3d; border: 1px solid #b8e6c9; }
.file-list { margin-top: 26px; font-size: 13px; color: var(--muted); }
.file-list a { color: var(--brand); }

/* ============ Mobile ============ */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 16px; }
  .topbar .source-file { display: none; }
  .day-select { max-width: 100%; }

  .content { padding: 12px; }
  .card { padding: 16px; border-radius: 12px; }

  .calendar-grid { gap: 4px; }
  .cal-day { padding: 8px 2px 6px; }
  .cal-day-num { font-size: 13px; }

  .verdict-card { flex-direction: column; align-items: flex-start; }
  .verdict-category { font-size: 17px; }

  .info-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .info-card { padding: 12px 14px; }

  .upload-wrap { margin: 24px 12px; padding: 22px 18px; }
}

@media (max-width: 420px) {
  .info-grid { grid-template-columns: 1fr; }
}
