/**
 * Appily Forty — Orchard Account Hub
 * Layout: hero + sidebar dashboard (logged in) / perks + auth card (guest)
 */

.page-account-forty.a40-account-forty {
  background: var(--a40-warm);
}
.page-account-forty .page-main { padding-top: 0; }

.page-account-forty .auth-page {
  padding: 0 0 3.5rem;
  background: transparent;
}
.page-account-forty .auth-page > .container {
  max-width: 1120px;
}

.page-account-forty .dash-panel { display: none; }
.page-account-forty .dash-panel.is-active { display: block; }

.a40-acct { padding-bottom: 0; }

/* Reveal */
.a40-acct-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.a40-acct-reveal.is-visible { opacity: 1; transform: none; }

/* Hero */
.a40-acct-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 2.75rem) 0 1.75rem;
  background: var(--a40-hero-gradient);
  margin-bottom: 1.5rem;
}
.a40-acct-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.a40-acct-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  opacity: 0.45;
  animation: a40-acct-blob 14s ease-in-out infinite;
}
.a40-acct-blob--1 { width: 280px; height: 280px; top: -10%; right: 6%; background: var(--a40-blob-warm); }
.a40-acct-blob--2 { width: 220px; height: 220px; bottom: -12%; left: 2%; background: var(--a40-blob-cool); animation-delay: -5s; }
.a40-acct-ring {
  position: absolute;
  top: 50%;
  right: 12%;
  width: min(220px, 28vw);
  aspect-ratio: 1;
  border: 2px dashed rgba(45, 106, 79, 0.14);
  border-radius: 50%;
  transform: translateY(-50%);
  animation: a40-acct-spin 22s linear infinite;
}
@keyframes a40-acct-blob {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(8px, -6px); }
}
@keyframes a40-acct-spin { to { transform: translateY(-50%) rotate(360deg); } }

.a40-acct-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
}
.a40-acct-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a40-orange);
}
.a40-acct-hero h1 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--a40-ink);
}
.a40-acct-hero h1 span {
  color: var(--a40-orange); -webkit-text-fill-color: var(--a40-orange); background: none;
}
.a40-acct-lede {
  margin: 0;
  max-width: 46ch;
  font-size: 0.92rem;
  color: var(--a40-muted);
  line-height: 1.6;
}

.a40-acct-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--a40-surface);
  border: 2px solid var(--a40-border);
  box-shadow: 0 10px 32px rgba(33, 37, 41, 0.08);
  text-align: center;
  flex-shrink: 0;
}
.a40-acct-badge-icon { font-size: 1.5rem; line-height: 1; margin-bottom: 0.15rem; }
.a40-acct-badge strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--a40-green-dark);
  letter-spacing: 0.06em;
}
.a40-acct-badge small {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a40-muted);
}

/* Loading */
.a40-acct-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 2rem 0;
  padding: 1rem;
  border-radius: 12px;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  color: var(--a40-muted);
  font-size: 0.88rem;
}
.a40-acct-loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--a40-orange);
  animation: a40-acct-pulse-dot 1.2s ease-in-out infinite;
}
@keyframes a40-acct-pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

/* Buttons */
.a40-acct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.15rem;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.a40-acct-btn--primary {
  background: var(--a40-ink);
  color: #fff !important;
}
.a40-acct-btn--primary:hover {
  background: var(--a40-green-dark);
  transform: translateY(-2px);
}
.a40-acct-btn--ghost {
  background: rgba(64, 145, 108, 0.1);
  color: var(--a40-green-dark) !important;
  border: 1px solid rgba(64, 145, 108, 0.2);
}
.a40-acct-btn--ghost:hover { background: rgba(64, 145, 108, 0.18); }
.a40-acct-btn--outline {
  background: transparent;
  color: var(--a40-ink) !important;
  border: 1px solid var(--a40-border);
}
.a40-acct-btn--outline:hover { border-color: var(--a40-orange); color: var(--a40-orange) !important; }
.a40-acct-btn--sm { padding: 0.45rem 0.9rem; font-size: 0.78rem; }

/* Logged-in dashboard */
.a40-acct-dashboard {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.a40-acct-sidebar {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 8px 28px rgba(33, 37, 41, 0.06);
}

.a40-acct-user-card {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--a40-border);
}
.a40-acct-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--a40-orange), var(--a40-gold));
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(224, 122, 47, 0.25);
}
.a40-acct-user-tag {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a40-mint);
  margin-bottom: 0.2rem;
}
.a40-acct-user-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--a40-ink);
  word-break: break-word;
}

.a40-acct-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.a40-acct-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--a40-muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.a40-acct-nav-btn:hover { background: var(--a40-cream); color: var(--a40-ink); }
.a40-acct-nav-btn.is-active {
  background: linear-gradient(135deg, rgba(224, 122, 47, 0.12), rgba(64, 145, 108, 0.1));
  color: var(--a40-green-dark);
  font-weight: 700;
}
.a40-acct-nav-icon { font-size: 1rem; line-height: 1; }

.a40-acct-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--a40-border);
}
.a40-acct-sidebar-links a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--a40-muted);
  text-decoration: none !important;
  padding: 0.35rem 0;
  transition: color 0.2s;
}
.a40-acct-sidebar-links a:hover { color: var(--a40-orange); }

.a40-acct-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--a40-border);
}
.a40-acct-sidebar-actions .a40-acct-btn { width: 100%; }

/* Main panel area */
.a40-acct-main {
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 16px;
  padding: 1.35rem 1.5rem 1.5rem;
  box-shadow: 0 8px 28px rgba(33, 37, 41, 0.06);
  min-height: 360px;
}

.a40-acct-panel-head { margin-bottom: 1.25rem; }
.a40-acct-panel-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.a40-acct-panel-head h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--a40-ink);
}
.a40-acct-panel-head p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--a40-muted);
}

/* Profile grid */
.a40-acct-profile {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.a40-acct-profile .profile-item {
  padding: 0.85rem 1rem;
  background: var(--a40-cream);
  border: 1px solid var(--a40-border);
  border-radius: 12px;
  transition: border-color 0.2s, transform 0.2s;
}
.a40-acct-profile .profile-item:hover {
  border-color: rgba(64, 145, 108, 0.35);
  transform: translateY(-2px);
}
.a40-acct-profile .profile-item .k {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--a40-muted);
  margin-bottom: 0.3rem;
}
.a40-acct-profile .profile-item .v {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--a40-ink);
  word-break: break-word;
}
.a40-acct-profile .profile-item .v.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
}

/* Orders */
.a40-acct-orders .order-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 0.65rem;
  background: var(--a40-cream);
  border: 1px solid var(--a40-border);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.a40-acct-orders .order-row:hover {
  border-color: rgba(224, 122, 47, 0.35);
  box-shadow: 0 4px 16px rgba(224, 122, 47, 0.08);
}
.a40-acct-orders .order-row strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.a40-acct-orders .order-row .btn,
.a40-acct-orders .order-row .btn-soft {
  flex-shrink: 0;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--a40-ink);
  color: #fff !important;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.2s;
}
.a40-acct-orders .order-row .btn:hover,
.a40-acct-orders .order-row .btn-soft:hover { background: var(--a40-green-dark); }

.page-account-forty .mini-copy {
  font-size: 0.8rem;
  color: var(--a40-muted);
  line-height: 1.45;
}

/* Forms */
.a40-acct-form { max-width: 420px; }
.a40-acct-field {
  display: block;
  margin-bottom: 0.85rem;
}
.a40-acct-field span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--a40-muted);
}
.a40-acct-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--a40-border);
  border-radius: 10px;
  background: var(--a40-cream);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.a40-acct-field input:focus {
  border-color: var(--a40-mint);
  box-shadow: 0 0 0 3px rgba(64, 145, 108, 0.15);
}

/* Notices */
.page-account-forty .a40-acct-main .notice,
.page-account-forty #profileVerifyNotice .notice {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.5;
}
.page-account-forty .notice.success {
  border: 1px solid rgba(64, 145, 108, 0.3);
  background: rgba(64, 145, 108, 0.08);
  color: var(--a40-green-dark);
}
.page-account-forty .notice.warning {
  border: 1px solid rgba(244, 161, 39, 0.35);
  background: rgba(244, 161, 39, 0.1);
  color: #7a5c00;
}

/* Guest layout */
.a40-acct-guest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 1.25rem;
  align-items: start;
}
.a40-acct-guest--solo {
  grid-template-columns: minmax(320px, 480px);
  justify-content: center;
}

.a40-acct-perks {
  background: linear-gradient(160deg, var(--a40-green-dark) 0%, #1a3d2e 100%);
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.35rem;
  color: #fff;
}
.a40-acct-perks h3 {
  margin: 0 0 1.15rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
}
.a40-acct-perk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.a40-acct-perk {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  animation: a40-acct-perk-in 0.5s ease both;
  animation-delay: calc(var(--perk-i, 0) * 0.08s);
}
@keyframes a40-acct-perk-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}
.a40-acct-perk-num {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--a40-gold);
  flex-shrink: 0;
}
.a40-acct-perks-foot {
  display: flex;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.a40-acct-perks-foot a {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none !important;
}
.a40-acct-perks-foot a:hover { color: var(--a40-gold); }

/* Auth card */
.a40-acct-auth {
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(33, 37, 41, 0.08);
}
.a40-acct-auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--a40-cream);
  border-bottom: 1px solid var(--a40-border);
}
.a40-acct-auth-tab {
  padding: 0.9rem 1rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--a40-muted);
  cursor: pointer;
  transition: color 0.2s;
  z-index: 1;
}
.a40-acct-auth-tab.is-active { color: var(--a40-green-dark); }
.a40-acct-auth-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50%;
  height: 3px;
  background: linear-gradient(90deg, var(--a40-orange), var(--a40-mint));
  border-radius: 3px 3px 0 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.a40-acct-auth[data-active="register"] .a40-acct-auth-indicator {
  transform: translateX(100%);
}

.a40-acct-auth-body { padding: 1.35rem 1.5rem 1.5rem; }
.a40-acct-auth-panel h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--a40-ink);
}
.a40-acct-auth-panel .lead {
  margin: 0 0 1.15rem;
  font-size: 0.88rem;
  color: var(--a40-muted);
  line-height: 1.55;
}
.a40-acct-forgot {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--a40-border);
}
.a40-acct-forgot .form-subhead,
.a40-acct-reset .form-subhead {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--a40-ink);
}
.a40-acct-reset { margin-top: 1rem; }

/* Toast */
.page-account-forty .toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  left: auto;
  max-width: min(380px, calc(100vw - 2rem));
  padding: 0.85rem 1.15rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(33, 37, 41, 0.15);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
}
.page-account-forty .toast.visible,
.page-account-forty .toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.page-account-forty .toast.success { border-left: 4px solid var(--a40-mint); }
.page-account-forty .toast.error { border-left: 4px solid var(--a40-berry); }
.page-account-forty .toast.warning { border-left: 4px solid var(--a40-gold); }

.page-account-forty .auth-inline-status {
  margin: 0.35rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.45;
  display: none;
}
.page-account-forty .auth-inline-status.visible {
  display: block;
}
.page-account-forty .auth-inline-status.success {
  background: rgba(82, 183, 136, 0.12);
  color: #1b4332;
  border: 1px solid rgba(82, 183, 136, 0.35);
}
.page-account-forty .auth-inline-status.error {
  background: rgba(220, 53, 69, 0.08);
  color: #842029;
  border: 1px solid rgba(220, 53, 69, 0.25);
}
.page-account-forty .auth-inline-status.warning {
  background: rgba(255, 193, 7, 0.12);
  color: #664d03;
  border: 1px solid rgba(255, 193, 7, 0.35);
}

#accountLoggedIn:not([style*="display: none"]) .a40-acct-reveal,
#accountLoggedOut:not([style*="display: none"]) .a40-acct-reveal {
  opacity: 1;
  transform: none;
}

/* Responsive */
@media (max-width: 900px) {
  .a40-acct-hero-inner { grid-template-columns: 1fr; }
  .a40-acct-badge { justify-self: start; }
  .a40-acct-dashboard { grid-template-columns: 1fr; }
  .a40-acct-sidebar { position: static; }
  .a40-acct-nav { flex-direction: row; flex-wrap: wrap; }
  .a40-acct-nav-btn { width: auto; flex: 1 1 auto; min-width: 120px; }
  .a40-acct-sidebar-actions { flex-direction: row; flex-wrap: wrap; }
  .a40-acct-sidebar-actions .a40-acct-btn { width: auto; flex: 1; }
  .a40-acct-guest { grid-template-columns: 1fr; }
  .a40-acct-profile { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .a40-acct-main { padding: 1.1rem; }
  .a40-acct-auth-body { padding: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .a40-acct-reveal, .a40-acct-perk { animation: none !important; opacity: 1; transform: none; transition: none; }
  .a40-acct-blob, .a40-acct-ring { animation: none !important; }
}
