/* Profile page styles */

/* ── Profile view (logged-in) ── */
.profile-view {
  max-width: min(428px, 100%);
  margin: 0 auto;
  padding: var(--space-lg) var(--screen-padding);
  padding-bottom: calc(var(--tab-bar-height) + var(--space-xl));
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) 0 var(--space-lg);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--sage-100, #E8EDE5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  color: var(--sage-400, #87A878);
}

.profile-avatar svg {
  width: 40px;
  height: 40px;
}

.profile-avatar-initials {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--sage-500, #6B8F5B);
  letter-spacing: 1px;
}

.profile-name {
  font: var(--text-h2);
  margin: 0;
}

.profile-email {
  font: var(--text-caption);
  margin-top: var(--space-xs);
}

/* ── Become a Member bubble ── */
.profile-member-bubble {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  margin-top: var(--space-md);
  background: linear-gradient(135deg, var(--sage-50, #F4F7F2) 0%, #FFF9F0 100%);
  border: 1.5px solid var(--carrot-light, #F09556);
  border-radius: var(--card-radius);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.profile-member-bubble:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.member-bubble-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--carrot-light, #F09556);
  border-radius: 50%;
  flex-shrink: 0;
  color: #fff;
}

.member-bubble-icon svg {
  width: 18px;
  height: 18px;
}

.member-bubble-content {
  flex: 1;
  min-width: 0;
}

.member-bubble-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.member-bubble-text {
  font: var(--text-caption);
  color: var(--color-text-secondary);
  margin: 2px 0 0;
}

/* ── Pro Member badge (active subscribers) ── */
.profile-pro-badge {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: linear-gradient(135deg, #FFF9F0 0%, #FEF3E8 40%, #FFF5EE 100%);
  border: 1.5px solid var(--carrot-light, #F09556);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.pro-badge-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pro-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--carrot-light, #F09556), var(--carrot, #E8702A));
  border-radius: 50%;
  flex-shrink: 0;
  color: #fff;
}

.pro-badge-icon svg {
  width: 20px;
  height: 20px;
}

.pro-badge-info {
  flex: 1;
  min-width: 0;
}

.pro-badge-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.pro-badge-plan {
  font: var(--text-caption);
  color: var(--color-text-secondary);
}

.pro-badge-status {
  padding: 4px 10px;
  background: var(--sage-100, #E8EDE5);
  color: var(--sage-500, #6B8F5B);
  font-family: var(--font-body);
  font-size: var(--font-size-xs, 0.7rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 20px;
  flex-shrink: 0;
}

.pro-badge-status--trialing {
  background: #FFF3E0;
  color: var(--carrot, #E8702A);
}

.pro-badge-status--canceling {
  background: #FFF3E0;
  color: #BF6900;
}

/* Cancellation warning */
.pro-badge-warning {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding: 10px 12px;
  background: #FFF8E1;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-sm, 0.85rem);
  color: #BF6900;
}

.pro-badge-warning svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Renewal info */
.pro-badge-renewal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(240, 149, 86, 0.2);
}

.pro-badge-renewal-label {
  font: var(--text-caption);
  color: var(--color-text-secondary);
}

.pro-badge-renewal-date {
  font-family: var(--font-body);
  font-size: var(--font-size-sm, 0.85rem);
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Perks list */
.pro-badge-perks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(240, 149, 86, 0.2);
}

.pro-badge-perk {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--font-size-sm, 0.85rem);
  color: var(--color-text-secondary);
}

.pro-badge-perk svg {
  width: 15px;
  height: 15px;
  color: var(--sage-400, #87A878);
  flex-shrink: 0;
}

/* Manage subscription button */
.pro-badge-manage-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-md);
  padding: 12px;
  background: none;
  border: 1.5px solid var(--carrot, #E8702A);
  border-radius: var(--radius-md);
  color: var(--carrot, #E8702A);
  font-family: var(--font-body);
  font-size: var(--font-size-sm, 0.85rem);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pro-badge-manage-btn:active {
  background: var(--carrot, #E8702A);
  color: #fff;
}

.pro-badge-manage-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Menu sections ── */
.profile-section {
  margin-top: var(--space-lg);
}

.profile-section-title {
  font: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-xs);
}

.profile-menu {
  background: var(--color-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px var(--space-md);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  gap: var(--space-sm);
  -webkit-tap-highlight-color: transparent;
}

.profile-menu-item:last-child {
  border-bottom: none;
}

.profile-menu-item:active {
  background: var(--sage-50, #F4F7F2);
}

.profile-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--sage-400, #87A878);
  flex-shrink: 0;
}

.profile-menu-icon svg {
  width: 20px;
  height: 20px;
}

.profile-menu-arrow {
  margin-left: auto;
  color: var(--color-text-secondary);
  font-size: 1.25rem;
  line-height: 1;
}

/* ── Logout button ── */
.profile-logout-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-xl);
  padding: 14px;
  background: none;
  border: 1px solid var(--color-error, #C0392B);
  border-radius: var(--radius-md);
  color: var(--color-error, #C0392B);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.profile-logout-btn:active {
  background: var(--color-error, #C0392B);
  color: #fff;
}

/* ── Auth section within profile page ── */
.profile-auth .auth-wrap {
  padding-top: var(--space-lg);
  min-height: auto;
  padding-bottom: calc(var(--tab-bar-height) + var(--space-xl));
}


/* ═══════════════════════════════════════════════════
   SLIDE-IN PANELS
   ═══════════════════════════════════════════════════ */
.profile-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--color-canvas, #FAFAF9);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0.0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.profile-panel--open {
  transform: translateX(0);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  padding: 12px var(--screen-padding);
  padding-top: calc(var(--safe-top, 0px) + 12px);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.profile-panel-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--sage-400, #87A878);
  border-radius: 50%;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.profile-panel-back:active {
  background: var(--sage-50, #F4F7F2);
}

.profile-panel-back svg {
  width: 22px;
  height: 22px;
}

.profile-panel-title {
  flex: 1;
  text-align: center;
  font: var(--text-h2);
  font-size: 1.1rem;
  margin: 0;
}

.profile-panel-spacer {
  width: 36px;
}

.profile-panel-body {
  max-width: min(428px, 100%);
  margin: 0 auto;
  padding: var(--space-lg) var(--screen-padding);
  padding-bottom: calc(var(--tab-bar-height) + var(--space-xl));
}


/* ═══════════════════════════════════════════════════
   EDIT PROFILE PANEL
   ═══════════════════════════════════════════════════ */
.profile-edit-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--sage-100, #E8EDE5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  color: var(--sage-400, #87A878);
}

.profile-edit-avatar svg {
  width: 40px;
  height: 40px;
}

.profile-edit-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-field-label {
  font: var(--text-caption);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.profile-field-input {
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: border-color 0.15s;
  outline: none;
}

.profile-field-input:focus {
  border-color: var(--sage-400, #87A878);
}

.profile-field-static {
  font: var(--text-body);
  color: var(--color-text-secondary);
  margin: 0;
  padding: 4px 0;
}

.profile-save-btn {
  margin-top: var(--space-sm);
  padding: 14px;
  background: var(--sage-400, #87A878);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.profile-save-btn:active {
  background: var(--sage-500, #6E9460);
}

.profile-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-success {
  font: var(--text-caption);
  color: var(--color-success, #4CAF50);
  text-align: center;
  padding: var(--space-sm);
  background: #E8F5E9;
  border-radius: var(--radius-md);
}


/* ═══════════════════════════════════════════════════
   PREFERENCES PANEL
   ═══════════════════════════════════════════════════ */
.pref-group {
  margin-bottom: var(--space-lg);
}

.pref-group-title {
  font: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-sm);
}

.pref-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.pref-item:last-of-type {
  border-bottom: none;
}

.pref-item-text {
  flex: 1;
  min-width: 0;
}

.pref-item-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text-primary);
}

.pref-item-desc {
  display: block;
  font: var(--text-caption);
  color: var(--color-text-muted);
  margin-top: 2px;
}

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

.pref-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pref-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 28px;
  transition: background 0.2s;
}

.pref-toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pref-toggle input:checked + .pref-toggle-slider {
  background: var(--sage-400, #87A878);
}

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

/* Danger button (clear history) */
.pref-danger-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-md);
  padding: 12px;
  background: none;
  border: 1px solid var(--color-error, #B71C1C);
  border-radius: var(--radius-md);
  color: var(--color-error, #B71C1C);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pref-danger-btn:active {
  background: var(--color-error, #B71C1C);
  color: #fff;
}


/* ═══════════════════════════════════════════════════
   HELP & FAQ PANEL
   ═══════════════════════════════════════════════════ */
.faq-list {
  display: flex;
  flex-direction: column;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  text-align: left;
  gap: var(--space-sm);
  -webkit-tap-highlight-color: transparent;
}

.faq-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform 0.25s ease;
}

.faq-item--open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0;
}

.faq-item--open .faq-answer {
  max-height: 300px;
  padding-bottom: 16px;
}

.faq-answer p {
  font: var(--text-body);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}


/* ═══════════════════════════════════════════════════
   ABOUT PANEL
   ═══════════════════════════════════════════════════ */
.about-logo-section {
  text-align: center;
  padding: var(--space-lg) 0;
}

.about-logo {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--sage-400, #87A878);
  margin: 0;
}

.about-version {
  font: var(--text-caption);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.about-section {
  margin-bottom: var(--space-lg);
}

.about-heading {
  font: var(--text-h3);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-sm);
}

.about-text {
  font: var(--text-body);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.about-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 500;
  transition: background 0.15s;
}

.about-link:active {
  background: var(--sage-50, #F4F7F2);
}

.about-link svg {
  width: 20px;
  height: 20px;
  color: var(--sage-400, #87A878);
  flex-shrink: 0;
}

.about-copyright {
  font: var(--text-caption);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-xl);
}


/* ═══════════════════════════════════════════════════
   MEMBERSHIP PANEL
   ═══════════════════════════════════════════════════ */
.membership-hero {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-lg);
}

.membership-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: linear-gradient(135deg, var(--carrot-light, #F09556), var(--carrot, #E8702A));
  border-radius: 50%;
  color: #fff;
}

.membership-icon svg {
  width: 32px;
  height: 32px;
}

.membership-title {
  font: var(--text-display);
  font-size: 1.5rem;
  color: var(--color-text-primary);
  margin: 0;
}

.membership-subtitle {
  font: var(--text-body);
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

.membership-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.membership-feature {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
}

.membership-feature svg {
  width: 18px;
  height: 18px;
  color: var(--sage-400, #87A878);
  flex-shrink: 0;
}

.membership-pricing {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.membership-plan {
  position: relative;
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--card-radius);
  text-align: center;
}

.membership-plan--popular {
  border-color: var(--carrot, #E8702A);
}

.membership-plan-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  background: var(--carrot, #E8702A);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 20px;
  white-space: nowrap;
}

.membership-plan-name {
  font: var(--text-h3);
  margin: 0 0 var(--space-sm);
}

.membership-plan-price {
  margin: 0;
}

.membership-price-amount {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.membership-price-period {
  font: var(--text-caption);
  color: var(--color-text-muted);
}

.membership-plan-savings {
  font: var(--text-caption);
  color: var(--sage-400, #87A878);
  margin: var(--space-xs) 0 var(--space-md);
}

.membership-plan-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--carrot, #E8702A);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.membership-plan-btn:active {
  background: var(--carrot-dark, #C55A1C);
}

.membership-plan-btn--outline {
  background: none;
  border: 1.5px solid var(--carrot, #E8702A);
  color: var(--carrot, #E8702A);
}

.membership-plan-btn--outline:active {
  background: #FFF5EE;
}

.membership-note {
  font: var(--text-caption);
  color: var(--color-text-muted);
  text-align: center;
}


/* ═══════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════ */
.profile-toast {
  position: fixed;
  bottom: calc(var(--tab-bar-height, 64px) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: var(--color-text-primary, #2D2D2D);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 300;
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
}

.profile-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
