/* ─── Profile Page ─────────────────────────────────────────────────────────── */

.profile-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 760px;
}

/* ─── Avatar + identity at top of profile section ────────────────────────── */

.profile-identity {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

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

.profile-identity-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.profile-meta-chip {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.profile-avatar-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto var(--space-5);
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--primary-600);
  color: white;
  border: 2px solid var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.avatar-upload-btn:hover {
  background: var(--primary-700);
  transform: scale(1.1);
}

.avatar-upload-progress {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.avatar-upload-progress.visible {
  opacity: 1;
}

.profile-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.profile-email {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  word-break: break-word;
}

.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.verification-badge.verified {
  background: var(--success-50);
  color: var(--success-600);
  border: 1px solid #a7f3d0;
}

.verification-badge.unverified {
  background: var(--warning-50);
  color: var(--warning-600);
  border: 1px solid #fde68a;
}

/* ─── Sections (right column) ────────────────────────────────────────────── */

.profile-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.profile-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-8);
  box-shadow: var(--shadow-sm);
}

.profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.profile-section-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

.profile-section-title.danger {
  color: var(--error-600);
}

/* ─── Form within profile ────────────────────────────────────────────────── */

.profile-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.profile-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.profile-form-actions {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

/* ─── Danger zone ────────────────────────────────────────────────────────── */

.danger-section {
  border-color: var(--error-200);
}

.danger-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  line-height: var(--leading-relaxed);
}

/* ─── Inline alerts ──────────────────────────────────────────────────────── */

.section-alert {
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  display: none;
}

.section-alert.show { display: block; }

.section-alert-success {
  background: var(--success-50);
  color: var(--success-600);
  border: 1px solid #a7f3d0;
}

.section-alert-error {
  background: var(--error-50);
  color: var(--error-600);
  border: 1px solid #fecaca;
}

/* ─── Plan & Billing ─────────────────────────────────────────────────────── */

.billing-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.billing-plan-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--primary-800);
  margin-bottom: 2px;
}

.billing-plan-desc {
  font-size: var(--text-sm);
  color: var(--primary-600);
}

.billing-usage {
  margin-bottom: var(--space-5);
}

.billing-usage-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.billing-usage-bar {
  background: var(--neutral-200);
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
}

.billing-usage-fill {
  background: var(--primary-500);
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.billing-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.billing-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.billing-feature-icon {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: var(--weight-bold);
  flex-shrink: 0;
}

.billing-feature-ok {
  background: var(--success-50);
  color: var(--success-600);
  border: 1px solid #a7f3d0;
}

.billing-feature-no {
  background: var(--neutral-100);
  color: var(--neutral-400);
  border: 1px solid var(--color-border);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .profile-identity {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}

@media (max-width: 600px) {
  .profile-form-row {
    grid-template-columns: 1fr;
  }

  .profile-section {
    padding: var(--space-5) var(--space-5);
  }
}
