/* ============================================================
   OVULATION CALCULATOR & TRACKER — ovulation-calculator.css
   Fertility-themed glassmorphism styling
   Toolspot by Tradesala
   ============================================================ */

:root {
  --fertility-pink: #ec4899;
  --fertility-purple: #a855f7;
  --fertility-red: #ef4444;
  --fertility-glow: rgba(236, 72, 153, 0.3);
  --fertility-soft: rgba(168, 85, 247, 0.08);
}

/* Custom Datepicker & Glassmorphic Calendar Styles */
.tool-left {
  position: relative;
  z-index: 5;
}

.tool-left .panel {
  overflow: visible !important;
}

.datepicker-container {
  position: relative;
  overflow: visible !important;
}

.datepicker-input {
  cursor: pointer !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 16px 16px !important;
  padding-right: 48px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

body.light .datepicker-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

.custom-calendar {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  gap: 12px;
  user-select: none;
}

.custom-calendar.open {
  display: flex;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
  font-size: 14px;
}

.cal-nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s;
}

.cal-nav-btn:hover {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.3);
}

.cal-month-year {
  letter-spacing: 0.5px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.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;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.cal-day:hover:not(.empty) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.cal-day.active {
  background: var(--fertility-pink) !important;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.cal-day.empty {
  cursor: default;
}

.cal-day.today {
  border: 1px solid var(--fertility-pink);
  color: #f472b6;
}

/* Light mode support for picker */
body.light .custom-calendar {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

body.light .cal-header {
  color: #0f172a;
}

body.light .cal-nav-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
  color: #475569;
}

body.light .cal-nav-btn:hover {
  background: rgba(236, 72, 153, 0.08);
  color: #db2777;
  border-color: rgba(236, 72, 153, 0.25);
}

body.light .cal-weekdays {
  color: #64748b;
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.light .cal-day {
  color: #334155;
}

body.light .cal-day:hover:not(.empty) {
  background: rgba(0, 0, 0, 0.03);
  color: #0f172a;
}

body.light .cal-day.active {
  background: #db2777 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(219, 39, 119, 0.2);
}

body.light .cal-day.today {
  border-color: #db2777;
  color: #db2777;
}

/* Result KPI Hero & Badge Styles */
.result-hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.04) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 20px;
}

body.light .result-hero {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.01) 0%, rgba(0, 0, 0, 0.03) 100%);
  border-color: rgba(0, 0, 0, 0.06);
}

.result-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-2);
}

.result-val {
  font-family: 'Outfit', sans-serif;
  font-size: 38px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 8px;
}

body.light .result-val {
  color: #0f172a;
}

.result-subtitle {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Fertility/Risk Badges */
.risk-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  display: inline-block;
}

.risk-badge.risk-normal { /* Safe/Low */
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2) !important;
  border-color: rgba(255, 255, 255, 0.1);
}

body.light .risk-badge.risk-normal {
  background: rgba(0, 0, 0, 0.04);
  color: #475569 !important;
  border-color: rgba(0, 0, 0, 0.08);
}

.risk-badge.risk-warning { /* Fertile window */
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6 !important;
  border-color: rgba(236, 72, 153, 0.3);
}

body.light .risk-badge.risk-warning {
  background: rgba(236, 72, 153, 0.08);
  color: #db2777 !important;
  border-color: rgba(236, 72, 153, 0.2);
}

.risk-badge.risk-high { /* Peak Ovulation */
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6 !important;
  border-color: rgba(236, 72, 153, 0.45);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

body.light .risk-badge.risk-high {
  background: rgba(236, 72, 153, 0.1);
  color: #db2777 !important;
  border-color: rgba(236, 72, 153, 0.3);
}

.risk-badge.risk-period { /* Period active */
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.3);
}

body.light .risk-badge.risk-period {
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c !important;
  border-color: rgba(239, 68, 68, 0.2);
}

/* Guideline Summary Panels */
.guideline-summary {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.light .guideline-summary {
  background: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.05);
}

.guideline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.guideline-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

body.light .guideline-row {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.guideline-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-3);
}

.guideline-val {
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.guideline-val.highlight {
  color: var(--fertility-pink);
}

/* Visual Interactive Output Calendar Styles */
.cycle-calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cycle-calendar-grid .cal-days {
  gap: 6px;
}

.cycle-calendar-grid .cal-day {
  cursor: default;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 4px 0;
  box-sizing: border-box;
}

.cal-day .prob-val {
  font-size: 10.5px;
  font-weight: 800;
  margin-top: 5px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 9999px;
  display: inline-block;
  letter-spacing: -0.01em;
}

.day-fertile .prob-val {
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.35) !important;
  border: 1px solid rgba(236, 72, 153, 0.4) !important;
}

body.light .day-fertile .prob-val {
  color: #4c0519 !important;
  background: rgba(236, 72, 153, 0.16) !important;
  border: 1px solid rgba(236, 72, 153, 0.3) !important;
}

.day-ovulation .prob-val {
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.day-period {
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  color: #ef4444 !important;
}

.day-fertile {
  background: rgba(236, 72, 153, var(--fertile-opacity, 0.12)) !important;
  border: 1px solid rgba(236, 72, 153, calc(var(--fertile-opacity, 0.12) * 1.2 + 0.15)) !important;
  color: #f472b6 !important;
}

body.light .day-fertile {
  color: #db2777 !important;
}

.day-ovulation {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%) !important;
  border-color: rgba(236, 72, 153, 0.3) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.45);
  animation: pulse-glow 2s infinite alternate;
}

.day-today {
  border: 1px solid var(--text-2) !important;
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.1);
}

body.light .day-today {
  border-color: #0f172a !important;
}

.day-lmp {
  outline: 2px dashed rgba(239, 68, 68, 0.6);
  outline-offset: -2px;
}

/* Pulse animation for ovulation day */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 4px rgba(236, 72, 153, 0.35);
  }
  100% {
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.7);
  }
}

/* Light mode output calendar support */
body.light .cycle-calendar-grid .cal-day {
  color: #334155;
}

body.light .day-period {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
  color: #b91c1c !important;
}

body.light .day-fertile {
  background: rgba(236, 72, 153, var(--fertile-opacity, 0.08)) !important;
  border-color: rgba(236, 72, 153, calc(var(--fertile-opacity, 0.08) * 1.2 + 0.15)) !important;
  color: #db2777 !important;
}

body.light .day-ovulation {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.3);
}

/* Table forecast custom classes */
.forecast-period-highlight {
  color: #fca5a5;
  font-weight: 700;
}

body.light .forecast-period-highlight {
  color: #b91c1c;
}

.forecast-fertile-highlight {
  color: #fbcfe8; /* light pink */
  font-weight: 700;
}

body.light .forecast-fertile-highlight {
  color: #db2777;
}

.forecast-ovulation-highlight {
  color: #f472b6;
  font-weight: 800;
}

body.light .forecast-ovulation-highlight {
  color: #db2777;
}

/* ── Forecast Table Styles ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.015);
  margin-top: 16px;
  -webkit-overflow-scrolling: touch;
}

body.light .table-wrap {
  background: rgba(0, 0, 0, 0.005);
  border-color: rgba(0, 0, 0, 0.08);
}

.projection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.projection-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 10px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid rgba(168, 85, 247, 0.2);
}

body.light .projection-table th {
  background: rgba(0, 0, 0, 0.02);
  color: #444;
  border-bottom-color: rgba(168, 85, 247, 0.15);
}

.projection-table td {
  padding: 12px 10px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

body.light .projection-table td {
  color: #333;
  border-bottom-color: rgba(0, 0, 0, 0.035);
}

.projection-table tr:last-child td {
  border-bottom: none;
}

/* Zebra striping for improved legibility */
.projection-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.008);
}

body.light .projection-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.01);
}

/* Premium fertility hover effect */
.projection-table tr:hover td {
  background: rgba(168, 85, 247, 0.07) !important;
}

body.light .projection-table tr:hover td {
  background: rgba(168, 85, 247, 0.04) !important;
}

@media (max-width: 768px) {
  .projection-table th, 
  .projection-table td {
    padding: 10px 8px !important;
    font-size: 12px !important;
  }
}

/* Print/PDF Styling overrides */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .bg-scene, #ts-header, #ts-footer, .rb-btn, .breadcrumb, #tool-disclaimer, .tool-left {
    display: none !important;
  }
  .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .tool-layout {
    display: block !important;
  }
  .tool-right {
    width: 100% !important;
    display: block !important;
  }
  .panel {
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    margin-bottom: 24px !important;
    page-break-inside: avoid;
  }
  .result-hero {
    border: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
  }
  .result-val {
    color: #db2777 !important;
  }
}
