.community-profile-page {
  max-width: 700px;
  margin: 0 auto;
}

/* Cover Photo */
.profile-cover {
  height: 220px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  position: relative;
}

/* Identity Card - overlaps cover */
.profile-identity {
  position: relative;
  margin-top: -60px;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 4px solid var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #3b82f6, #22D3A6);
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-info {
  margin-top: 0.75rem;
}

.profile-display-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

/* Phase D — tier-aware variants */
.profile-badge--free {
  background: rgba(94, 234, 212, 0.12);
  border: 1px solid rgba(94, 234, 212, 0.3);
  color: #5eead4;
}

.profile-badge--plus {
  background: var(--dash-accent-grad);
  color: #0b1328;
}

.profile-badge--pro {
  background: var(--dash-amber-grad);
  color: #0b1328;
}

.profile-badge--business {
  background: rgba(34, 211, 166, 0.0882);
  border: 1px solid rgba(34, 211, 166, 0.245);
  color: #5eead4;
}

/* Stats Bar */
.profile-stats {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.profile-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Action Button */
.profile-action {
  padding: 0.75rem 1.5rem;
}

.profile-follow-btn {
  width: 100%;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.profile-follow-btn.follow {
  background: linear-gradient(135deg, #3b82f6, #22D3A6);
  color: white;
}

.profile-follow-btn.following {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.profile-follow-btn.following:hover {
  border-color: #ef4444;
  color: #ef4444;
}

.profile-edit-btn {
  width: 100%;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.15s;
}

/* Switch to Garage button — mobile only */
.profile-garage-btn {
  display: none;
  width: 100%;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(34, 211, 166, 0.1176);
  color: #5eead4;
  transition: all 0.15s;
  margin-top: 0.5rem;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.profile-garage-btn:hover {
  background: rgba(34, 211, 166, 0.042);
  border-color: #5eead4;
}

@media (max-width: 768px) {
  .profile-garage-btn {
    display: flex;
  }
}

.profile-edit-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Tab Navigation */
.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  margin-top: 0.5rem;
}

.profile-tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.profile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.profile-tab:hover:not(.active) {
  color: var(--text-primary);
}

/* Tab Content */
.profile-tab-content {
  padding: 1rem 1.5rem;
  min-height: 200px;
}

.profile-vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.profile-vehicle-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.profile-vehicle-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.profile-vehicle-image {
  width: 100%;
  aspect-ratio: 16/10;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.profile-vehicle-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-vehicle-info {
  padding: 0.75rem;
}

.profile-vehicle-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-vehicle-year {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Loading */
.profile-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.profile-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: profile-spin 0.8s linear infinite;
}

@keyframes profile-spin { to { transform: rotate(360deg); } }

/* Edit Profile Modal */
.edit-profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.edit-profile-overlay.open {
  display: flex;
}

.edit-profile-modal {
  background: var(--bg-primary);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
}

.edit-profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.edit-avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(34, 211, 166, 0.0882);
}

.edit-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-avatar-btn {
  padding: 8px 16px;
  background: rgba(34, 211, 166, 0.0441);
  border: 1px solid rgba(34, 211, 166, 0.1176);
  border-radius: 8px;
  color: #5eead4;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.edit-avatar-btn:hover {
  background: rgba(34, 211, 166, 0.0735);
}

.edit-profile-field {
  margin-bottom: 1rem;
}

.edit-profile-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.25rem;
}

.edit-profile-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.edit-profile-input:focus {
  outline: none;
  border-color: var(--accent);
}

.edit-profile-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .community-profile-page { margin-bottom: 80px; }
  .profile-identity { padding: 0 1rem; }
  .profile-stats { padding: 1rem; }
  .profile-tabs { padding: 0 1rem; }
  .profile-tab-content { padding: 1rem; }
  .profile-vehicles-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
