/* ============================================
   Astrology Web App - Custom Styles
   Dark purple/indigo theme (Astrolink-inspired)
   ============================================ */

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e1b2e;
}

::-webkit-scrollbar-thumb {
  background: #4338ca;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6366f1;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #4338ca #1e1b2e;
}

/* --- Base Overrides --- */
body {
  background: linear-gradient(135deg, #0f0a1a 0%, #1a1033 50%, #0f172a 100%);
  min-height: 100vh;
  color: #e2e8f0;
}

/* --- Card Component --- */
.card {
  background-color: #1e293b;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  border: 1px solid #334155;
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  border-color: #4338ca;
}

/* --- Buttons --- */
.btn-primary {
  background-color: #4f46e5;
  color: #ffffff;
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  display: inline-block;
  text-align: center;
  cursor: pointer;
  border: none;
}

.btn-primary:hover {
  background-color: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  background-color: #334155;
  color: #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.15s ease;
  display: inline-block;
  text-align: center;
  cursor: pointer;
  border: none;
}

.btn-secondary:hover {
  background-color: #475569;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* --- Flash Messages --- */
.flash-success {
  background-color: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #86efac;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.flash-error {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.flash-info {
  background-color: rgba(59, 130, 246, 0.15);
  border: 1px solid #3b82f6;
  color: #93c5fd;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

/* --- City Autocomplete Dropdown --- */
#city-results {
  position: absolute;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

#city-results .city-item {
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  color: #cbd5e1;
  border-bottom: 1px solid #1e293b;
}

#city-results .city-item:hover,
#city-results .city-item.active {
  background-color: #4338ca;
  color: #ffffff;
}

#city-results .city-item:last-child {
  border-bottom: none;
}

.city-search-wrapper {
  position: relative;
}

/* --- Table Styles (Planets / Aspects) --- */
.astro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.astro-table thead {
  background-color: #1e1b2e;
}

.astro-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #a5b4fc;
  border-bottom: 2px solid #4338ca;
  white-space: nowrap;
}

.astro-table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid #1e293b;
  color: #cbd5e1;
}

.astro-table tbody tr {
  transition: background-color 0.15s ease;
}

.astro-table tbody tr:hover {
  background-color: rgba(67, 56, 202, 0.1);
}

.astro-table .planet-symbol {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

/* --- Zodiac Wheel Container --- */
.zodiac-wheel-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.zodiac-wheel-container svg {
  width: 100%;
  height: auto;
}

#zodiac-wheel {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mini wheel thumbnails in reading headers */
.zodiac-wheel-mini {
  display: flex;
  align-items: center;
  justify-content: center;
}

.zodiac-wheel-mini svg,
#zodiac-wheel-modal svg,
#danilo-wheel-modal svg,
#sandra-wheel-modal svg {
  width: 100%;
  height: 100%;
}

/* --- Zodiac Symbol Glow --- */
.zodiac-glow {
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.6), 0 0 20px rgba(129, 140, 248, 0.3);
  transition: text-shadow 0.3s ease;
}

.zodiac-glow:hover {
  text-shadow: 0 0 12px rgba(167, 139, 250, 0.9), 0 0 30px rgba(129, 140, 248, 0.5), 0 0 50px rgba(99, 102, 241, 0.3);
}

/* SVG glow filter applied via CSS */
.glow-effect {
  filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.6));
}

/* --- Loading Animation --- */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 10, 26, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.loading-state {
  text-align: center;
}

.loading-state p {
  margin-top: 1rem;
  color: #a5b4fc;
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* --- Gradient Text Utility --- */
.text-gradient {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* --- Smooth Transitions on Interactive Elements --- */
a, button, input, select, textarea {
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* --- Form Input Styles --- */
.form-input {
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  color: #e2e8f0;
  width: 100%;
}

.form-input::placeholder {
  color: #64748b;
}

.form-label {
  display: block;
  font-weight: 500;
  color: #a5b4fc;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
}

/* ============================================
   READING EXPERIENCE ENHANCEMENTS
   ============================================ */

/* --- Reading typography: justify + hyphens + serif for long-form --- */
.reading-prose p,
.reading-prose li {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hanging-punctuation: first last;
}

.reading-prose {
  font-family: 'Lora', 'Charter', 'Georgia', 'Times New Roman', serif;
  font-size: 16.5px;
  line-height: 1.85;
  color: #d8def0;
}

.reading-prose h1, .reading-prose h2, .reading-prose h3, .reading-prose h4 {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  text-align: left;
  hyphens: manual;
}

/* Drop cap on the first paragraph of each section */
.reading-prose > p:first-of-type::first-letter,
.reading-section > p:first-of-type::first-letter {
  float: left;
  font-family: 'Lora', 'Georgia', serif;
  font-size: 3.4em;
  line-height: 0.88;
  padding-right: 0.12em;
  padding-top: 0.08em;
  color: #a5b4fc;
  font-weight: 600;
}

/* --- Pull-quote card: "O conselho é..." / "O convite é..." / "O recado é..." --- */
.pull-quote {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.05));
  border-left: 4px solid #818cf8;
  border-radius: 0 0.75rem 0.75rem 0;
  position: relative;
  box-shadow: 0 4px 20px -10px rgba(99, 102, 241, 0.3);
}
.pull-quote::before {
  content: "✦";
  position: absolute;
  top: 0.6rem;
  right: 1rem;
  color: rgba(129, 140, 248, 0.5);
  font-size: 1.25rem;
}
.pull-quote p {
  margin: 0;
  font-family: 'Lora', 'Georgia', serif;
  font-style: italic;
  color: #e0e7ff;
  font-size: 1.02em;
  line-height: 1.75;
  text-align: left;
}
.pull-quote .pull-quote-label {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

/* --- Reading progress bar (sticky top) --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 100;
  pointer-events: none;
}
.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
}

/* --- Floating reading controls (bottom-right) --- */
.reading-controls {
  position: fixed;
  right: 1rem;
  bottom: 5.5rem;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.reading-controls.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
@media (min-width: 641px) {
  .reading-controls {
    bottom: 1.5rem;
  }
}
.reading-controls button {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.reading-controls button:hover {
  background: rgba(67, 56, 202, 0.9);
  border-color: #818cf8;
  transform: translateY(-2px);
}
.reading-controls button:active { transform: translateY(0); }
.reading-controls button svg { width: 1.1rem; height: 1.1rem; }

/* --- Month accordion (transits) --- */
.month-accordion {
  margin-top: 0.5rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(71, 85, 105, 0.3);
  border-radius: 1rem;
  overflow: hidden;
  transition: border-color 0.2s;
}
.month-accordion:hover { border-color: rgba(129, 140, 248, 0.4); }
.month-accordion.active { border-color: rgba(168, 85, 247, 0.5); }
.month-accordion-header {
  width: 100%;
  padding: 1rem 1.25rem;
  background: rgba(30, 41, 59, 0.5);
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-align: left;
  color: #e0e7ff;
  font-family: 'Inter', system-ui, sans-serif;
  transition: background 0.2s;
}
.month-accordion-header:hover { background: rgba(30, 41, 59, 0.8); }
.month-accordion-header .month-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  color: #d8b4fe;
}
.month-accordion-header .month-subtitle {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 400;
  font-style: italic;
  display: block;
  margin-top: 0.15rem;
}
.month-accordion-header .month-meta,
.alpine-meta {
  font-size: 0.72rem;
  color: #64748b;
  background: rgba(71, 85, 105, 0.25);
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
}
.alpine-meta { margin-left: auto; }
.month-accordion-header .chevron {
  width: 1.1rem;
  height: 1.1rem;
  color: #94a3b8;
  transition: transform 0.3s;
  flex-shrink: 0;
}
.month-accordion[data-open="true"] .chevron { transform: rotate(180deg); }
.month-accordion-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: none;
}
.month-accordion[data-open="true"] .month-accordion-body { display: block; }
.month-accordion-body > p:first-child {
  margin-top: 0;
}

/* --- Month nav (sticky, scroll-spy) --- */
.month-nav {
  position: sticky;
  top: 4rem;
  z-index: 30;
  margin-bottom: 1rem;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(71, 85, 105, 0.4);
  border-radius: 0.75rem;
  padding: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.month-nav::-webkit-scrollbar { display: none; }
.month-nav-inner {
  display: flex;
  gap: 0.3rem;
  min-width: max-content;
}
.month-nav a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 0.5rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.month-nav a:hover { background: rgba(71, 85, 105, 0.6); color: #e2e8f0; }
.month-nav a.active {
  background: #4f46e5;
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.accordion-toggle-all {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.5rem 0 0.25rem;
}
.accordion-toggle-all button {
  font-size: 0.72rem;
  color: #a5b4fc;
  background: transparent;
  border: 1px solid rgba(129, 140, 248, 0.3);
  padding: 0.3rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.accordion-toggle-all button:hover { background: rgba(99, 102, 241, 0.15); }

/* --- Datas-chave timeline --- */
.datas-timeline {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  position: relative;
}
.datas-timeline::before {
  content: "";
  position: absolute;
  left: 0.6rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(129, 140, 248, 0.4), transparent);
}
.datas-timeline li {
  position: relative;
  padding: 0.5rem 0 0.5rem 2rem;
  color: #cbd5e1;
  font-size: 0.93rem;
  line-height: 1.6;
  text-align: left;
}
.datas-timeline li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.95rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #818cf8;
  border: 2px solid #1e293b;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.3);
}
.datas-timeline li.is-eclipse::before { background: #f472b6; box-shadow: 0 0 0 2px rgba(244, 114, 182, 0.3); }
.datas-timeline li.is-conjunction::before { background: #a78bfa; }
.datas-timeline li.is-ingress::before { background: #34d399; box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.3); }
.datas-timeline li.is-retro::before { background: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3); }
.datas-timeline .date-label {
  font-weight: 600;
  color: #c7d2fe;
  margin-right: 0.35rem;
}

/* --- Font size settings (via body data attribute) --- */
body[data-reading-size="sm"] .reading-prose { font-size: 15px; }
body[data-reading-size="md"] .reading-prose { font-size: 16.5px; }
body[data-reading-size="lg"] .reading-prose { font-size: 18px; line-height: 1.95; }
body[data-reading-size="xl"] .reading-prose { font-size: 19.5px; line-height: 2; }

/* --- Print: fall back to readable print defaults --- */
@media print {
  .reading-controls, .reading-progress, .month-nav,
  .accordion-toggle-all, .desktop-nav, .mobile-header, .bottom-nav {
    display: none !important;
  }
  .month-accordion-body { display: block !important; }
  .reading-prose { color: #000; font-size: 11pt; }
}
