/* Profile / My Account page — Readers Bookshop */

/* ── Page canvas ─────────────────────────────────────── */
.profile-page {
  background: #f0ede8;
  min-height: 100vh;
}

/* ── Flash alerts (success / error) ──────────────────── */
.pf-alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.pf-alert i {
  margin-right: 0.4rem;
}

.pf-alert p {
  margin: 0.1rem 0;
}

.pf-alert--success {
  background: rgba(46, 125, 50, 0.07);
  border: 1px solid rgba(46, 125, 50, 0.2);
  color: #2e7d32;
}

.pf-alert--error {
  background: rgba(196, 30, 58, 0.07);
  border: 1px solid rgba(196, 30, 58, 0.2);
  color: #9e1530;
}

/* ── Page header band ────────────────────────────────── */
.profile-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #152238 0%, #1e3255 55%, #0e1a2e 100%);
  padding: clamp(1.75rem, 4vw, 2.75rem) var(--layout-gutter, clamp(0.9375rem, 2.85vw, 1.875rem));
}

.profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 100% at 100% 50%, rgba(196, 30, 58, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 80% at 0% 0%, rgba(255,255,255,0.04) 0%, transparent 55%);
  pointer-events: none;
}

.profile-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='1' cy='1' r='0.7' fill='%23ffffff' fill-opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

.profile-hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--layout-max, 1320px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.75rem);
  flex-wrap: wrap;
}

.profile-hero__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.18s;
  white-space: nowrap;
  margin-bottom: 0.75rem;
  display: block;
}

.profile-hero__back:hover { color: rgba(255,255,255,0.9); }

.profile-hero__avatar {
  position: relative;
  flex-shrink: 0;
  width: clamp(3.5rem, 8vw, 5rem);
  height: clamp(3.5rem, 8vw, 5rem);
  border-radius: 50%;
  background: linear-gradient(135deg, #c41e3a 0%, #8b1228 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15), 0 4px 20px rgba(0,0,0,0.3);
  user-select: none;
}

.profile-hero__avatar-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #f4c430;
  border: 2px solid #152238;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: #152238;
}

.profile-hero__info {
  flex: 1;
  min-width: 0;
}

.profile-hero__name {
  margin: 0 0 0.2rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.35rem, 1rem + 1.5vw, 1.85rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.profile-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: rgba(196, 30, 58, 0.22);
  border: 1px solid rgba(196, 30, 58, 0.35);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #f97b8e;
}

.profile-hero__member {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
}

/* ── Main layout ─────────────────────────────────────── */
.profile-layout {
  max-width: var(--layout-max, 1320px);
  margin: 0 auto;
  padding: clamp(1.5rem, 3.5vw, 2.5rem) var(--layout-gutter, clamp(0.9375rem, 2.85vw, 1.875rem))
    clamp(3rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  align-items: start;
}

/* ── Sidebar nav ─────────────────────────────────────── */
.profile-nav {
  position: sticky;
  top: 88px;
  background: #fff;
  border: 1px solid #e4e0da;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.profile-nav__heading {
  padding: 0.85rem 1.1rem 0.65rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  border-bottom: 1px solid #f0ede8;
}

.profile-nav__list {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
}

.profile-nav__item {
  margin: 0;
}

.profile-nav__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1.1rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.825rem;
  font-weight: 600;
  color: #555;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.profile-nav__link i {
  width: 1rem;
  text-align: center;
  font-size: 0.825rem;
  color: #bbb;
  transition: color 0.15s;
  flex-shrink: 0;
}

.profile-nav__link:hover {
  background: #faf8f5;
  color: #1a1a1a;
}

.profile-nav__link:hover i { color: #888; }

.profile-nav__link.is-active {
  background: rgba(196, 30, 58, 0.05);
  color: #c41e3a;
  border-left-color: #c41e3a;
  font-weight: 700;
}

.profile-nav__link.is-active i { color: #c41e3a; }

/* ── Main content column ─────────────────────────────── */
.profile-main {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
  min-width: 0;
}

/* ── Cards ───────────────────────────────────────────── */
.profile-card {
  background: #fff;
  border: 1px solid #e4e0da;
  border-radius: 18px;
  overflow: visible;
  box-shadow: 0 2px 16px rgba(0,0,0,0.055);
  transition: box-shadow 0.2s;
}

.profile-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.1rem, 2.5vw, 1.4rem) clamp(1.25rem, 3vw, 1.75rem);
  border-bottom: 1px solid #f0ede8;
}

.profile-card__title-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.profile-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(196, 30, 58, 0.10) 0%, rgba(196, 30, 58, 0.06) 100%);
  color: #c41e3a;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.profile-card__title {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1rem, 0.85rem + 0.6vw, 1.2rem);
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.015em;
}

.profile-card__subtitle {
  margin: 0.15rem 0 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.775rem;
  color: #999;
}

.profile-card__body {
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

/* ── Form grid ───────────────────────────────────────── */
.pf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.25rem;
}

.pf-col-full { grid-column: 1 / -1; }

/* ── Field ───────────────────────────────────────────── */
.pf-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pf-field label {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.775rem;
  font-weight: 700;
  color: #3a3a3a;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.pf-field label .pf-required {
  color: #c41e3a;
  font-size: 0.85em;
}

.pf-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pf-input-wrap .pf-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #bbb;
  font-size: 0.85rem;
  pointer-events: none;
  transition: color 0.18s;
}

.pf-field input,
.pf-field select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.95rem;
  border: 1.5px solid #ddd8d2;
  border-radius: 10px;
  background: #faf9f7;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  color: #1a1a1a;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  outline: none;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.pf-field input.has-icon,
.pf-field select.has-icon {
  padding-left: 2.4rem;
}

.pf-field input:hover,
.pf-field select:hover {
  border-color: #c5c0b9;
  background: #fff;
}

.pf-field input:focus,
.pf-field select:focus {
  border-color: #c41e3a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.pf-field input:focus ~ .pf-input-icon,
.pf-field select:focus ~ .pf-input-icon,
.pf-input-wrap:focus-within .pf-input-icon {
  color: #c41e3a;
}

/* Select arrow */
.pf-select-wrap {
  position: relative;
}

.pf-select-wrap .pf-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #bbb;
  font-size: 0.85rem;
  pointer-events: none;
  transition: color 0.18s;
  z-index: 1;
}

.pf-select-wrap::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: #bbb;
  pointer-events: none;
}

.pf-select-wrap select {
  padding-right: 2.4rem;
  cursor: pointer;
}

/* Error state */
.pf-field.has-error input,
.pf-field.has-error select {
  border-color: #c41e3a;
  background: rgba(196, 30, 58, 0.03);
}

.pf-error-msg {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.73rem;
  color: #c41e3a;
  font-weight: 600;
  display: none;
}

.pf-field.has-error .pf-error-msg {
  display: block;
}

/* ── Gender radio group ───────────────────────────────── */
.pf-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
}

.pf-radio-opt {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
}

.pf-radio-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.pf-radio-opt__label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #ddd8d2;
  border-radius: 10px;
  background: #faf9f7;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.825rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
  text-align: center;
  white-space: nowrap;
}

.pf-radio-opt__label i {
  font-size: 0.85rem;
  color: #bbb;
  transition: color 0.18s;
}

.pf-radio-opt input[type="radio"]:checked + .pf-radio-opt__label {
  border-color: #c41e3a;
  background: rgba(196, 30, 58, 0.05);
  color: #c41e3a;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.pf-radio-opt input[type="radio"]:checked + .pf-radio-opt__label i {
  color: #c41e3a;
}

.pf-radio-opt input[type="radio"]:focus-visible + .pf-radio-opt__label {
  outline: 2px solid rgba(196, 30, 58, 0.45);
  outline-offset: 2px;
}

/* ── Password field ──────────────────────────────────── */
.pf-password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.pf-password-wrap input {
  padding-right: 3rem;
}

.pf-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: color 0.15s, background 0.15s;
}

.pf-password-toggle:hover {
  color: #c41e3a;
  background: rgba(196, 30, 58, 0.07);
}

.pf-password-toggle:focus-visible {
  outline: 2px solid rgba(196, 30, 58, 0.4);
  outline-offset: 1px;
}

/* Password strength bar */
.pf-strength {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.pf-strength__bars {
  display: flex;
  gap: 3px;
  flex: 1;
}

.pf-strength__bar {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: #e4e0da;
  transition: background 0.25s;
}

.pf-strength__bar.active-1 { background: #c41e3a; }
.pf-strength__bar.active-2 { background: #e87722; }
.pf-strength__bar.active-3 { background: #d4a017; }
.pf-strength__bar.active-4 { background: #2e7d32; }

.pf-strength__label {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #bbb;
  min-width: 4rem;
  text-align: right;
  transition: color 0.25s;
}


/* ── Form divider ─────────────────────────────────────── */
.pf-divider {
  height: 1px;
  background: #f0ede8;
  margin: 0.25rem 0;
}

/* ── Hint text ───────────────────────────────────────── */
.pf-hint {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  color: #aaa;
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ── Save bar ─────────────────────────────────────────── */
.pf-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.pf-unsaved-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e87722;
  opacity: 0;
  transition: opacity 0.25s;
}

.pf-unsaved-tag.is-visible { opacity: 1; }

.pf-unsaved-tag i { font-size: 0.75rem; }

.pf-save-actions {
  display: flex;
  gap: 0.65rem;
  margin-left: auto;
}

/* ── Buttons ─────────────────────────────────────────── */
.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, filter 0.2s;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.pf-btn:active { transform: scale(0.97); }

.pf-btn--primary {
  background: linear-gradient(180deg, #e93142 0%, #e31e2f 45%, #c91828 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(196, 30, 58, 0.32);
}

.pf-btn--primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(196, 30, 58, 0.42);
}

.pf-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.pf-btn--ghost {
  background: transparent;
  color: #666;
  border: 1.5px solid #ddd8d2;
}

.pf-btn--ghost:hover {
  background: #f0ede8;
  border-color: #ccc;
  color: #333;
}

.pf-btn--success {
  background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(46, 125, 50, 0.3);
  pointer-events: none;
}

/* ── Toast notification ──────────────────────────────── */
.pf-toast {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  background: #152238;
  color: #fff;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
}

.pf-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pf-toast i { color: #4caf50; }

/* ── Dark mode ───────────────────────────────────────── */
[data-theme="dark"] .profile-page {
  background: #0d1018;
}

[data-theme="dark"] .profile-hero {
  background: linear-gradient(135deg, #0d1018 0%, #111520 55%, #080d16 100%);
}

[data-theme="dark"] .profile-nav {
  background: #141820;
  border-color: #22262e;
}

[data-theme="dark"] .profile-nav__heading {
  color: #3a3a44;
  border-color: #1c2028;
}

[data-theme="dark"] .profile-nav__link {
  color: #6a6878;
}

[data-theme="dark"] .profile-nav__link:hover {
  background: #1a1e28;
  color: #d0cec8;
}

[data-theme="dark"] .profile-nav__link i { color: #3a3a44; }
[data-theme="dark"] .profile-nav__link:hover i { color: #666; }

[data-theme="dark"] .profile-nav__link.is-active {
  background: rgba(196, 30, 58, 0.08);
  color: #e85a6b;
  border-left-color: #c41e3a;
}

[data-theme="dark"] .profile-nav__link.is-active i { color: #e85a6b; }

[data-theme="dark"] .profile-card {
  background: #141820;
  border-color: #22262e;
}

[data-theme="dark"] .profile-card__header {
  border-color: #1c2028;
}

[data-theme="dark"] .profile-card__title { color: #f0ece2; }
[data-theme="dark"] .profile-card__subtitle { color: #4a4858; }

[data-theme="dark"] .profile-card__icon {
  background: rgba(196, 30, 58, 0.15);
}

[data-theme="dark"] .pf-field label { color: #8a8898; }

[data-theme="dark"] .pf-field input,
[data-theme="dark"] .pf-field select {
  background: #1a1e28;
  border-color: #2a2e38;
  color: #f0ece2;
}

[data-theme="dark"] .pf-field input:hover,
[data-theme="dark"] .pf-field select:hover {
  background: #1e2230;
  border-color: #353848;
}

[data-theme="dark"] .pf-field input:focus,
[data-theme="dark"] .pf-field select:focus {
  background: #1e2230;
}

[data-theme="dark"] .pf-radio-opt__label {
  background: #1a1e28;
  border-color: #2a2e38;
  color: #6a6878;
}

[data-theme="dark"] .pf-divider { background: #1c2028; }

[data-theme="dark"] .pf-btn--ghost {
  border-color: #2a2e38;
  color: #6a6878;
}

[data-theme="dark"] .pf-btn--ghost:hover {
  background: #1a1e28;
  border-color: #353848;
  color: #d0cec8;
}

[data-theme="dark"] .pf-accordion-chevron {
  background: #1a1e28;
  color: #555;
}

[data-theme="dark"] .pf-select-wrap::after { color: #444; }

[data-theme="dark"] .pf-hint { color: #3a3a44; }

[data-theme="dark"] .pf-toast {
  background: #0d1018;
  border: 1px solid #22262e;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 860px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-nav {
    position: static;
  }

  .profile-nav__list {
    display: flex;
    flex-wrap: wrap;
    padding: 0.5rem;
    gap: 0.25rem;
  }

  .profile-nav__link {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-size: 0.775rem;
  }

  .profile-nav__link.is-active {
    border-left: none;
    border-bottom-color: #c41e3a;
    border-radius: 8px 8px 0 0;
  }

  .profile-nav__heading { display: none; }
}

@media (max-width: 560px) {
  .pf-grid {
    grid-template-columns: 1fr;
  }

  .pf-col-full { grid-column: 1; }

  .profile-hero__inner { gap: 0.85rem; }

  .pf-save-bar { flex-direction: column; align-items: flex-start; }
  .pf-save-actions { width: 100%; }
  .pf-btn { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-field input,
  .pf-field select,
  .pf-btn,
  .pf-accordion-body,
  .pf-toast,
  .pf-accordion-chevron {
    transition: none;
  }
}
