/*
 * Profile & Settings Page Styles
 * Mobile-first: base styles are mobile, min-width scales up
 */

/* Profile Header */
.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  width: 100%;
}

.profile-greeting {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.025em;
  margin: 0;
}

@media (min-width: 480px) {
  .profile-greeting {
    font-size: 1.75rem;
  }
}

.profile-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--gray-400);
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.profile-settings-btn:hover {
  color: var(--gray-200);
  background: var(--gray-800);
}

/* Profile Cards */
.profile-card {
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  /* No overflow:hidden — it clips position:fixed sheets on iOS Safari.
     Rounded corners are preserved because border-radius alone is sufficient. */
  width: 100%;
}

.profile-card-disabled {
  opacity: 0.5;
}

.profile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
}

.profile-card-header h3 {
  margin: 0;
  font-size: 0.9375rem;
}

.profile-badge-soon {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--gray-500);
  background: var(--gray-800);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* Profile Fields (inside cards) */
.profile-card .profile-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--gray-800);
  margin: 0;
  background: none;
  border-radius: 0;
}

.profile-card .profile-field:first-child {
  border-top: none;
}

.profile-empty {
  padding: var(--space-4) var(--space-5);
  color: var(--gray-500);
  font-size: 0.875rem;
  border-top: 1px solid var(--gray-800);
}

/* Settings Header */
.settings-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  width: 100%;
}

.settings-header h1 {
  font-size: 1.5rem;
  margin: 0;
}

@media (min-width: 480px) {
  .settings-header h1 {
    font-size: 1.75rem;
  }
}

.settings-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--gray-400);
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.settings-back:hover {
  color: var(--gray-200);
  background: var(--gray-800);
}

/* Settings Navigation List */
.settings-list {
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
  width: 100%;
}

.settings-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  color: var(--gray-200);
  text-decoration: none;
  border-top: 1px solid var(--gray-800);
  transition: background 0.15s ease;
  /* 44px minimum touch target */
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  text-align: left;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  font-family: "Geist Mono", monospace;
  font-size: 0.9375rem;
  cursor: pointer;
}

.settings-list-item:first-child {
  border-top: none;
}

.settings-list-item:hover {
  background: var(--gray-800);
  color: var(--gray-200);
}

.settings-list-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  flex-shrink: 0;
  width: 24px;
}

.settings-list-label {
  flex: 1;
  font-weight: 500;
}

.settings-list-chevron {
  color: var(--gray-600);
  flex-shrink: 0;
}

/* Disabled items */
.settings-list-item-disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.settings-list-item-disabled:hover {
  background: none;
}

/* Danger item (log out) */
.settings-list-item-danger {
  border-top: none;
}

.settings-list-item-danger .settings-list-icon {
  color: #ef4444;
}

.settings-list-item-danger .settings-list-label {
  color: #fca5a5;
}

.settings-list-item-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================================
   ACCOUNT ROW — label left, value right (used in Tracking Settings)
   ============================================================ */

.account-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--gray-800);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  min-height: 52px;
  gap: var(--space-3);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
  font-family: "Geist Mono", monospace;
}

.account-row:hover {
  background: var(--gray-800);
}

.account-row-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #fff;
  flex: 1;
  text-align: left;
}

.account-row-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--blue-500);
  font-family: "Geist Mono", monospace;
}

.account-row-chevron {
  color: var(--gray-600);
  flex-shrink: 0;
}

/* "Clear start date" sub-row */
.account-row-sub {
  padding: var(--space-1) var(--space-5) var(--space-3);
  border-top: none;
}

.account-row-sub form {
  flex-direction: row;
  gap: 0;
}

.account-clear-btn {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.8125rem;
  font-family: "Geist Mono", monospace;
  cursor: pointer;
  padding: var(--space-2) 0;
  min-height: 36px;
  text-align: left;
}

.account-clear-btn:hover {
  color: #fca5a5;
}

/* ============================================================
   DATE PICKER SHEET — three-column drum-roll (Day | Month | Year)
   ============================================================ */

.dp-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.dp-sheet.open {
  opacity: 1;
  pointer-events: auto;
}

.dp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.dp-panel {
  position: relative;
  z-index: 1;
  background: var(--gray-900);
  border-top: 1px solid var(--gray-800);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-4);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  transform: translateY(20px);
  transition: transform 0.28s ease;
}

.dp-sheet.open .dp-panel {
  transform: translateY(0);
}

.dp-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin: 0 0 var(--space-4);
  padding: 0 var(--space-2);
}

/* ---- Three columns side by side ---- */

.dp-pickers {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  margin-bottom: var(--space-5);
}

.dp-col-wrap {
  flex: 1;
  position: relative;
  height: 168px; /* 3 × 56px */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Scrollable list */
.dp-list {
  height: 168px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  position: relative;
  z-index: 1;
}

.dp-list::-webkit-scrollbar {
  display: none;
}

/* Items */
.dp-item {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--gray-600);
  scroll-snap-align: start;
  font-family: "Geist Mono", monospace;
  transition: color 0.15s ease, font-size 0.15s ease;
  cursor: pointer;
}

.dp-item--selected {
  color: #fff;
  font-size: 1.625rem;
  font-weight: 700;
}

.dp-padding {
  pointer-events: none;
}

/* Gradient masks — top and bottom fade */
.dp-mask {
  position: absolute;
  left: 0;
  right: 0;
  height: 56px;
  pointer-events: none;
  z-index: 2;
}

.dp-mask-top {
  top: 0;
  background: linear-gradient(to bottom, var(--gray-900) 0%, transparent 100%);
}

.dp-mask-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--gray-900) 0%, transparent 100%);
}

/* Selection indicator lines */
.dp-selector {
  position: absolute;
  top: 50%;
  left: var(--space-2);
  right: var(--space-2);
  margin-top: -28px;
  height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 3;
}

.dp-selector-line {
  height: 1px;
  background: var(--gray-700);
  width: 100%;
}

/* Cancel / Ok buttons */
.dp-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-6);
  padding: 0 var(--space-2);
}

.dp-btn-cancel,
.dp-btn-ok {
  background: none;
  border: none;
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: "Geist Mono", monospace;
  color: var(--blue-500);
  cursor: pointer;
  min-height: 44px;
  padding: var(--space-2) 0;
  letter-spacing: 0.04em;
}

.dp-btn-cancel {
  color: var(--gray-400);
}

/* Hidden-input-only forms — reset global form flex layout */
.pi-inline-form {
  display: contents;
}

/* ============================================================
   PERSONAL INFORMATION — section title + bordered rows
   ============================================================ */

.account-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: var(--space-6) 0 var(--space-3);
  font-family: "Geist Mono", monospace;
}

/* Rows inside the card that need a top border divider */
.account-row--bordered {
  border-top: 1px solid var(--gray-800);
}

/* ============================================================
   PI SHEET — shared bottom-sheet shell for name / sex / height
   ============================================================ */

.pi-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pi-sheet.open {
  opacity: 1;
  pointer-events: auto;
}

.pi-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.pi-panel {
  position: relative;
  z-index: 1;
  background: var(--gray-900);
  border-top: 1px solid var(--gray-800);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  transform: translateY(20px);
  transition: transform 0.28s ease;
}

.pi-sheet.open .pi-panel {
  transform: translateY(0);
}

/* ---- Name editor panel ---- */

.pi-panel--form {
  padding-top: var(--space-6);
}

.pi-form-group {
  border-bottom: 1px solid var(--gray-700);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}

.pi-form-group--last {
  border-bottom: none;
  margin-bottom: var(--space-5);
}

.pi-input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  font-family: "Geist Mono", monospace;
  margin-bottom: var(--space-2);
  letter-spacing: 0.03em;
}

.pi-text-input {
  display: block;
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: 1.125rem;
  font-weight: 500;
  color: #fff;
  font-family: "Geist Mono", monospace;
  padding: var(--space-1) 0;
  caret-color: var(--blue-500);
}

.pi-text-input::placeholder {
  color: var(--gray-600);
}

/* Shared Cancel / Ok actions */
.pi-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-6);
}

.pi-btn-cancel,
.pi-btn-ok {
  background: none;
  border: none;
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: "Geist Mono", monospace;
  color: var(--blue-500);
  cursor: pointer;
  min-height: 44px;
  padding: var(--space-2) 0;
  letter-spacing: 0.04em;
}

.pi-btn-cancel {
  color: var(--gray-400);
}

/* ---- Sex picker panel ---- */

.pi-panel--options {
  padding-top: var(--space-3);
}

.pi-drag-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-700);
  border-radius: 2px;
  margin: 0 auto var(--space-4);
}

.pi-options-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  font-family: "Geist Mono", monospace;
  margin: 0 0 var(--space-4);
}

.pi-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) 0;
  background: none;
  border: none;
  border-top: 1px solid var(--gray-800);
  cursor: pointer;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease;
}

.pi-option:first-of-type {
  border-top: none;
}

.pi-option:hover {
  background: var(--gray-800);
}

.pi-option-label {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  font-family: "Geist Mono", monospace;
}

.pi-option-check {
  color: var(--blue-500);
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.pi-option-check--visible {
  opacity: 1;
}

/* ---- Height picker panel ---- */

.pi-panel--picker {
  padding-top: var(--space-5);
}

.pi-panel--picker .dp-col-wrap {
  width: 200px;
  margin: 0 auto var(--space-5);
}

/* ============================================================
   Settings Footer */
.settings-footer-actions {
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}

.settings-version {
  text-align: center;
  color: var(--gray-600);
  font-size: 0.75rem;
  padding: var(--space-6) 0;
  margin: 0;
}

/* ============================================================
   REMINDERS PAGE
   ============================================================ */

/* Toggle switch */
.reminder-toggle-row {
  cursor: default;
  border-top: none;
}

.reminder-toggle-row:hover {
  background: none;
}

.reminder-toggle {
  position: relative;
  width: 51px;
  height: 31px;
  background: var(--gray-700);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.reminder-toggle--on {
  background: var(--blue-500);
}

.reminder-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 25px;
  height: 25px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.reminder-toggle--on .reminder-toggle-thumb {
  transform: translateX(20px);
}

/* Time row wrapper hidden state */
.reminder-time-row-wrap.hidden {
  display: none;
}

/* Colon separator between hour and minute drums */
.dp-col-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  font-family: "Geist Mono", monospace;
  padding-bottom: var(--space-5);
  flex-shrink: 0;
}

/* Test notification button */
.reminder-test-btn {
  display: block;
  width: 100%;
  padding: var(--space-4);
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  color: var(--blue-500);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: "Geist Mono", monospace;
  cursor: pointer;
  min-height: 52px;
  margin-bottom: var(--space-4);
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.reminder-test-btn:hover {
  background: var(--gray-800);
}

.reminder-test-btn--secondary {
  color: var(--gray-400);
  margin-top: calc(-1 * var(--space-2));
}

/* Hint text below the card */
.reminder-hint {
  font-size: 0.8125rem;
  color: var(--gray-600);
  line-height: 1.6;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-2);
}

/* ── Account Information ──────────────────────────────── */

/* Static (non-interactive) account row — email display */
.account-row--static {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  gap: var(--space-3);
  cursor: default;
}

/* Inline error message inside password bottom sheet */
.pi-field-error {
  font-size: 0.8125rem;
  color: #ff4d4f;
  min-height: 1.25rem;
  padding: 0 var(--space-1) var(--space-2);
  margin: 0;
}
