/* ============================================
   AFTER MOTHERHOOD — Web App Design System
   ============================================ */

/* === DESIGN TOKENS === */
:root {
  --color-primary: #f23643;
  --color-primary-hover: #d42d39;
  --color-primary-light: rgba(242, 54, 67, 0.1);
  --color-bg: #F8F8F6;
  --color-text: #2C2C2C;
  --color-text-secondary: #6b7280;
  --color-white: #FFFFFF;
  --color-success: #22c55e;
  --color-success-light: rgba(34, 197, 94, 0.1);
  --color-warning: #f59e0b;
  --color-border: #e5e7eb;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 600px;
  --radius: 12px;
  --radius-btn: 50px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.1);
  --transition: 0.2s ease;
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
button { font-family: var(--font-main); cursor: pointer; }
input { font-family: var(--font-main); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LAYOUT === */
.app-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 100px;
  min-height: 100vh;
}

/* === APP HEADER === */
.app-header {
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header-logo img {
  height: 36px;
  width: auto;
}

.app-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.app-header-avatar:hover {
  text-decoration: none;
  background: var(--color-primary);
  color: var(--color-white);
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  justify-content: center;
}

.bottom-nav-inner {
  max-width: var(--max-width);
  width: 100%;
  display: flex;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition);
}

.bottom-nav-item:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
}

/* === GREETING === */
.greeting {
  padding: 8px 0 24px;
}

.greeting-hello {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.greeting-name {
  font-size: 24px;
  font-weight: 700;
}

/* === CARDS === */
.card {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

/* === PROGRESS RING === */
.progress-ring-container {
  display: flex;
  align-items: center;
  gap: 24px;
}

.progress-ring-svg {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 8;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.progress-ring-text {
  text-align: left;
}

.progress-ring-count {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.progress-ring-count span {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.progress-ring-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* === STREAK === */
.streak-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  margin-top: 16px;
}

.streak-fire {
  font-size: 24px;
}

.streak-count {
  font-size: 20px;
  font-weight: 700;
}

.streak-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* Streak fire color tiers */
.streak-fire.tier-0 { opacity: 0.4; }
.streak-fire.tier-1 { filter: none; }
.streak-fire.tier-2 { filter: hue-rotate(-10deg) saturate(1.5); }
.streak-fire.tier-3 { filter: hue-rotate(-20deg) saturate(2) brightness(1.1); }

/* === TODAY'S LESSON CARD === */
.today-card {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  display: block;
  text-decoration: none;
  color: var(--color-text);
  border: 2px solid transparent;
}

.today-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
  border-color: var(--color-primary);
}

.today-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.today-card-day {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

.today-card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-transform: uppercase;
}

.today-card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.today-card-meta {
  font-size: 13px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  margin-top: 12px;
  margin-left: auto;
  font-size: 18px;
}

/* === QUICK STATS === */
.quick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-stat {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.quick-stat-value {
  font-size: 24px;
  font-weight: 700;
}

.quick-stat-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* === PROGRAM OVERVIEW === */
.program-week {
  margin-bottom: 24px;
}

.program-week-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-left: 4px;
}

.program-days {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.program-day {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition);
}

.program-day:hover {
  transform: translateX(4px);
  text-decoration: none;
}

.program-day.completed {
  opacity: 0.7;
}

.program-day.current {
  border: 2px solid var(--color-primary);
}

.program-day.upcoming {
  opacity: 0.5;
}

.program-day-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.program-day.completed .program-day-number {
  background: var(--color-success-light);
  color: var(--color-success);
}

.program-day.current .program-day-number {
  background: var(--color-primary);
  color: var(--color-white);
}

.program-day.upcoming .program-day-number {
  background: var(--color-border);
  color: var(--color-text-secondary);
}

.program-day-info {
  flex: 1;
  min-width: 0;
}

.program-day-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.program-day-category {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.program-day-check {
  color: var(--color-success);
  font-size: 20px;
}

/* === LESSON PAGE === */
.lesson-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 12px 0;
}

.lesson-back:hover {
  color: var(--color-text);
  text-decoration: none;
}

.lesson-header {
  margin-bottom: 24px;
}

.lesson-day-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.lesson-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.lesson-category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.lesson-category-badge.awareness {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.lesson-category-badge.action {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.lesson-category-badge.integration {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.lesson-section {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.lesson-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lesson-section-content {
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
}

.lesson-complete-btn {
  width: 100%;
  padding: 18px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 700;
  transition: all var(--transition);
  margin-top: 8px;
}

.lesson-complete-btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.lesson-complete-btn.completed {
  background: var(--color-success);
  pointer-events: none;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  gap: 12px;
}

.lesson-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  transition: all var(--transition);
}

.lesson-nav-btn:hover {
  border-color: var(--color-primary);
  text-decoration: none;
}

/* === LOGIN PAGE === */
.login-wrapper {
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 48px;
  margin: 0 auto;
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.login-tabs {
  display: flex;
  gap: 4px;
  background: var(--color-bg);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}

.login-tab.active {
  background: var(--color-white);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.login-field input {
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
  transition: border-color var(--transition);
}

.login-field input:focus {
  border-color: var(--color-primary);
}

.login-btn {
  padding: 16px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  transition: background var(--transition);
}

.login-btn:hover {
  background: var(--color-primary-hover);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-message {
  text-align: center;
  font-size: 14px;
  padding: 12px;
  border-radius: 8px;
  display: none;
}

.login-message.success {
  display: block;
  background: var(--color-success-light);
  color: var(--color-success);
}

.login-message.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* === SETTINGS PAGE === */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.settings-card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: 15px;
  font-weight: 500;
}

.settings-row-value {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.settings-row-action {
  padding: 8px 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  transition: all var(--transition);
}

.settings-row-action:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.settings-row-action.primary {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.settings-row-action.primary:hover {
  background: var(--color-primary-hover);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-border);
  border-radius: 28px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: var(--color-white);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--color-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* === RENEW PAGE === */
.renew-wrapper {
  max-width: 440px;
  margin: 0 auto;
  padding: 60px 20px;
  text-align: center;
}

.renew-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.renew-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.renew-text {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.renew-btn {
  display: inline-block;
  padding: 16px 32px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition);
}

.renew-btn:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

/* === MILESTONE CELEBRATION === */
.milestone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.milestone-card {
  background: var(--color-white);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: milestoneSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes milestoneSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.milestone-emoji {
  font-size: 56px;
  margin-bottom: 16px;
}

.milestone-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.milestone-text {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.milestone-btn {
  padding: 14px 32px;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.milestone-btn:hover {
  background: var(--color-primary-hover);
}

/* === LOADING STATE === */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.app-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === PASSWORD MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal-card {
  background: var(--color-white);
  border-radius: 16px;
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  animation: milestoneSlideUp 0.3s ease;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form input {
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
}

.modal-form input:focus {
  border-color: var(--color-primary);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  border: none;
}

.modal-cancel {
  background: var(--color-bg);
  color: var(--color-text);
}

.modal-confirm {
  background: var(--color-primary);
  color: var(--color-white);
}

/* === RESPONSIVE === */
@media (max-width: 400px) {
  .app-wrapper {
    padding: 0 16px 100px;
  }

  .progress-ring-svg {
    width: 100px;
    height: 100px;
  }

  .greeting-name {
    font-size: 22px;
  }
}
