/* =============================================
   LUNA — Menstrual Cycle Tracker
   Design System 2026
   ============================================= */



.app-shell { position: relative; z-index: 1; display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: rgba(13,8,22,0.7); backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px; gap: 6px; transition: var(--transition);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.brand-icon { flex-shrink: 0; }
.brand-name { font-size: 22px; font-weight: 700; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -0.5px; }

/* ---- User Badge ---- */
.user-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.2);
  margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn {
  flex-shrink: 0; background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; padding: 4px;
  border-radius: 6px; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.logout-btn:hover { color: var(--red); background: rgba(244,63,94,0.1); }

/* ---- Nav ---- */
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-secondary);
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-align: left; width: 100%;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-glass); }
.nav-item.active { color: var(--text-primary); background: var(--bg-glass); box-shadow: inset 0 0 0 1px var(--border-light); }
.nav-item.active .nav-icon { color: var(--pink); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; transition: var(--transition); }

.sidebar-footer { margin-top: auto; }
.cycle-phase-badge { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-glass); border: 1px solid var(--border); }
.phase-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad-brand); flex-shrink: 0; box-shadow: 0 0 8px var(--pink); animation: pulseDot 2s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 8px var(--pink); } 50% { box-shadow: 0 0 16px var(--pink), 0 0 24px var(--purple); } }
#sidebar-phase-text { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ---- Main Content ---- */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 32px 20px; border-bottom: 1px solid var(--border); background: rgba(13,8,22,0.4); backdrop-filter: blur(12px); flex-shrink: 0; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 14px; }
.header-date { font-size: 13px; color: var(--text-secondary); background: var(--bg-glass); padding: 7px 14px; border-radius: 30px; border: 1px solid var(--border); }
.btn-log-period { display: flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 30px; background: var(--grad-brand); color: white; border: none; font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--transition); box-shadow: 0 4px 20px rgba(168,85,247,0.4); }
.btn-log-period:hover { transform: translateY(-1px); box-shadow: 0 6px 26px rgba(168,85,247,0.55); }

/* ---- Views ---- */
.views-container { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 28px 32px; }
.views-container::-webkit-scrollbar { width: 4px; }
.views-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.view { display: none !important; animation: viewIn 0.3s ease; }
.view.active { display: block !important; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Glass Card ---- */
.glass-card { background: var(--bg-glass); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; transition: var(--transition); }
.glass-card:hover { border-color: var(--border-light); }

/* ---- Dashboard ---- */
.cycle-hero-card { display: flex; align-items: center; gap: 36px; background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(232,121,249,0.08)); border: 1px solid rgba(168,85,247,0.25); backdrop-filter: blur(20px); border-radius: var(--radius-xl); padding: 32px 36px; margin-bottom: 24px; position: relative; overflow: hidden; }
.cycle-hero-card::before { content: ''; position: absolute; top: -60px; right: -60px; width: 220px; height: 220px; background: radial-gradient(circle, rgba(232,121,249,0.2), transparent 70%); pointer-events: none; }
.cycle-ring-container { position: relative; flex-shrink: 0; width: 220px; height: 220px; }
#cycleRingCanvas { position: absolute; top: 0; left: 0; }
.cycle-ring-info { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cycle-day-number { font-size: 52px; font-weight: 800; line-height: 1; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cycle-day-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.cycle-hero-details { flex: 1; }
.hero-phase-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 30px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); font-size: 13px; font-weight: 600; margin-bottom: 24px; }
.hero-phase-icon { width: 10px; height: 10px; border-radius: 50%; background: var(--grad-brand); }
.hero-stats { display: flex; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.hero-stat { flex: 1; text-align: center; padding: 16px 12px; }
.hero-stat-value { display: block; font-size: 22px; font-weight: 700; }
.hero-stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 3px; display: block; }
.hero-stat-divider { width: 1px; background: var(--border); flex-shrink: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 14px; background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; transition: var(--transition); }
.stat-card:hover { background: var(--bg-glass-hover); border-color: var(--border-light); transform: translateY(-2px); }
.stat-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-card-value { font-size: 16px; font-weight: 700; }
.stat-card-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.dashboard-bottom { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 4px; align-items: stretch; }
.mini-cal-section { min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.mini-cal-section .mini-calendar { flex: 1; align-content: space-around; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 15px; font-weight: 600; }
.mini-cal-nav { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.icon-btn { width: 28px; height: 28px; border-radius: 8px; background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-primary); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); line-height: 1; }
.icon-btn:hover { background: var(--bg-glass-hover); border-color: var(--border-light); }

/* ---- Mini Calendar (dashboard) ---- */
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.mini-cal-header {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 600;
  padding: 4px 0;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-cal-day {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.mini-cal-day:hover:not(.empty) { background: var(--bg-glass-hover); }
.mini-cal-day.empty { pointer-events: none; }
.mini-cal-day.period { background: var(--grad-period); color: white; font-weight: 600; box-shadow: 0 2px 8px rgba(244,63,94,0.3); }
.mini-cal-day.fertile { background: rgba(34,211,238,0.2); color: var(--cyan); }
.mini-cal-day.ovulation { background: var(--grad-ovulation); color: white; font-weight: 700; }
.mini-cal-day.today { box-shadow: 0 0 0 2px var(--pink); font-weight: 700; }
.mini-cal-day.predicted-period { background: rgba(244,63,94,0.12); color: var(--red); border: 1px dashed rgba(244,63,94,0.35); }

.mini-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); position: relative; cursor: pointer; }
.legend-item::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  width: max-content;
  max-width: 200px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  pointer-events: none;
  line-height: 1.4;
}
.legend-item:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.legend-item::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(168, 85, 247, 0.3) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  pointer-events: none;
}
.legend-item:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

/* Смещение для крайних элементов, чтобы тултип не обрезался */
.legend-item:first-child::after {
  left: -10px;
  transform: translateX(0) translateY(5px);
}
.legend-item:first-child:hover::after {
  transform: translateX(0) translateY(0);
}
.legend-item:first-child::before {
  left: 15px;
  transform: translateX(-50%);
}

.legend-item:last-child::after {
  left: auto;
  right: -10px;
  transform: translateX(0) translateY(5px);
}
.legend-item:last-child:hover::after {
  transform: translateX(0) translateY(0);
}
.legend-item:last-child::before {
  left: auto;
  right: 15px;
  transform: translateX(50%);
}

.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.period { background: var(--grad-period); }
.legend-dot.fertile { background: var(--cyan); }
.legend-dot.ovulation { background: var(--orange); }
.legend-dot.today { background: transparent; box-shadow: 0 0 0 2px var(--pink); }
.legend-dot.predicted { background: transparent; border: 1.5px dashed var(--red); }

.right-panel { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.upcoming-card { flex: 1; }
.ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ai-icon { font-size: 20px; animation: pulse 2s infinite; }
.tip-title { font-size: 14px; font-weight: 600; }
.ai-loading { font-size: 13px; color: var(--text-secondary); font-style: italic; }
.ai-advice { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.ai-text { flex: 1; opacity: 0.9; }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.1); opacity: 1; text-shadow: 0 0 10px var(--pink); } 100% { transform: scale(1); opacity: 0.8; } }
.event-list { display: flex; flex-direction: column; gap: 10px; }
.event-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.event-content { flex: 1; min-width: 0; }
.event-name { font-size: 13px; font-weight: 500; }
.event-date { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

/* ---- Full Calendar (calendar page) ---- */
.calendar-view-wrap { margin-bottom: 18px; padding-bottom: 4px; }
.calendar-nav { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 20px; }
.cal-month-title { font-size: 18px; font-weight: 700; min-width: 180px; text-align: center; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 8px; }
.calendar-weekdays span { font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 4px 0; }
.full-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day {
  aspect-ratio: 1;
  max-height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.cal-day:hover:not(.cal-empty) { background: var(--bg-glass-hover); }
.cal-day.cal-empty { pointer-events: none; }
.cal-day.cal-period { background: var(--grad-period); color: white; font-weight: 700; box-shadow: 0 3px 12px rgba(244,63,94,0.35); }
.cal-day.cal-fertile { background: rgba(34,211,238,0.2); color: var(--cyan); }
.cal-day.cal-ovulation { background: var(--grad-ovulation); color: white; font-weight: 700; }
.cal-day.cal-today { box-shadow: inset 0 0 0 2px var(--pink); font-weight: 700; }
.cal-day.cal-predicted { background: rgba(244,63,94,0.1); color: rgba(244,63,94,0.7); border: 1px dashed rgba(244,63,94,0.3); }
.cal-day.cal-selected { box-shadow: inset 0 0 0 2.5px white; font-weight: 700; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.day-detail-panel { min-height: 160px; }
.day-detail-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px; color: var(--text-muted); text-align: center; font-size: 14px; }
.detail-date-header { font-size: 18px; font-weight: 700; margin-bottom: 10px; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.detail-phase { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 30px; background: var(--bg-glass); border: 1px solid var(--border); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.detail-symptoms { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.detail-sym-chip { padding: 4px 10px; border-radius: 20px; font-size: 12px; background: rgba(255,255,255,0.07); border: 1px solid var(--border); }
.detail-actions { display: flex; gap: 10px; }

/* ---- Analytics ---- */
.analytics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.analytics-card.wide { grid-column: span 2; }
.cycles-chart-wrap { width: 100%; overflow: hidden; }
.cycle-length-stats { display: flex; align-items: flex-end; justify-content: center; gap: 24px; padding: 20px 0; margin-bottom: 20px; }
.cl-stat { text-align: center; }
.cl-val { font-size: 28px; font-weight: 700; display: block; }
.cl-val-big { font-size: 48px; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cl-label { font-size: 12px; color: var(--text-secondary); }
.regularity-bar-wrap { display: flex; align-items: center; gap: 12px; }
.reg-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.regularity-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.07); overflow: hidden; }
.regularity-fill { height: 100%; border-radius: 4px; background: var(--grad-brand); transition: width 1s cubic-bezier(0.4,0,0.2,1); }
.reg-pct { font-size: 13px; font-weight: 600; color: var(--pink); }
.forecast-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.forecast-item { padding: 16px; border-radius: var(--radius-md); background: rgba(255,255,255,0.04); border: 1px solid var(--border); text-align: center; }
.forecast-month { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.forecast-date { font-size: 16px; font-weight: 700; color: var(--pink-soft); }
.forecast-len { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.circle-stat-wrap { display: flex; justify-content: center; padding: 16px 0; }
.circle-stat { position: relative; width: 120px; height: 120px; }
.circle-svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.circle-stat-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.circle-stat-center span { font-size: 28px; font-weight: 700; }
.circle-stat-center small { font-size: 11px; color: var(--text-secondary); }

/* ---- Symptoms ---- */
.symptoms-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.symptoms-date { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* Date navigator */
.sym-date-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.sym-date-center { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.sym-today-btn {
  font-size: 11px; font-weight: 600; color: var(--pink);
  background: rgba(232,121,249,0.1); border: 1px solid rgba(232,121,249,0.25);
  border-radius: 20px; padding: 2px 10px; cursor: pointer;
  transition: var(--transition); font-family: 'Outfit', sans-serif;
}
.sym-today-btn:hover { background: rgba(232,121,249,0.2); }
.history-count { font-size: 12px; color: var(--text-muted); }
.symptom-section { margin-bottom: 20px; }
.symptom-section-title { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.mood-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mood-btn { padding: 8px 6px; border-radius: var(--radius-sm); background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-secondary); font-family: 'Outfit', sans-serif; font-size: 12px; cursor: pointer; transition: var(--transition); }
.mood-btn:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.mood-btn.active { background: rgba(232,121,249,0.15); border-color: var(--pink); color: var(--pink); }
.symptom-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 30px; background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-secondary); font-family: 'Outfit', sans-serif; font-size: 12px; cursor: pointer; transition: var(--transition); }
.chip:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.chip.active { background: rgba(168,85,247,0.2); border-color: var(--purple); color: var(--purple); }
.flow-intensity { display: flex; gap: 10px; }
.flow-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-secondary); font-family: 'Outfit', sans-serif; font-size: 12px; cursor: pointer; transition: var(--transition); }
.flow-btn:hover { background: var(--bg-glass-hover); }
.flow-btn.active { background: rgba(244,63,94,0.15); border-color: var(--red); color: var(--red); }
.flow-icon { width: 24px; height: 24px; border-radius: 50%; }
.flow-light { background: rgba(244,63,94,0.3); }
.flow-medium { background: rgba(244,63,94,0.6); }
.flow-heavy { background: var(--red); }
.notes-input { width: 100%; min-height: 90px; background: var(--bg-glass); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; color: var(--text-primary); font-family: 'Outfit', sans-serif; font-size: 14px; resize: vertical; transition: var(--transition); }
.notes-input:focus { outline: none; border-color: var(--purple); }
.notes-input::placeholder { color: var(--text-muted); }
.symptoms-history-list { display: flex; flex-direction: column; gap: 10px; max-height: 500px; overflow-y: auto; }
.history-entry { padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.history-entry-date { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.history-entry-mood { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.history-entry-syms { display: flex; flex-wrap: wrap; gap: 6px; }
.history-sym { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: rgba(168,85,247,0.15); color: var(--violet); }

/* ---- Settings ---- */
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-group { margin-top: 18px; }
.settings-label { font-size: 13px; color: var(--text-secondary); display: block; margin-bottom: 10px; }
.settings-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.settings-input-row { display: flex; align-items: center; gap: 14px; }
.range-input { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); outline: none; cursor: pointer; }
.range-input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--grad-brand); cursor: pointer; box-shadow: 0 2px 8px rgba(168,85,247,0.5); }
.range-val { font-size: 15px; font-weight: 700; min-width: 28px; color: var(--pink); }
.date-input { width: 100%; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-primary); font-family: 'Outfit', sans-serif; font-size: 14px; outline: none; transition: var(--transition); color-scheme: dark; }
.date-input:focus { border-color: var(--purple); }

/* ---- Buttons ---- */
.btn-save { display: inline-flex; align-items: center; justify-content: center; padding: 11px 24px; border-radius: 30px; background: var(--grad-brand); color: white; border: none; font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--transition); width: 100%; margin-top: 6px; box-shadow: 0 4px 20px rgba(168,85,247,0.35); }
.btn-save:hover { box-shadow: 0 6px 26px rgba(168,85,247,0.5); transform: translateY(-1px); }
.btn-secondary { padding: 9px 20px; border-radius: 30px; background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-primary); font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition); }
.btn-secondary:hover { background: var(--bg-glass-hover); border-color: var(--border-light); }
.btn-danger { padding: 9px 20px; border-radius: 30px; background: rgba(244,63,94,0.15); border: 1px solid rgba(244,63,94,0.4); color: var(--red); font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition); }
.btn-danger:hover { background: rgba(244,63,94,0.25); }
.empty-state { color: var(--text-muted); font-size: 14px; text-align: center; padding: 20px; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: rgba(30,15,50,0.95); backdrop-filter: blur(20px); border: 1px solid var(--border-light); color: var(--text-primary); padding: 12px 24px; border-radius: 30px; font-size: 14px; font-weight: 500; z-index: 1000; opacity: 0; pointer-events: none; white-space: nowrap; transition: opacity 0.35s, transform 0.35s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); z-index: 900; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { width: 380px; padding: 28px; animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes modalIn { from { transform: scale(0.9) translateY(20px); } to { transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-glass); border: 1px solid var(--border); color: var(--text-primary); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.modal-close:hover { background: var(--bg-glass-hover); }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn-save { flex: 1; }
.modal-actions .btn-secondary { flex: 1; margin: 0; }

/* ---- Onboarding ---- */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
.onboarding-overlay.open { opacity: 1; pointer-events: all; }
.onboarding-modal {
  width: 100%; max-width: 460px; margin: 20px;
  background: linear-gradient(145deg, rgba(22,10,44,0.98), rgba(12,6,22,0.99));
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: var(--radius-xl); padding: 36px 32px 28px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 60px rgba(168,85,247,0.1);
  animation: modalIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.ob-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 32px; }
.ob-step {
  width: 10px; height: 10px; border-radius: 5px;
  background: rgba(255,255,255,0.1); border: 1.5px solid rgba(255,255,255,0.15);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}
.ob-step.active { width: 32px; background: var(--grad-brand); border-color: transparent; box-shadow: 0 0 12px rgba(232,121,249,0.6); }
.ob-step.done { background: var(--purple); border-color: transparent; }
.ob-step-line { width: 36px; height: 2px; background: rgba(255,255,255,0.07); margin: 0 6px; flex-shrink: 0; }
.ob-page { display: none; text-align: center; }
.ob-page.active { display: block; animation: viewIn 0.3s ease; }
.ob-emoji { font-size: 50px; line-height: 1; margin-bottom: 14px; }
.ob-title { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 10px; }
.ob-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 22px; }
.ob-date { font-size: 16px; text-align: center; margin-bottom: 4px; }
.ob-error { font-size: 13px; color: #f87171; min-height: 18px; margin: 6px 0; }
.ob-slider-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 6px 0 26px; width: 100%; }
.ob-slider-val { font-size: 36px; font-weight: 800; line-height: 1; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ob-btns { display: flex; gap: 10px; }
.ob-btns .btn-secondary { flex: 1; margin: 0; }
.ob-btns .btn-save { flex: 2; margin: 0; }

/* ---- Responsive ---- */
@media (max-width: 1280px) {
  .dashboard-bottom { grid-template-columns: 1fr 260px; }
}
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-bottom { grid-template-columns: 1fr; }
  .cycle-hero-card { flex-wrap: wrap; gap: 20px; padding: 24px; }
  .right-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 64px; }
  .brand-name, .nav-item span, .user-info, .logout-btn { display: none; }
  .user-badge { justify-content: center; padding: 8px; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-brand { justify-content: center; padding: 0 0 20px; }
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-card.wide { grid-column: span 1; }
  .symptoms-layout, .settings-layout { grid-template-columns: 1fr; }
  .views-container { padding: 16px; }
  .app-header { padding: 14px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cycle-hero-card { padding: 18px; gap: 16px; }
  .cycle-ring-container { width: 160px; height: 160px; }
  #cycleRingCanvas { width: 160px !important; height: 160px !important; }
  .right-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (max-width: 640px) {
  /* Header — компактная шапка */
  .app-header { padding: 10px 12px; gap: 8px; }
  .page-title { font-size: 16px; }
  .page-subtitle { font-size: 11px; }
  .header-date { font-size: 11px; padding: 5px 10px; }
  .btn-log-period { padding: 7px 12px; font-size: 12px; gap: 5px; }
  .btn-log-period svg { width: 13px; height: 13px; }

  /* Hero Card — вертикально, центрировано */
  .cycle-hero-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
    gap: 16px;
  }

  /* Кольцо — чуть уменьшаем */
  .cycle-ring-container { width: 150px; height: 150px; }
  #cycleRingCanvas { width: 150px !important; height: 150px !important; }
  .cycle-day-number { font-size: 42px; }

  /* Детали под кольцом — тоже центрированы */
  .cycle-hero-details { width: 100%; }
  .hero-phase-pill { justify-content: center; width: 100%; max-width: 200px; margin: 0 auto 16px; }

  /* Статистика под кольцом — горизонтально в 1 ряд */
  .hero-stats {
    flex-direction: row !important;
    width: 100%;
  }
  .hero-stat { padding: 12px 6px; }
  .hero-stat-value { font-size: 16px; }
  .hero-stat-label { font-size: 9px; }
  .hero-stat-divider { width: 1px; height: auto; }

  /* Сетка карточек статистики — 2 столбца, компактнее */
  .stats-grid { 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    margin-bottom: 16px;
  }
  .stat-card { padding: 12px 10px; gap: 10px; }
  .stat-card-icon { width: 36px; height: 36px; border-radius: 10px; }
  .stat-card-icon svg { width: 18px; height: 18px; }
  .stat-card-value { font-size: 13px; }
  .stat-card-label { font-size: 10px; }

  /* Нижний блок — в 1 столбец */
  .dashboard-bottom { gap: 12px; }
  .right-panel { grid-template-columns: 1fr; gap: 12px; }

  /* Мини-календарь */
  .mini-cal-day { width: 28px; height: 28px; font-size: 10px; }
  .mini-legend { flex-wrap: wrap; gap: 6px 12px; }

  /* Кнопка настроек в шапке (мобильная) */
  .mobile-settings-btn {
    display: flex !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    justify-content: center;
  }
  .mobile-settings-btn svg { width: 16px; height: 16px; }
  .header-right { gap: 8px; }

  /* Скрываем sidebar на мобилке — вместо него bottom nav */
  .sidebar { display: none !important; }

  /* Отступ снизу для контента, чтобы не перекрывался bottom nav */
  .views-container { padding-bottom: 80px !important; }
}

/* ── Calendar AI Notes ─────────────────────────────── */
.notes-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  min-height: 40px;
  transition: all 0.3s ease;
}
.notes-textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(232, 121, 249, 0.5);
  box-shadow: 0 0 0 2px rgba(232, 121, 249, 0.1);
}
.notes-textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
/* ── Mobile Bottom Navigation ─────────────────────────── */
.mobile-bottom-nav {
  display: none; /* Скрыто на десктопе */
}

@media (max-width: 640px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(13, 8, 22, 0.92);
    backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 500;
    border-radius: 10px;
    transition: var(--transition);
    min-width: 55px;
    flex: 1;
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    transition: var(--transition);
  }

  .mobile-nav-item:hover,
  .mobile-nav-item.active {
    color: var(--pink);
    background: rgba(232, 121, 249, 0.08);
  }

  .mobile-nav-item.active svg {
    stroke: var(--pink);
    filter: drop-shadow(0 0 6px rgba(232, 121, 249, 0.5));
  }

  .mobile-nav-item span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
  }
}

/* --- PREMIUM MENU STYLES --- */
.premium-nav { position: relative; }
.premium-badge { background: var(--grad-brand); color: #fff; font-size: 9px; font-weight: 800; padding: 2px 5px; border-radius: 4px; margin-left: 6px; letter-spacing: 0.5px; box-shadow: 0 0 10px rgba(168,85,247,0.4); animation: float-badge 3s ease-in-out infinite; }
.premium-badge-lg { background: var(--grad-brand); color: #fff; font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 6px; margin-left: 10px; vertical-align: middle; box-shadow: 0 0 12px rgba(232,121,249,0.4); }
@keyframes float-badge { 0% { transform: translateY(0); } 50% { transform: translateY(-2px); } 100% { transform: translateY(0); } }

.btn-premium { 
  background: var(--grad-brand); 
  color: white; 
  padding: 14px 36px; 
  font-size: 15px; 
  font-weight: 700; 
  font-family: 'Outfit', sans-serif; 
  border: none; 
  border-radius: 30px; 
  cursor: pointer; 
  transition: var(--transition); 
  box-shadow: 0 4px 20px rgba(168,85,247,0.3); 
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn-premium::after {
  content: "";
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
  transition: 0.5s;
  left: -150%;
}
.btn-premium:hover::after {
  left: 100%;
}
.btn-premium:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(168,85,247,0.5); }
.btn-premium:active { transform: translateY(0); }
.btn-premium:disabled { opacity: 0.6; cursor: not-allowed; }

/* Recipe Result Area */
.recipe-card { padding: 30px; margin-top: 20px; text-align: left; position: relative; overflow: hidden; }
.recipe-card::before { content: ""; position: absolute; top: -50px; left: -50px; width: 100px; height: 100px; background: radial-gradient(circle, rgba(232,121,249,0.1), transparent); border-radius: 50%; pointer-events: none; }
.recipe-header { border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 20px; margin-bottom: 20px; }
.recipe-title { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 10px; line-height: 1.3; }
.recipe-meta { display: flex; gap: 16px; font-size: 14px; color: var(--text-secondary); }
.recipe-meta span { background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 12px; }

.recipe-advice-box { display: flex; gap: 12px; background: rgba(232,121,249,0.08); border-left: 4px solid var(--pink); padding: 16px; border-radius: 8px; margin-bottom: 30px; }
.advice-icon { font-size: 24px; }
.recipe-advice-text { font-size: 14px; color: rgba(255,255,255,0.85); line-height: 1.5; margin: 0; }

.recipe-content { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
@media (max-width: 768px) { .recipe-content { grid-template-columns: 1fr; gap: 24px; } }

.recipe-ingredients h3, .recipe-steps h3 { font-size: 18px; margin-bottom: 16px; font-weight: 700; color: #fff; }
.recipe-ingredients ul { list-style: none; padding: 0; margin: 0; }
.recipe-ingredients li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; }
.recipe-ingredients li::before { content: "•"; color: var(--pink); font-size: 18px; margin-right: 8px; font-weight: bold; }

.recipe-step-item { display: flex; gap: 16px; margin-bottom: 16px; background: rgba(255,255,255,0.02); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.03); }
.step-number { font-size: 16px; font-weight: 800; color: var(--pink); background: rgba(232,121,249,0.1); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.step-text { font-size: 14px; color: rgba(255,255,255,0.8); line-height: 1.6; padding-top: 4px; }

/* ── Subscription Banner ─────────────────────────────────── */
.sub-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 32px;
  font-size: 13px; font-weight: 500;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.sub-banner--trial {
  background: linear-gradient(90deg, rgba(251,191,36,0.1), rgba(232,121,249,0.06));
  color: #fbbf24;
}
.sub-banner--expired {
  background: linear-gradient(90deg, rgba(244,63,94,0.12), rgba(232,121,249,0.06));
  color: #f87171;
}
.sub-banner-btn {
  padding: 5px 14px; border-radius: 20px;
  background: var(--grad-brand); color: white; border: none;
  font-family: 'Outfit', sans-serif; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: var(--transition); flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(168,85,247,0.3);
}
.sub-banner-btn:hover { box-shadow: 0 4px 18px rgba(168,85,247,0.5); transform: translateY(-1px); }

/* ── Subscription Modal ──────────────────────────────────── */
.sub-modal { width: 480px; padding: 0; overflow: hidden; }
.sub-modal .modal-header { padding: 20px 28px 16px; }
.sub-modal-body { padding: 0 28px 28px; text-align: center; }

/* Plan Selector */
.sub-plans { display: flex; gap: 12px; margin-bottom: 24px; }
.sub-plan-card {
  flex: 1; border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-md);
  padding: 16px 8px; cursor: pointer; transition: var(--transition);
  position: relative; background: rgba(255,255,255,0.02); text-align: center;
}
.sub-plan-card:hover { background: rgba(255,255,255,0.05); }
.sub-plan-card.selected {
  border-color: var(--pink); background: rgba(232,121,249,0.08);
  box-shadow: 0 4px 16px rgba(232,121,249,0.2);
}
.sub-plan-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--pink); color: white; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.sub-plan-name { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.sub-plan-price { font-size: 24px; font-weight: 800; color: white; margin-bottom: 4px; line-height: 1; }
.sub-plan-per { font-size: 11px; color: var(--text-muted); }

.sub-features { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; }
.sub-features li { padding: 8px 0; font-size: 14px; color: var(--text-primary); border-bottom: 1px solid rgba(255,255,255,0.05); }
.sub-features li:last-child { border-bottom: none; }
.sub-pay-btn { width: 100%; padding: 14px; font-size: 16px; font-weight: 700; box-shadow: 0 6px 24px rgba(168,85,247,0.4); }
.sub-modal-note { font-size: 11px; color: var(--text-muted); margin-top: 12px; }

/* ── Subscription Status Cards (Settings) ────────────────── */
.sub-status-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); border-left: 3px solid transparent; }
.sub-status-card--active { background: rgba(34,197,94,0.08); border-left-color: #22c55e; }
.sub-status-card--trial { background: rgba(251,191,36,0.08); border-left-color: #fbbf24; }
.sub-status-card--expired { background: rgba(244,63,94,0.08); border-left-color: #f43f5e; }
.sub-status-icon { font-size: 24px; flex-shrink: 0; }
.sub-status-label { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.sub-status-meta { font-size: 12px; color: var(--text-secondary); }

/* ── Referral Program ────────────────────────────────────── */
.ref-progress-wrap { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.ref-progress-bar { height: 100%; background: var(--grad-brand); transition: width 0.5s ease; }
.ref-link-box { display: flex; gap: 8px; }
.ref-link-input { flex: 1; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 8px 12px; color: var(--text-secondary); font-size: 13px; outline: none; }
.ref-copy-btn { background: rgba(255,255,255,0.08); border: none; border-radius: 6px; padding: 0 14px; color: white; cursor: pointer; font-size: 13px; transition: var(--transition); }
.ref-copy-btn:hover { background: rgba(255,255,255,0.15); }

@media (max-width: 640px) {
  .sub-banner { padding: 8px 12px; font-size: 11px; flex-wrap: wrap; gap: 6px; justify-content: center; text-align: center; }
  .sub-modal { width: calc(100vw - 32px); }
  .sub-plans { flex-direction: column; }
}
