/* =====================================================
   RPD Members & Auth CSS — Modern Premium CSS
   Cohesive Palette · Glassmorphism Cards · Mobile-Responsive
===================================================== */
:root {
  --rpd-primary:    #4f46e5;
  --rpd-primary-d:  #4338ca;
  --rpd-primary-l:  #e0e7ff;
  --rpd-accent:     #8b5cf6;
  --rpd-accent-d:   #7c3aed;
  --rpd-success:    #10b981;
  --rpd-success-bg: #ecfdf5;
  --rpd-warning:    #f59e0b;
  --rpd-warning-bg: #fffbeb;
  --rpd-danger:     #ef4444;
  --rpd-danger-bg:  #fef2f2;
  --rpd-text:       #0f172a;
  --rpd-text-2:     #475569;
  --rpd-text-3:     #94a3b8;
  --rpd-bg:         #f8fafc;
  --rpd-white:      #ffffff;
  --rpd-border:     #e2e8f0;
  --rpd-border-2:   #f1f5f9;
  --rpd-radius:     16px;
  --rpd-radius-sm:  10px;
  --rpd-shadow:     0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --rpd-shadow-md:  0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --rpd-font:       'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rpd-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Auth Wrapper ────────────────────────────────── */
.rpd-auth-wrap {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--rpd-bg, #f8fafc);
  font-family: var(--rpd-font);
}

.rpd-auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--rpd-white, #fff);
  border-radius: var(--rpd-radius);
  box-shadow: var(--rpd-shadow-md);
  padding: 42px 42px 32px;
  position: relative;
  overflow: visible;
  border: 1px solid var(--rpd-border);
  transition: var(--rpd-transition);
}
.rpd-auth-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.rpd-auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  border-radius: var(--rpd-radius) var(--rpd-radius) 0 0;
  background: linear-gradient(90deg, var(--rpd-primary), var(--rpd-accent));
}
.rpd-auth-card-wide { max-width: 660px; }

/* ── Auth Header ─────────────────────────────────── */
.rpd-auth-header {
  text-align: center;
  margin-bottom: 32px;
}
.rpd-auth-logo {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 12px;
  display: inline-block;
}
.rpd-auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--rpd-text);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.rpd-auth-sub {
  font-size: 0.9rem;
  color: var(--rpd-text-2);
  margin: 0;
}

/* ── Auth Form ───────────────────────────────────── */
.rpd-auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rpd-auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Single field ────────────────────────────────── */
.rpd-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rpd-auth-field > label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rpd-text-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.rpd-auth-field > label em {
  color: var(--rpd-danger);
  font-style: normal;
  font-size: 0.95rem;
  margin-inline-start: 2px;
}
.rpd-auth-forgot {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rpd-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--rpd-transition);
}
.rpd-auth-forgot:hover {
  color: var(--rpd-primary-d);
  text-decoration: underline;
}

/* ── Input wrapper (with icon support) ────────────── */
.rpd-auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
/* Icon inside input */
.rpd-auth-input-wrap .rpd-auth-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
  width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rpd-auth-input-wrap[dir="rtl"] .rpd-auth-icon {
  left: auto;
  right: 14px;
}

/* All text-like inputs inside wrap */
.rpd-auth-input-wrap input,
.rpd-auth-input-wrap textarea,
.rpd-auth-input-wrap select {
  width: 100%;
  padding: 10px 42px 10px 42px; /* left: room for icon, right: room for eye toggle */
  border: 1.5px solid var(--rpd-border);
  border-radius: var(--rpd-radius-sm);
  font-size: 0.92rem;
  color: var(--rpd-text);
  background: var(--rpd-white);
  transition: var(--rpd-transition);
  font-family: var(--rpd-font, inherit);
  box-sizing: border-box;
  height: 46px;
}

/* RTL adjustment for input padding */
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap input,
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap select,
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap textarea {
  padding-right: 42px;
  padding-left: 42px;
}

/* No icon: reset left padding */
.rpd-auth-input-wrap.no-icon input,
.rpd-auth-input-wrap.no-icon select,
.rpd-auth-input-wrap.no-icon textarea {
  padding-left: 14px;
}
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap.no-icon input,
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap.no-icon select,
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap.no-icon textarea {
  padding-right: 14px;
}

/* No eye-toggle: reset right padding */
.rpd-auth-input-wrap.no-toggle input {
  padding-right: 14px;
}
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap.no-toggle input {
  padding-left: 14px;
}

.rpd-auth-input-wrap input:focus,
.rpd-auth-input-wrap select:focus,
.rpd-auth-input-wrap textarea:focus {
  outline: none;
  border-color: var(--rpd-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

/* select arrow space */
.rpd-auth-input-wrap select {
  padding-right: 36px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.rpd-auth-wrap[dir="rtl"] .rpd-auth-input-wrap select {
  background-position: left 14px center;
  padding-left: 36px;
  padding-right: 14px;
}

/* textarea */
.rpd-auth-input-wrap textarea {
  height: auto;
  min-height: 90px;
  padding-top: 12px;
  resize: vertical;
}

/* ── Eye toggle ──────────────────────────────────── */
.rpd-pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 6px;
  color: var(--rpd-text-3);
  z-index: 2;
  display: flex;
  align-items: center;
  transition: var(--rpd-transition);
}
.rpd-auth-input-wrap[dir="rtl"] .rpd-pw-toggle {
  right: auto;
  left: 12px;
}
.rpd-pw-toggle:hover {
  color: var(--rpd-primary);
}

/* ── Standalone inputs (no wrap) ─────────────────── */
.rpd-auth-field > input,
.rpd-auth-field > select,
.rpd-auth-field > textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--rpd-border);
  border-radius: var(--rpd-radius-sm);
  font-size: 0.92rem;
  color: var(--rpd-text);
  background: var(--rpd-white);
  transition: var(--rpd-transition);
  font-family: var(--rpd-font, inherit);
  box-sizing: border-box;
  height: 46px;
}
.rpd-auth-field > input:focus,
.rpd-auth-field > select:focus,
.rpd-auth-field > textarea:focus {
  outline: none;
  border-color: var(--rpd-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
.rpd-auth-field > textarea {
  height: auto;
  min-height: 90px;
  resize: vertical;
}

/* ── Auth Buttons ────────────────────────────────── */
.rpd-auth-btn {
  padding: 12px 24px;
  border-radius: var(--rpd-radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--rpd-transition);
  font-family: var(--rpd-font, inherit);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  outline: none;
}
.rpd-btn-block { width: 100%; }
.rpd-auth-btn.rpd-btn-primary {
  background: linear-gradient(135deg, var(--rpd-primary), var(--rpd-accent));
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.rpd-auth-btn.rpd-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}
.rpd-auth-btn.rpd-btn-primary:active {
  transform: translateY(0);
}

/* ── Remember Checkbox ────────────────────────────── */
.rpd-auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--rpd-text-2);
  cursor: pointer;
  user-select: none;
}
.rpd-auth-remember input[type=checkbox] {
  accent-color: var(--rpd-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Auth Footer ─────────────────────────────────── */
.rpd-auth-switch {
  text-align: center;
  margin: 20px 0 0;
  font-size: 0.9rem;
  color: var(--rpd-text-2);
}
.rpd-auth-switch a, .rpd-auth-link {
  color: var(--rpd-primary);
  font-weight: 700;
  text-decoration: none;
  transition: var(--rpd-transition);
}
.rpd-auth-switch a:hover, .rpd-auth-link:hover {
  color: var(--rpd-primary-d);
  text-decoration: underline;
}

/* ── Auth notice ─────────────────────────────────── */
.rpd-auth-notice {
  border-radius: var(--rpd-radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  border: 1.5px solid transparent;
}

/* ── Role selector ───────────────────────────────── */
.rpd-auth-role-select {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.rpd-role-option {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--rpd-border);
  border-radius: var(--rpd-radius-sm);
  cursor: pointer;
  transition: var(--rpd-transition);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--rpd-white);
}
.rpd-role-option:hover {
  border-color: var(--rpd-primary-l);
  background: var(--rpd-bg);
}
.rpd-role-option:has(input:checked) {
  border-color: var(--rpd-primary);
  background: rgba(79, 70, 229, 0.05);
  color: var(--rpd-primary);
}
.rpd-role-option input[type=radio] {
  accent-color: var(--rpd-primary);
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

/* ── Password Strength ───────────────────────────── */
.rpd-pw-strength-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: -2px;
}
.rpd-pw-strength-bar {
  flex: 1;
  height: 6px;
  background: var(--rpd-border-2);
  border-radius: 9999px;
  overflow: hidden;
}
.rpd-pw-strength-bar div {
  height: 100%;
  width: 0;
  border-radius: 9999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.rpd-pw-label {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 80px;
  text-align: right;
}
.rpd-auth-wrap[dir="rtl"] .rpd-pw-label {
  text-align: left;
}

/* ── Checkout form (custom RPD form) ─────────────── */
.rpd-checkout-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px;
  font-family: var(--rpd-font);
}
.rpd-checkout-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}
.rpd-checkout-section {
  background: var(--rpd-white);
  border: 1px solid var(--rpd-border);
  border-radius: var(--rpd-radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--rpd-shadow);
}
.rpd-checkout-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--rpd-text);
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--rpd-border-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Order Summary Sidebar */
.rpd-checkout-summary {
  position: sticky;
  top: 24px;
  background: var(--rpd-white);
  border: 1px solid var(--rpd-border);
  border-radius: var(--rpd-radius);
  padding: 24px;
  box-shadow: var(--rpd-shadow);
}
.rpd-checkout-summary-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--rpd-border-2);
}
.rpd-checkout-product-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rpd-border);
}
.rpd-checkout-product-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid var(--rpd-border-2);
}
.rpd-checkout-product-name {
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
  color: var(--rpd-text);
}
.rpd-checkout-product-price {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--rpd-primary);
}
.rpd-checkout-totals { margin-top: 16px; }
.rpd-checkout-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 6px 0;
  color: var(--rpd-text-2);
}
.rpd-checkout-total-row.final {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--rpd-text);
  border-top: 1.5px solid var(--rpd-border-2);
  margin-top: 10px;
  padding-top: 12px;
}
.rpd-checkout-submit-btn {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: linear-gradient(135deg, var(--rpd-primary), var(--rpd-accent));
  color: #fff !important;
  border: none;
  border-radius: var(--rpd-radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--rpd-transition);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  outline: none;
}
.rpd-checkout-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}
.rpd-checkout-submit-btn:active {
  transform: translateY(0);
}

/* ── Account Profile Page ────────────────────────── */
.rpd-account-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: var(--rpd-font);
}
.rpd-acc-profile-header {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.rpd-acc-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.rpd-acc-avatar {
  border-radius: 50%;
  border: 3px solid var(--rpd-primary-l);
  box-shadow: var(--rpd-shadow);
  display: block;
}
.rpd-acc-role-badge {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rpd-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 9999px;
  box-shadow: var(--rpd-shadow);
}
.rpd-acc-info {
  flex: 1;
  min-width: 180px;
}
.rpd-acc-name {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--rpd-text);
}
.rpd-acc-email, .rpd-acc-phone {
  font-size: 0.88rem;
  color: var(--rpd-text-2);
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rpd-acc-ref {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.rpd-acc-ref-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rpd-text-2);
  text-transform: uppercase;
}
.rpd-acc-ref-code {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: monospace;
  letter-spacing: 3px;
  background: var(--rpd-border-2);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--rpd-primary);
}
.rpd-acc-balance-card {
  background: linear-gradient(135deg, var(--rpd-primary), var(--rpd-accent));
  color: #fff;
  border-radius: var(--rpd-radius);
  padding: 20px 24px;
  text-align: center;
  min-width: 140px;
  flex-shrink: 0;
  box-shadow: 0 6px 15px -3px rgba(79, 70, 229, 0.25);
}
.rpd-acc-bal-amount {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}
.rpd-acc-bal-cur {
  font-size: 0.82rem;
  opacity: 0.9;
  margin: 3px 0;
  font-weight: 700;
}
.rpd-acc-bal-label {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 600;
}

/* ── Account Stats ───────────────────────────────── */
.rpd-acc-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  width: 100%;
}
.rpd-acc-stat {
  padding: 16px 12px;
  border-radius: var(--rpd-radius-sm);
  text-align: center;
  border: 1.5px solid var(--rpd-border);
  background: var(--rpd-white);
  transition: var(--rpd-transition);
}
.rpd-acc-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--rpd-shadow);
}
.rpd-acc-stat-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--rpd-text);
}
.rpd-acc-stat-lbl {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--rpd-text-2);
  text-transform: uppercase;
}
.rpd-acc-stat-pending    { border-top: 4px solid var(--rpd-warning); }
.rpd-acc-stat-processing { border-top: 4px solid var(--rpd-info); }
.rpd-acc-stat-shipped    { border-top: 4px solid var(--rpd-teal); }
.rpd-acc-stat-delivered  { border-top: 4px solid var(--rpd-success); }
.rpd-acc-stat-returned   { border-top: 4px solid var(--rpd-danger); }

/* ── Section Title inside Profile Form ──────────── */
.rpd-acc-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--rpd-text-2);
  padding: 12px 0 8px;
  margin: 20px 0 12px;
  border-bottom: 1.5px solid var(--rpd-border);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── WooCommerce Ref Badge ───────────────────────── */
.rpd-woo-ref-info {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #f5f3ff;
  border: 1.5px solid #d8b4fe;
  border-radius: var(--rpd-radius-sm);
  box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.05);
}
.rpd-woo-ref-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #6d28d9;
  text-transform: uppercase;
}
.rpd-woo-ref-code {
  font-size: 1.1rem;
  font-weight: 800;
  color: #4c1d95;
  font-family: monospace;
  letter-spacing: 3px;
}

/* ── Role Badges ─────────────────────────────────── */
.rpd-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}
.rpd-role-affiliate     { background: #f3e8ff; color: #7c3aed; }
.rpd-role-customer      { background: #e0f2fe; color: #0369a1; }
.rpd-role-subscriber    { background: #f1f5f9; color: #475569; }
.rpd-role-administrator { background: #fee2e2; color: #dc2626; }
.rpd-role-editor        { background: #d1fae5; color: #065f46; }
.rpd-avatar { border-radius: 50%; vertical-align: middle; }

/* ── Checkout Order Success ──────────────────────── */
.rpd-checkout-success {
  text-align: center;
  padding: 48px 32px;
  background: var(--rpd-white);
  border-radius: var(--rpd-radius);
  border: 2px solid #a7f3d0;
  box-shadow: var(--rpd-shadow-md);
  max-width: 600px;
  margin: 40px auto;
  font-family: var(--rpd-font);
}
.rpd-checkout-success-icon {
  font-size: 3.8rem;
  margin-bottom: 16px;
  line-height: 1;
  display: inline-block;
}
.rpd-checkout-success h3 {
  font-size: 1.45rem;
  margin: 0 0 10px;
  color: #065f46;
  font-weight: 800;
}
.rpd-checkout-success p {
  font-size: 0.95rem;
  color: var(--rpd-text-2);
  line-height: 1.6;
  margin: 0;
}

/* ── Responsive Spacing ──────────────────────────── */
@media (max-width: 768px) {
  .rpd-checkout-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .rpd-checkout-summary {
    position: static;
  }
}
@media (max-width: 640px) {
  .rpd-auth-card {
    padding: 32px 24px 24px;
    border-radius: var(--rpd-radius-sm);
  }
  .rpd-auth-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .rpd-acc-profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }
  .rpd-acc-ref {
    justify-content: center;
  }
  .rpd-acc-balance-card {
    width: 100%;
  }
}
