/* kashsano – Component Styles */

/* Section card */
.section-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.section-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn-outline {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: none;
  color: var(--text-primary);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.btn-outline:hover {
  background: var(--bg-secondary);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-light);
}

/* Emoji row */
.emoji-row {
  display: flex;
  justify-content: space-between;
}

.emoji-btn {
  font-size: 24px;
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  line-height: 1;
  transition: background var(--transition);
}

.emoji-btn:hover {
  background: var(--bg-primary);
}

.emoji-btn.selected {
  background: var(--bg-primary);
  border-color: var(--border);
}

/* Slider */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.slider-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.slider-val {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  min-width: 20px;
  text-align: right;
}

/* Tags */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.tag {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-primary);
  transition: all var(--transition);
  user-select: none;
}

.tag:hover {
  background: var(--bg-secondary);
}

.tag.selected {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: transparent;
}

/* Time inputs */
.sleep-row {
  display: flex;
  gap: var(--spacing-sm);
}

.time-input {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  text-align: center;
}

/* Metric cards */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.metric-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.metric-val {
  font-size: 22px;
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}

.metric-sub {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Insight cards */
.insight-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-start;
}

.insight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.insight-dot.teal {
  background: var(--accent);
}

.insight-dot.amber {
  background: var(--warning);
}

.insight-text {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  line-height: 1.5;
}

/* Chart area */
.chart-area {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: var(--spacing-md);
}

.chart-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Log entries */
.log-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  transition: background var(--transition);
}

.log-entry:active {
  background: var(--bg-secondary);
}

.log-date {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.log-main {
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

.log-tags {
  display: flex;
  gap: 6px;
  margin-top: var(--spacing-sm);
  flex-wrap: wrap;
}

.log-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.mood-emoji {
  font-size: 22px;
  flex-shrink: 0;
}

/* Settings rows */
.settings-section {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--spacing-md) 0 var(--spacing-sm);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-label {
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

.settings-val {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.settings-val.link {
  color: var(--accent);
  cursor: pointer;
}

/* Onboarding */
.onboard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl) var(--spacing-lg);
  gap: var(--spacing-lg);
}

.onboard-title {
  font-size: 28px;
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
}

.onboard-sub {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
}

.profile-cards {
  display: flex;
  gap: var(--spacing-md);
  width: 100%;
}

.profile-card {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-lg) var(--spacing-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.profile-card:hover {
  background: var(--bg-secondary);
}

.profile-card.selected {
  border: 2px solid var(--accent);
  background: var(--accent-light);
}

.profile-icon {
  font-size: 32px;
}

.profile-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}

.privacy-note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: var(--spacing-md);
  width: 100%;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: var(--spacing-sm);
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-tab.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: transparent;
}

/* SW Update Toast */
.sw-update-toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--spacing-lg) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) var(--spacing-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 200;
  animation: slideUp 0.3s ease;
  white-space: nowrap;
  font-size: var(--fs-sm);
}

.sw-update-toast button {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@media (max-width: 480px) {
  .sw-update-toast {
    left: var(--spacing-md);
    right: var(--spacing-md);
    transform: none;
  }
  @keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--spacing-lg) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: 20px;
  font-size: var(--fs-sm);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* Check-in done state */
.checkin-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--spacing-xl) 0;
  gap: var(--spacing-md);
}

.checkin-done-icon {
  font-size: 64px;
  line-height: 1;
}

.checkin-done-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--accent);
}

.checkin-done-summary {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.checkin-done-row {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.checkin-done-note {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--spacing-xs);
}

/* Theme toggle */
.theme-options {
  display: flex;
  gap: var(--spacing-xs);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.theme-option {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.theme-option.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: var(--fw-medium);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: var(--bg-primary);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Language select */
.lang-select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  cursor: pointer;
}

/* Cycle Calendar */
.cycle-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cycle-nav-month {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  text-transform: capitalize;
}

.cycle-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  transition: background var(--transition);
}

.cycle-nav-btn:hover {
  background: var(--border);
}

.cycle-calendar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  border: 1px solid var(--border);
}

.cycle-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: var(--spacing-sm);
}

.cycle-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-transform: uppercase;
}

.cycle-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cycle-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  position: relative;
  gap: 2px;
}

.cycle-day.empty {
  visibility: hidden;
}

.cycle-day-num {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  line-height: 1;
}

.cycle-day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cycle-day.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Phase colors */
.cycle-day.period,
.cycle-day.period-predicted {
  background: rgba(217, 67, 67, 0.15);
}
.cycle-day.period .cycle-day-num {
  color: #D94343;
  font-weight: var(--fw-bold);
}
.cycle-day.period-predicted .cycle-day-num {
  color: rgba(217, 67, 67, 0.5);
}

.cycle-day.ovulation,
.cycle-day.ovulation-predicted {
  background: rgba(96, 165, 250, 0.15);
}
.cycle-day.ovulation .cycle-day-num {
  color: #3B82F6;
  font-weight: var(--fw-bold);
}
.cycle-day.ovulation-predicted .cycle-day-num {
  color: rgba(59, 130, 246, 0.5);
}

.cycle-day.pms,
.cycle-day.pms-predicted {
  background: rgba(196, 132, 29, 0.12);
}
.cycle-day.pms .cycle-day-num,
.cycle-day.pms-predicted .cycle-day-num {
  color: var(--warning);
}

.cycle-day.follicular {
  background: rgba(26, 157, 116, 0.06);
}

.cycle-day.luteal {
  background: rgba(163, 163, 163, 0.08);
}

/* Legend */
.cycle-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm) var(--spacing-md);
}

.cycle-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.cycle-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cycle-dot.period { background: rgba(217, 67, 67, 0.4); }
.cycle-dot.ovulation { background: rgba(59, 130, 246, 0.4); }
.cycle-dot.pms { background: rgba(196, 132, 29, 0.3); }
.cycle-dot.follicular { background: rgba(26, 157, 116, 0.2); }
.cycle-dot.luteal { background: rgba(163, 163, 163, 0.2); }
.cycle-dot.predicted {
  background: var(--bg-secondary);
  border: 1px dashed var(--text-muted);
}

/* Cycle stats */
.cycle-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.cycle-stat-row:last-child {
  border-bottom: none;
}

.cycle-stat-row strong {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}
