/* ═══════════════════════════════════════
   STORIED FLAVOURS — Profile & Settings
   ═══════════════════════════════════════ */

/* Profile */
.profile-page {
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}

.profile-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('../assets/artistic-silhouettes.png') center / cover no-repeat;
  opacity: 0.18;
  z-index: -1;
  pointer-events: none;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.profile-header h1 { font-size: var(--font-size-3xl); margin-bottom: var(--space-1); }
.profile-email { color: var(--text-muted); font-size: var(--font-size-sm); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.profile-stat {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

a.profile-stat {
  text-decoration: none;
  cursor: pointer;
  color: inherit;
  display: block;
}

.profile-stat:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(200, 90, 31, 0.22), 0 0 0 1.5px rgba(200, 90, 31, 0.18);
}

.profile-stat-value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--color-amber-dark);
  display: flex;
  align-items: baseline;
  justify-content: center;
}

.stat-archive {
  font-size: var(--font-size-3xl);
  font-weight: 800;
}

.stat-divider {
  font-size: var(--font-size-base);
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 var(--space-1);
}

.stat-user {
  font-size: var(--font-size-xl);
  font-weight: 600;
}

.profile-stat-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.profile-stat-context {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
  font-style: italic;
  opacity: 0.75;
}

.profile-section { margin-bottom: var(--space-8); }
.profile-section h2 { font-size: var(--font-size-xl); margin-bottom: var(--space-4); }

/* Settings */
.settings-page {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.settings-page::before {
  content: '';
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: url('../assets/settings-bg.png') center / cover no-repeat;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.settings-page > * {
  position: relative;
  z-index: 1;
}

.settings-page h1 { font-size: var(--font-size-3xl); margin-bottom: var(--space-8); }

.settings-group {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-light);
}

.settings-group h2 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-5);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
}

.settings-row-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.settings-row-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--color-brown-200);
  position: relative;
  cursor: pointer;
  transition: background var(--duration-fast);
  flex-shrink: 0;
}

.toggle.on { background: var(--color-sage); }

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast);
}

.toggle.on::after { transform: translateX(20px); }

/* Search page */
.search-page { max-width: 800px; margin: 0 auto; }
.search-page h1 { font-size: var(--font-size-3xl); margin-bottom: var(--space-6); }

.search-date-filter {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.search-date-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.search-date-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.search-year-input {
  width: 90px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
}

/* hide number input spinners — cleaner look */
.search-year-input::-webkit-inner-spin-button,
.search-year-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.search-year-input { -moz-appearance: textfield; }

.search-date-sep {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.search-results-section { margin-bottom: var(--space-8); }
.search-results-section h2 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-4);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast);
}

.search-result-item:hover {
  background: rgba(141, 110, 99, 0.04);
}

.search-result-icon { font-size: 24px; }
.search-result-title { font-weight: 600; font-size: var(--font-size-sm); }
.search-result-sub { font-size: var(--font-size-xs); color: var(--text-muted); }
.search-result-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}
.search-source-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  background: var(--surface-card);
}
.search-source-badge--recipe {
  color: var(--color-amber-dark);
  border-color: rgba(217, 119, 6, 0.25);
  background: rgba(245, 158, 11, 0.08);
}
.search-source-badge--story {
  color: var(--color-sage-dark);
  border-color: rgba(89, 132, 98, 0.28);
  background: rgba(170, 206, 156, 0.16);
}
.search-source-badge--person {
  color: #4c4f69;
  border-color: rgba(76, 79, 105, 0.22);
  background: rgba(76, 79, 105, 0.08);
}
.search-source-badge--memory {
  color: #6b4f3f;
  border-color: rgba(107, 79, 63, 0.22);
  background: rgba(141, 110, 99, 0.12);
}
.search-source-badge--celebration {
  color: #7c2d12;
  border-color: rgba(194, 65, 12, 0.24);
  background: rgba(251, 146, 60, 0.12);
}
.search-source-badge--audio {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.26);
  background: rgba(45, 212, 191, 0.14);
}
.search-source-badge--kitchen {
  color: #5b21b6;
  border-color: rgba(91, 33, 182, 0.24);
  background: rgba(167, 139, 250, 0.16);
}
.search-source-badge--fire {
  color: #9a3412;
  border-color: rgba(194, 65, 12, 0.24);
  background: rgba(251, 146, 60, 0.16);
}

/* Notifications page */
.notifications-page { max-width: 600px; margin: 0 auto; }
.notifications-page h1 { font-size: var(--font-size-3xl); margin-bottom: var(--space-6); }

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration-fast);
}

.notification-item.unread {
  background: var(--color-amber-light);
  border-radius: var(--radius-md);
  border-bottom: none;
  margin-bottom: var(--space-2);
}

.notification-icon { font-size: 20px; margin-top: 2px; }
.notification-text { font-size: var(--font-size-sm); line-height: 1.5; }
.notification-date { font-size: var(--font-size-xs); color: var(--text-muted); margin-top: var(--space-1); }

/* Subscription Card */
.subscription-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.subscription-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-light);
}

.subscription-plan-name {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.subscription-plan-status {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.subscription-plan-status.active {
  background: var(--color-sage-light);
  color: var(--color-sage-dark);
}

.subscription-plan-status.trial {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}

.subscription-plan-status.inactive {
  background: var(--color-brown-100);
  color: var(--text-muted);
}

.subscription-price {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-amber-dark);
}

.subscription-trial-info,
.subscription-billing-info {
  padding: var(--space-4);
  background: var(--color-cream);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}

.subscription-trial-info p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.subscription-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: var(--font-size-sm);
}

.subscription-info-row span {
  color: var(--text-muted);
}

.subscription-lifetime-badge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--color-sage-light), var(--color-amber-light));
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}

.subscription-lifetime-badge span {
  font-size: 32px;
}

.subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.subscription-payment-method,
.subscription-billing-address {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-light);
}

.subscription-pending-downgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  background: var(--color-amber-light);
  border: 1px solid var(--color-amber);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.subscription-pending-downgrade-text {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.6;
}

.subscription-pending-downgrade-text strong {
  display: block;
  margin-bottom: var(--space-1);
}

/* ── Export Modal ── */
.export-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.export-section-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.export-format-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.export-format-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.export-format-option:hover:not(.disabled) {
  border-color: var(--color-amber);
}

.export-format-option.selected {
  border-color: var(--color-amber);
  background: var(--color-amber-light);
}

.export-format-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.export-format-option input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-amber);
  flex-shrink: 0;
}

.export-format-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-format-info strong {
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.export-format-info span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.export-categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.export-category {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  cursor: pointer;
  padding: var(--space-2) 0;
}

.export-category input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-amber);
  flex-shrink: 0;
}

.export-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-amber-light);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.export-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-amber);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Upgrade Modal ── */
.upgrade-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

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

.upgrade-plan-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.upgrade-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-5) var(--space-4);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast);
  background: var(--surface-card);
}

.upgrade-plan-card:hover {
  border-color: var(--color-amber);
}

.upgrade-plan-card.selected {
  border-color: var(--color-amber);
  background: var(--color-amber-light);
  box-shadow: 0 0 0 1px var(--color-amber);
}

.upgrade-plan-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upgrade-plan-badge {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: white;
  background: var(--color-amber);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}

.upgrade-plan-badge.lifetime {
  background: var(--color-sage);
}

.upgrade-plan-name {
  font-size: var(--font-size-base);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.upgrade-plan-price {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-amber-dark);
  margin-bottom: var(--space-4);
}

.upgrade-plan-price span {
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--text-muted);
}

.upgrade-plan-perks {
  list-style: none;
  text-align: left;
  width: 100%;
}

.upgrade-plan-perks li {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  padding: var(--space-1) 0;
  line-height: 1.5;
}

.upgrade-plan-perks li::before {
  content: "✓ ";
  color: var(--color-sage);
  font-weight: 600;
}

@media (max-width: 768px) {
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-header, .member-hero { flex-direction: column; text-align: center; }
  .upgrade-plan-cards { grid-template-columns: 1fr; }
}

/* ── Delete Account Modal ── */
.delete-account-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.delete-education-icon {
  text-align: center;
  font-size: 48px;
  margin-bottom: var(--space-2);
}

.delete-education-text {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

.delete-timeline-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--space-4) 0;
  margin-left: var(--space-4);
  border-left: 2px solid var(--border-light);
}

.delete-timeline-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  padding-left: var(--space-5);
  position: relative;
}

.delete-timeline-dot {
  position: absolute;
  left: -7px;
  top: var(--space-4);
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full, 50%);
  background: var(--color-amber);
  border: 2px solid var(--surface-elevated, #fff);
}

.delete-timeline-dot.warning {
  background: var(--color-amber-dark);
}

.delete-timeline-dot.danger {
  background: var(--color-red, #dc2626);
}

.delete-timeline-step strong {
  font-size: var(--font-size-sm);
  display: block;
  margin-bottom: var(--space-1);
}

.delete-timeline-step p {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.delete-info-banner {
  background: var(--color-amber-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

.delete-info-banner.warning {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.15);
}

.delete-info-banner p {
  margin: var(--space-2) 0 0 0;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.delete-archive-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.delete-archive-item {
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.delete-archive-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.delete-archive-info strong {
  font-size: var(--font-size-sm);
}

.delete-archive-info span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.delete-archive-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.delete-archive-actions select {
  flex: 1;
}

.delete-confirm-input {
  border-color: var(--color-red, #dc2626) !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  text-align: center;
}

.delete-confirm-input:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
  border-color: var(--color-red, #dc2626) !important;
}

.btn-danger {
  background: var(--color-red, #dc2626);
  color: #fff;
  border: none;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: background 0.2s, opacity 0.2s;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Downgrade Archive Selector ── */
.downgrade-archive-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.downgrade-archive-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.downgrade-archive-option:hover {
  border-color: var(--color-amber);
}

.downgrade-archive-option.selected {
  border-color: var(--color-amber);
  background: var(--color-amber-light);
}

.downgrade-archive-option .archive-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full, 50%);
  background: var(--color-terracotta-light);
  color: var(--color-terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.downgrade-archive-option .archive-details {
  flex: 1;
  min-width: 0;
}

.downgrade-archive-option .archive-details strong {
  display: block;
  font-size: var(--font-size-sm);
}

.downgrade-archive-option .archive-details span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.downgrade-addon-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-cream, #faf7f2);
  border-radius: var(--radius-sm);
}

.downgrade-addon-toggle label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

/* ── Archive Inactive Badge ── */
.archive-inactive-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: var(--radius-full, 50px);
}

.archive-list-item.inactive {
  opacity: 0.6;
}

.archive-list-item.inactive .archive-list-item-name {
  color: var(--text-muted);
}

/* ── Content Limit Banner ── */
.content-limit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
}

.content-limit-banner.ok {
  background: var(--color-sage-light, #f0f5ec);
  color: var(--color-sage-dark, #4a6741);
}

.content-limit-banner.warning {
  background: var(--color-amber-light);
  color: var(--color-amber-dark);
}

.content-limit-banner.full {
  background: rgba(220, 38, 38, 0.06);
  color: var(--color-red, #dc2626);
}

.content-limit-banner .limit-text {
  font-weight: 600;
}

.content-limit-banner .limit-action {
  font-size: var(--font-size-xs);
  text-decoration: underline;
  cursor: pointer;
}
