* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --secondary-color: #64748b;
  --success-color: #22c55e;
  --error-color: #ef4444;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #475569;
  --accent: #8b5cf6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.hidden {
  display: none !important;
}

/* Auth Section */
.auth-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.auth-container.register-wizard {
  max-width: 500px;
  margin: 50px auto;
}

.auth-container h1 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 10px;
}

/* Auth Logo */
.auth-logo {
  display: block;
  max-width: 320px;
  width: 100%;
  height: auto;
  margin: 0 auto 10px;
}

.auth-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.auth-icon {
  width: 48px;
  height: 48px;
}

.tagline {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 30px;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 25px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  padding: 0 15px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-full {
  width: 100%;
}

/* Back Button */
.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 5px 0;
  margin-bottom: 15px;
  transition: color 0.2s;
}

.back-btn:hover {
  color: var(--text);
}

/* Registration Wizard Progress */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 25px 0 30px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-light);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.3s;
}

.progress-step.active .step-number {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.progress-step.completed .step-number {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.step-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-step.active .step-label {
  color: var(--primary-color);
}

.progress-step.completed .step-label {
  color: var(--success-color);
}

.progress-line {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 10px;
  margin-bottom: 24px;
  transition: background 0.3s;
}

.progress-line.completed {
  background: var(--success-color);
}

/* Wizard Steps */
.wizard-step {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.step-title {
  font-size: 1.3rem;
  margin-bottom: 8px;
  text-align: center;
}

.step-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 25px;
  text-align: center;
}

/* Wizard Buttons */
.wizard-buttons {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.wizard-buttons .btn {
  flex: 1;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  background: var(--surface-light);
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
}

.tab-btn:hover:not(.active) {
  background: var(--border);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group input.readonly-field {
  background: var(--surface);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-light);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

.error {
  color: var(--error-color);
  margin-top: 10px;
  font-size: 0.9rem;
}

.success {
  color: var(--success-color);
  margin-top: 10px;
  font-size: 0.9rem;
}

/* Header */
header {
  background: var(--surface);
  padding: 15px 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  width: 36px;
  height: 36px;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.header-content h1 {
  font-size: 1.5rem;
}

nav {
  display: flex;
  gap: 10px;
}

.nav-btn {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.nav-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.nav-btn:hover:not(.active) {
  border-color: var(--text-muted);
  color: var(--text);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info span {
  color: var(--text-muted);
}

/* Main Content */
main {
  padding: 30px 20px;
}

.page h2 {
  margin-bottom: 10px;
  font-size: 1.8rem;
}

.page-description {
  color: var(--text-muted);
  margin-bottom: 30px;
}

/* User Grid */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.user-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.user-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.user-card h3 {
  font-size: 1.3rem;
  color: var(--text);
}

.match-score {
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.user-card-bio {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 15px;
}

.user-card-section {
  margin-bottom: 12px;
}

.user-card-section h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--surface-light);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.85rem;
}

.tag.shared {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 1.1rem;
}

/* Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface-light);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.checkbox-item:hover {
  background: var(--border);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Multiselect Dropdown */
.multiselect-container {
  position: relative;
}

.multiselect-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 8px 12px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.multiselect-trigger:hover {
  border-color: var(--text-muted);
}

.multiselect-trigger.open {
  border-color: var(--primary-color);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.multiselect-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.multiselect-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--primary-color);
  color: white;
  border-radius: 15px;
  font-size: 0.85rem;
}

.multiselect-tag-remove {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.8;
}

.multiselect-tag-remove:hover {
  opacity: 1;
}

.multiselect-placeholder {
  color: var(--text-muted);
}

.multiselect-arrow {
  font-size: 0.8rem;
  margin-left: 8px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.multiselect-trigger.open .multiselect-arrow {
  transform: rotate(180deg);
}

.multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface-light);
  border: 1px solid var(--primary-color);
  border-top: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  z-index: 100;
  display: none;
}

.multiselect-dropdown.open {
  display: block;
}

.multiselect-search {
  position: sticky;
  top: 0;
  padding: 10px;
  background: var(--surface-light);
  border-bottom: 1px solid var(--border);
}

.multiselect-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.multiselect-search input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.multiselect-options {
  padding: 5px 0;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.multiselect-option:hover {
  background: var(--border);
}

.multiselect-option.selected {
  background: rgba(99, 102, 241, 0.2);
}

.multiselect-option-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.multiselect-option.selected .multiselect-option-checkbox {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.multiselect-option.selected .multiselect-option-checkbox::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
}

.multiselect-no-results {
  padding: 15px;
  text-align: center;
  color: var(--text-muted);
}

/* SingleSelect Styles (uses multiselect styles but with single-selection specific elements) */
.singleselect-option-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.multiselect-option.selected .singleselect-option-radio {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.multiselect-option.selected .singleselect-option-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.singleselect-value {
  color: var(--text);
}

.singleselect-clear {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 2px 6px;
  margin-left: 4px;
  transition: color 0.2s;
}

.singleselect-clear:hover {
  color: var(--error-color);
}

/* Profile Page */
#profile-page {
  max-width: 700px;
}

#profile-form {
  background: var(--surface);
  padding: 30px;
  border-radius: 12px;
}

/* Profile Picture */
.profile-picture-group {
  margin-bottom: 25px;
}

.profile-picture-container {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
}

.profile-picture-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-color);
}

.profile-picture-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 3px dashed var(--border);
}

.profile-picture-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-btn {
  cursor: pointer;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 10px;
}

/* User Card Avatar */
.user-card-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-card-avatar-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 15px;
}

.user-card-header-info {
  flex: 1;
  min-width: 0;
}

.user-card-header-info h3 {
  margin: 0;
  font-size: 1.2rem;
}

.user-location {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 3px;
}

.user-discord {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.discord-icon {
  font-size: 1rem;
}

/* Browse Filters */
.browse-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
  margin-bottom: 25px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
}

.browse-filters .btn {
  flex-shrink: 0;
  height: 46px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .user-info {
    justify-content: center;
  }
  
  .auth-container {
    margin: 50px 20px;
    padding: 30px 20px;
  }
  
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

.multiselect-error {
  margin-top: 6px;
  color: var(--error-color);
  font-size: 0.85rem;
  min-height: 1.1em;
}

.multiselect-disclaimer {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* small helper: reuse form-hint already exists; no further changes needed */
