/* ══════════════════════════════════════════════════════════
   SCROLL WRAPPER
══════════════════════════════════════════════════════════ */
.profile-wrap {
  flex: 1;
  overflow-y: auto;
  height: 100%;
  background: var(--bg);
}

/* ══════════════════════════════════════════════════════════
   PAGE SHELL — full width two-column layout
══════════════════════════════════════════════════════════ */
.profile-page {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 300px 1fr;
  grid-template-areas:
    "topbar  topbar"
    "left    right";
  gap: 0 22px;
  padding: 28px 28px 40px;
  min-height: 100%;
  box-sizing: border-box;
  align-items: start;
}

/* ══════════════════════════════════════════════════════════
   TOP BAR
══════════════════════════════════════════════════════════ */
.profile-topbar {
  grid-area: topbar;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.profile-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.3px;
  margin: 0 0 3px;
}
.profile-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   LEFT COLUMN
══════════════════════════════════════════════════════════ */
.profile-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
}

/* Avatar banner */
.profile-banner-card {
  background: linear-gradient(135deg, #0c0f1a 0%, #1a2540 100%);
  border-radius: 20px;
  padding: 30px 24px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
  position: relative;
  overflow: hidden;
}
.profile-banner-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  pointer-events: none;
}
.profile-banner-card::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}

.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 1;
}

.profile-avatar-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 800;
  color: #25D366;
  background: #fff;
  letter-spacing: -1px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  overflow: hidden;
}

.profile-avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  transition: background .15s, transform .15s;
  border: 2px solid var(--bg-surface, #1e2433);
}
.profile-avatar-upload-btn:hover {
  background: #1db954;
  transform: scale(1.1);
}

.profile-banner-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  z-index: 1;
}
.profile-name-display {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.profile-email-display {
  font-size: 12px;
  color: rgba(255,255,255,.8);
}
.profile-role-badge {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,.2);
  color: #fff;
  margin-top: 2px;
  letter-spacing: .3px;
  text-transform: capitalize;
}

/* Workspace info card */
.profile-ws-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.profile-ws-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -.1px;
}
.profile-ws-card-title svg { color: var(--accent); }

.profile-ws-list { display: flex; flex-direction: column; }
.profile-ws-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-light);
}
.profile-ws-item:last-child { border-bottom: none; }
.pf-ws-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.pf-ws-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.pf-status-active   { color: var(--green); }
.pf-status-trial    { color: var(--orange); }
.pf-status-inactive,
.pf-status-cancelled { color: var(--red); }

/* ══════════════════════════════════════════════════════════
   RIGHT COLUMN
══════════════════════════════════════════════════════════ */
.profile-right {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ══════════════════════════════════════════════════════════
   SECTION CARDS
══════════════════════════════════════════════════════════ */
.profile-section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.profile-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -.2px;
}
.profile-section-title svg { color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 24px;
}
.profile-field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Labels */
.pf-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: .1px;
}
.pf-readonly-tag {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--border-light);
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Inputs — override global styles with !important for specificity */
.profile-section-card .pf-input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-family: var(--font);
  color: var(--text-primary) !important;
  background: var(--bg) !important;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
.profile-section-card .pf-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(37,211,102,.10);
  background: var(--card) !important;
}
.profile-section-card .pf-input-readonly {
  color: var(--text-muted) !important;
  cursor: not-allowed;
  background: var(--border-light) !important;
  border-color: transparent !important;
}
.profile-section-card .pf-input-readonly:focus {
  border-color: transparent !important;
  box-shadow: none;
}

/* Password wrap */
.pf-pw-wrap { position: relative; }
.pf-pw-wrap .pf-input { padding-right: 44px !important; }
.pf-eye-btn {
  position: absolute;
  right: 0; top: 0;
  height: 44px; width: 42px;
  background: none; border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 10px 10px 0;
  transition: color .15s;
  padding: 0;
}
.pf-eye-btn:hover { color: var(--text-secondary); }

/* Form footer */
.profile-form-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.pf-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 10px;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.pf-btn:disabled { opacity: .6; cursor: not-allowed; }

.pf-btn-primary {
  background: #25D366;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,211,102,.35);
}
.pf-btn-primary:hover:not(:disabled) {
  background: #128C7E;
  box-shadow: 0 6px 20px rgba(37,211,102,.45);
}

/* Inline spinner */
.pf-spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pf-spin .6s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   MOBILE
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .profile-page {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "left"
      "right";
    padding: 20px 16px 80px;
  }
  .profile-left { position: static; }
  .profile-banner-card { flex-direction: row; text-align: left; padding: 22px 20px; }
  .profile-avatar-circle { width: 64px; height: 64px; font-size: 22px; }
  .profile-banner-meta { align-items: flex-start; }
}
@media (max-width: 600px) {
  .profile-page { padding: 14px 12px 80px; gap: 0 14px; }
  .profile-banner-card { flex-direction: column; text-align: center; }
  .profile-banner-meta { align-items: center; }
  .profile-field-group { grid-template-columns: 1fr; }
  .profile-form { padding: 16px; }
}

/* ── Dark mode ── */
[data-theme="dark"] .profile-section-card { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .profile-ws-card { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .profile-ws-item { border-color: var(--border); }
[data-theme="dark"] .profile-section-card .pf-input { background: #1A2540 !important; border-color: var(--border) !important; }
[data-theme="dark"] .profile-section-card .pf-input:focus { background: #1E2A45 !important; }
[data-theme="dark"] .profile-section-card .pf-input-readonly { background: #0C1422 !important; }
[data-theme="dark"] .pf-readonly-tag { background: #1A2540; color: var(--text-muted); }
