/*
 * BB Member Manager — Frontend Styles
 * Version: 1.0  |  BridgeBrain Labs
 * ─────────────────────────────────────────────────────────────────
 * Scoped to .bbmm-* to avoid conflicts with any WP theme.
 * Variables are CSS custom properties — override in your theme if needed.
 * ─────────────────────────────────────────────────────────────────
 */

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  --bbmm-primary:        #2271b1;
  --bbmm-primary-hover:  #135e96;
  --bbmm-primary-light:  #e8f0fb;
  --bbmm-danger:         #d63638;
  --bbmm-danger-hover:   #b32d2e;
  --bbmm-success:        #00a32a;
  --bbmm-success-bg:     #edfaef;
  --bbmm-alert-bg:       #fcf0f1;
  --bbmm-text:           #1e1e1e;
  --bbmm-text-muted:     #757575;
  --bbmm-border:         #dcdcde;
  --bbmm-bg:             #f6f7f7;
  --bbmm-card-bg:        #ffffff;
  --bbmm-radius:         8px;
  --bbmm-radius-sm:      4px;
  --bbmm-shadow:         0 1px 4px rgba(0,0,0,.10), 0 4px 16px rgba(0,0,0,.06);
  --bbmm-font:           system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bbmm-transition:     160ms ease;
}

/* ── Wrapper & Card ────────────────────────────────────────────── */
.bbmm-wrap {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 16px;
  font-family: var(--bbmm-font);
  color: var(--bbmm-text);
  box-sizing: border-box;
}

.bbmm-card {
  background: var(--bbmm-card-bg);
  border: 1px solid var(--bbmm-border);
  border-radius: var(--bbmm-radius);
  box-shadow: var(--bbmm-shadow);
  padding: 36px 40px;
}

.bbmm-card--sm {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Typography ────────────────────────────────────────────────── */
.bbmm-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bbmm-text);
  margin: 0 0 24px;
  letter-spacing: -.01em;
}

.bbmm-note {
  font-size: 12px;
  color: var(--bbmm-text-muted);
  margin: 4px 0 0;
  line-height: 1.5;
}

.bbmm-field-hint {
  display: block;
  font-size: 12px;
  color: var(--bbmm-text-muted);
  margin-top: 4px;
}

.bbmm-footnote {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--bbmm-text-muted);
}

/* ── Alerts & Notices ──────────────────────────────────────────── */
.bbmm-alert,
.bbmm-success {
  padding: 12px 16px;
  border-radius: var(--bbmm-radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.bbmm-alert {
  background: var(--bbmm-alert-bg);
  border-left: 4px solid var(--bbmm-danger);
  color: #801619;
}

.bbmm-success {
  background: var(--bbmm-success-bg);
  border-left: 4px solid var(--bbmm-success);
  color: #1a6b26;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.bbmm-form {
  width: 100%;
}

.bbmm-field {
  margin-bottom: 18px;
}

.bbmm-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--bbmm-text);
  margin-bottom: 6px;
}

.bbmm-field input[type="text"],
.bbmm-field input[type="email"],
.bbmm-field input[type="password"],
.bbmm-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--bbmm-border);
  border-radius: var(--bbmm-radius-sm);
  font-size: 15px;
  font-family: var(--bbmm-font);
  color: var(--bbmm-text);
  background: #fff;
  transition: border-color var(--bbmm-transition), box-shadow var(--bbmm-transition);
  box-sizing: border-box;
}

.bbmm-field input:focus,
.bbmm-field textarea:focus {
  outline: none;
  border-color: var(--bbmm-primary);
  box-shadow: 0 0 0 3px rgba(34, 113, 177, .15);
}

.bbmm-field textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* Two fields side by side */
.bbmm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

/* ── Password wrapper (eye toggle) ─────────────────────────────── */
.bbmm-passwrap {
  position: relative;
  display: flex;
}

.bbmm-passwrap input {
  flex: 1;
  padding-right: 44px;
}

.bbmm-eye {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 16px;
  color: var(--bbmm-text-muted);
  line-height: 1;
}

.bbmm-eye:hover { color: var(--bbmm-primary); }

/* ── Buttons ────────────────────────────────────────────────────── */
.bbmm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bbmm-primary);
  color: #fff;
  border: 2px solid var(--bbmm-primary);
  border-radius: var(--bbmm-radius-sm);
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--bbmm-font);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--bbmm-transition), border-color var(--bbmm-transition), transform 80ms;
  line-height: 1.4;
  white-space: nowrap;
}

.bbmm-btn:hover,
.bbmm-btn:focus {
  background: var(--bbmm-primary-hover);
  border-color: var(--bbmm-primary-hover);
  color: #fff;
  text-decoration: none;
  outline: none;
}

.bbmm-btn:active { transform: translateY(1px); }

.bbmm-btn--outline {
  background: transparent;
  color: var(--bbmm-primary);
}

.bbmm-btn--outline:hover {
  background: var(--bbmm-primary-light);
  color: var(--bbmm-primary);
}

.bbmm-btn--danger {
  background: var(--bbmm-danger);
  border-color: var(--bbmm-danger);
}

.bbmm-btn--danger:hover {
  background: var(--bbmm-danger-hover);
  border-color: var(--bbmm-danger-hover);
  color: #fff;
}

.bbmm-btn--full { width: 100%; }

.bbmm-btn--sm {
  padding: 7px 16px;
  font-size: 13px;
}

.bbmm-link {
  color: var(--bbmm-primary);
  text-decoration: none;
  font-size: 14px;
}

.bbmm-link:hover { text-decoration: underline; }

/* ── Actions row ────────────────────────────────────────────────── */
.bbmm-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* ── Dividers & Sections ────────────────────────────────────────── */
.bbmm-hr {
  border: none;
  border-top: 1px solid var(--bbmm-border);
  margin: 28px 0;
}

.bbmm-section {
  margin-bottom: 8px;
}

.bbmm-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--bbmm-text);
}

/* ── Account: status row ────────────────────────────────────────── */
.bbmm-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.bbmm-label {
  font-weight: 600;
  font-size: 14px;
}

.bbmm-status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.bbmm-status-badge--paid {
  background: #e8faf0;
  color: #1a6b26;
  border: 1px solid #c3e6cb;
}

.bbmm-status-badge--free {
  background: #f6f7f7;
  color: #666;
  border: 1px solid #dcdcde;
}

/* ── Admin paid/free toggle ─────────────────────────────────────── */
.bbmm-admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--bbmm-text-muted);
}

.bbmm-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.bbmm-switch input { opacity: 0; width: 0; height: 0; }

.bbmm-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--bbmm-transition);
}

.bbmm-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--bbmm-transition);
}

.bbmm-switch input:checked + .bbmm-slider { background: var(--bbmm-primary); }
.bbmm-switch input:checked + .bbmm-slider::before { transform: translateX(16px); }

/* ── Upgrade banner ─────────────────────────────────────────────── */
.bbmm-upgrade-banner {
  background: var(--bbmm-primary-light);
  border: 1px solid rgba(34,113,177,.2);
  border-radius: var(--bbmm-radius-sm);
  padding: 14px 18px;
  margin-bottom: 8px;
  font-size: 14px;
}

/* ── Preferences ────────────────────────────────────────────────── */
.bbmm-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bbmm-border);
  font-size: 14px;
  flex-wrap: wrap;
}

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

.bbmm-radio-pair {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.bbmm-radio-pair label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
  cursor: pointer;
  font-size: 14px;
}

/* ── Danger zone ────────────────────────────────────────────────── */
.bbmm-danger-zone {
  background: #fff5f5;
  border: 1px solid #fcc;
  border-radius: var(--bbmm-radius-sm);
  padding: 18px 20px;
}

.bbmm-danger-zone h3 { color: var(--bbmm-danger); }

/* ── Profile grid ───────────────────────────────────────────────── */
.bbmm-profile-grid {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 36px;
  align-items: start;
}

.bbmm-profile-photo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

/* ── Avatars ────────────────────────────────────────────────────── */
.bbmm-avatar {
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.bbmm-avatar--lg {
  width: 140px;
  height: 140px;
  border: 3px solid var(--bbmm-border);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.bbmm-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bbmm-primary-light);
  color: var(--bbmm-primary);
  border: 1px solid rgba(34,113,177,.3);
  border-radius: var(--bbmm-radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--bbmm-transition);
  font-family: var(--bbmm-font);
}

.bbmm-upload-btn:hover { background: rgba(34,113,177,.15); }

/* ── Modals ─────────────────────────────────────────────────────── */
.bbmm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.bbmm-modal[aria-hidden="false"] { display: flex; align-items: center; justify-content: center; }

.bbmm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  cursor: pointer;
}

.bbmm-modal-card {
  position: relative;
  background: #fff;
  border-radius: var(--bbmm-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  padding: 32px;
  max-width: 520px;
  width: calc(100% - 32px);
  z-index: 1;
  max-height: 90vh;
  overflow-y: auto;
}

.bbmm-modal-card--sm { max-width: 400px; }

.bbmm-modal-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 14px;
}

.bbmm-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Crop modal ─────────────────────────────────────────────────── */
.bbmm-crop-hint {
  font-size: 12px;
  color: var(--bbmm-text-muted);
  margin-bottom: 12px;
}

#bbmm-crop-viewport {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 16px;
  background: #111;
  border-radius: 50%;
  overflow: hidden;
  cursor: grab;
}

#bbmm-crop-viewport:active { cursor: grabbing; }

.bbmm-crop-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0,0,0,.55);
  pointer-events: none;
  z-index: 2;
}

.bbmm-crop-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px auto 0;
  max-width: 280px;
}

.bbmm-crop-ctrl input[type="range"] {
  flex: 1;
  accent-color: var(--bbmm-primary);
  cursor: pointer;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .bbmm-card {
    padding: 24px 18px;
  }

  .bbmm-profile-grid {
    grid-template-columns: 1fr;
  }

  .bbmm-profile-photo-col {
    order: -1;
  }

  .bbmm-field-row {
    grid-template-columns: 1fr;
  }

  .bbmm-status-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .bbmm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .bbmm-actions .bbmm-btn { width: 100%; justify-content: center; }

  .bbmm-modal-card { padding: 22px 16px; }
}
