/* ============================================
   LUNA — Period Tracker
   Design System: Soft Rose / Organic / Warm
   ============================================ */

/* --- CSS Variables --- */
:root {
  --rose-50:  #FFF5F8;
  --rose-100: #FFE4EE;
  --rose-200: #F9C8D9;
  --rose-300: #E8A0B4;
  --rose-400: #D4748F;
  --rose-500: #C2607A;
  --rose-600: #A84060;
  --rose-700: #7D2B45;
  --rose-800: #5A1A30;

  --blush:    #F9E4EC;
  --cream:    #FFF9FB;
  --warm-white: #FFFCFD;

  --text-primary:   #3D1A26;
  --text-secondary: #7A4558;
  --text-muted:     #B07A8E;

  --card-bg:    rgba(255, 255, 255, 0.72);
  --card-border: rgba(232, 160, 180, 0.25);
  --shadow-soft: 0 4px 24px rgba(194, 96, 122, 0.10);
  --shadow-card: 0 2px 16px rgba(194, 96, 122, 0.08);

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-xl: 48px;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', sans-serif;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--rose-50);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Ambient Background Blobs --- */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}
.blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #F9C8D9 0%, transparent 70%);
  top: -150px; right: -100px;
  animation: blobFloat 12s ease-in-out infinite;
}
.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #E8A0B4 0%, transparent 70%);
  bottom: 10%; left: -120px;
  animation: blobFloat 16s ease-in-out infinite reverse;
}
.blob-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #FFE4EE 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: blobFloat 20s ease-in-out infinite;
}
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.05); }
  66%       { transform: translate(-15px, 20px) scale(0.97); }
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(255, 245, 248, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon { font-size: 22px; }
.logo-text {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--rose-700);
  letter-spacing: 0.02em;
}

.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--rose-100);
  padding: 4px;
  border-radius: 50px;
}
.tab-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--rose-600); }
.tab-btn.active {
  background: white;
  color: var(--rose-700);
  box-shadow: 0 2px 8px rgba(194, 96, 122, 0.15);
}

/* --- Main Layout --- */
.app-main {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* --- Tab Panels --- */
.tab-panel { display: none; animation: fadeIn 0.35s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   TRACKER TAB
   ============================================ */

/* Phase Hero */
.phase-hero {
  display: flex;
  align-items: center;
  gap: 36px;
  margin-bottom: 32px;
  padding: 36px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.phase-ring-wrap {
  position: relative;
  flex-shrink: 0;
}
.phase-ring {
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 4px 16px rgba(194, 96, 122, 0.2));
}
.ring-day-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  fill: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ring-day-num {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 300;
  fill: var(--rose-700);
}
.ring-phase-text {
  font-family: var(--font-body);
  font-size: 11px;
  fill: var(--text-secondary);
  font-weight: 500;
}
.phase-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.phase-info { flex: 1; }
.phase-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  color: var(--rose-700);
  line-height: 1.2;
  margin-bottom: 10px;
}
.phase-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.stat-icon { font-size: 22px; flex-shrink: 0; }
.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--rose-700);
}

/* Log Card */
.log-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.card-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--rose-700);
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.section-sublabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 10px;
}

input[type="date"],
input[type="number"],
select,
textarea {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--rose-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--rose-400);
  background: white;
  box-shadow: 0 0 0 3px rgba(232, 160, 180, 0.2);
}
textarea { resize: vertical; min-height: 80px; }

/* Symptom Chips */
.symptoms-section { margin-bottom: 20px; }
.symptom-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid var(--rose-200);
  border-radius: 50px;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
}
.chip:hover {
  border-color: var(--rose-400);
  color: var(--rose-600);
}
.chip.selected {
  background: var(--rose-500);
  border-color: var(--rose-500);
  color: white;
}

/* Buttons */
.btn-primary {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--rose-500), var(--rose-700));
  border: none;
  border-radius: 50px;
  padding: 14px 36px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(194, 96, 122, 0.35);
  margin-top: 8px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(194, 96, 122, 0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid var(--rose-200);
  border-radius: 50px;
  padding: 10px 24px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 16px;
}
.btn-ghost:hover {
  color: var(--rose-600);
  border-color: var(--rose-400);
}

/* History List */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.history-item-date {
  font-weight: 600;
  color: var(--rose-700);
}
.history-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.history-item-flow {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================
   CALENDAR TAB
   ============================================ */

.calendar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.cal-month-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--rose-700);
}
.cal-nav {
  width: 40px; height: 40px;
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 50%;
  font-size: 20px;
  color: var(--rose-600);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.cal-nav:hover {
  background: var(--rose-100);
  border-color: var(--rose-300);
}

.cal-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.period    { background: var(--rose-500); }
.legend-dot.fertile   { background: #A8D8A8; }
.legend-dot.ovulation { background: #FFD700; }
.legend-dot.predicted { background: var(--rose-300); border: 2px dashed var(--rose-400); }

.calendar-grid-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 0;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: default;
  transition: var(--transition);
  position: relative;
}
.cal-day.empty { background: transparent; }
.cal-day.today {
  font-weight: 700;
  color: var(--rose-700);
  box-shadow: inset 0 0 0 2px var(--rose-400);
}
.cal-day.period-day {
  background: var(--rose-500);
  color: white;
}
.cal-day.fertile-day {
  background: rgba(168, 216, 168, 0.5);
  color: #2D6A2D;
}
.cal-day.ovulation-day {
  background: rgba(255, 215, 0, 0.6);
  color: #7A5C00;
}
.cal-day.predicted-day {
  background: var(--rose-100);
  color: var(--rose-600);
  border: 2px dashed var(--rose-300);
}
.cal-day.other-month { color: var(--rose-200); }

/* Phase Guide */
.phase-guide { margin-top: 8px; }
.phase-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.phase-card {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  transition: var(--transition);
}
.phase-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.phase-card.menstrual  { background: rgba(249, 200, 217, 0.3); }
.phase-card.follicular { background: rgba(200, 230, 200, 0.3); }
.phase-card.ovulation  { background: rgba(255, 240, 180, 0.3); }
.phase-card.luteal     { background: rgba(220, 200, 180, 0.3); }
.phase-card-icon { font-size: 28px; margin-bottom: 8px; }
.phase-card h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--rose-700);
  margin-bottom: 6px;
}
.phase-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   REMEDIES TAB
   ============================================ */

.remedies-hero {
  text-align: center;
  padding: 40px 20px 32px;
}
.remedies-title {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 300;
  font-style: italic;
  color: var(--rose-700);
  margin-bottom: 12px;
}
.remedies-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Filter Chips */
.remedy-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  justify-content: center;
}
.filter-chip {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 50px;
  padding: 8px 18px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.filter-chip:hover {
  border-color: var(--rose-400);
  color: var(--rose-600);
}
.filter-chip.active {
  background: var(--rose-500);
  border-color: var(--rose-500);
  color: white;
}

/* Remedies Grid */
.remedies-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.remedy-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: var(--transition);
  animation: fadeIn 0.3s ease;
}
.remedy-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
  border-color: var(--rose-300);
}
.remedy-card.hidden { display: none; }
.remedy-emoji { font-size: 32px; margin-bottom: 12px; }
.remedy-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--rose-700);
  margin-bottom: 8px;
}
.remedy-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}
.remedy-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 10px;
  border-radius: 50px;
}
.remedy-tag.heat      { background: rgba(255, 160, 100, 0.2); color: #C05000; }
.remedy-tag.herbal    { background: rgba(100, 200, 100, 0.2); color: #2D6A2D; }
.remedy-tag.movement  { background: rgba(150, 150, 255, 0.2); color: #3030A0; }
.remedy-tag.nutrition { background: rgba(255, 220, 100, 0.2); color: #7A5C00; }
.remedy-tag.lifestyle { background: rgba(232, 160, 180, 0.3); color: var(--rose-700); }

/* Disclaimer */
.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  background: rgba(255, 228, 238, 0.5);
  border: 1px solid var(--rose-200);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}
.disclaimer-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.disclaimer p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--rose-700);
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 28px;
  border-radius: 50px;
  box-shadow: 0 8px 32px rgba(125, 43, 69, 0.35);
  z-index: 999;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 700px) {
  .site-header { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .tab-btn { padding: 7px 12px; font-size: 12px; }
  .app-main { padding: 20px 14px 60px; }

  .phase-hero { flex-direction: column; text-align: center; padding: 24px; gap: 20px; }
  .phase-ring { width: 150px; height: 150px; }
  .phase-title { font-size: 26px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .log-card { padding: 20px; }

  .phase-cards-grid { grid-template-columns: 1fr; }
  .remedies-grid { grid-template-columns: 1fr; }
  .remedies-title { font-size: 36px; }

  .cal-day { font-size: 11px; }
}

@media (max-width: 420px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .logo-text { font-size: 22px; }
}