:root {
  --brand: #6B3FA0;
  --brand-light: #E0B0FF;
  --brand-dark: #4A2A7A;
  --accent: #40C8E0;
  --bg: #FAF7F5;
  --bg-card: #FFFFFF;
  --text: #2D2D2D;
  --text-light: #6B6B6B;
  --border: #E8E0F0;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 20px rgba(107, 63, 160, 0.08);
  --shadow-hover: 0 8px 30px rgba(107, 63, 160, 0.16);
}

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

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

a { color: var(--brand); text-decoration: none; }

/* Auth */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #6B3FA0 0%, #40C8E0 100%);
}

.auth-card {
  background: #fff;
  border-radius: 24px;
  padding: 48px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-card h1 {
  font-size: 2rem;
  text-align: center;
  color: var(--brand);
  margin-bottom: 4px;
}

.auth-sub {
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: -8px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  border-color: var(--brand-light);
}

.auth-error { color: #D32F2F; font-size: 0.9rem; text-align: center; }
.auth-success { color: #2E7D32; font-size: 0.9rem; text-align: center; }

.btn-primary, .btn-secondary {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  display: block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(107, 63, 160, 0.25);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--brand-light);
}

/* App Nav */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--brand);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.btn-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-light);
}

.btn-link:hover {
  background: #f0e6f6;
  color: var(--brand);
}

/* Main */
.app-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* Browse */
.browse-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading, .no-profiles {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-light);
}

.no-profiles h2 {
  color: var(--text);
  margin-bottom: 8px;
}

.profile-card {
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 100%;
}

.profile-photos {
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  background: var(--bg);
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  padding: 24px;
}

.profile-info h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.profile-bio {
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 12px;
}

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

.tag {
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.profile-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px 24px;
}

.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid;
  font-size: 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-pass {
  border-color: #D32F2F;
  color: #D32F2F;
  background: #fff;
}

.action-pass:hover {
  background: #D32F2F;
  color: #fff;
}

.action-like {
  border-color: #2E7D32;
  color: #2E7D32;
  background: #fff;
}

.action-like:hover {
  background: #2E7D32;
  color: #fff;
}

/* Match Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: #fff;
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-content h2 {
  font-size: 2rem;
  color: var(--brand);
}

/* Messages */
.messages-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  min-height: 60vh;
}

@media (max-width: 640px) {
  .messages-layout { grid-template-columns: 1fr; }
}

.matches-list {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.matches-list h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.match-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.match-item:hover, .match-item.active {
  background: var(--brand-light);
}

.match-time {
  font-size: 0.8rem;
  color: var(--text-light);
}

.chat-area {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.chat-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  padding: 40px;
}

#chat-active {
  display: flex;
  flex-direction: column;
  height: 60vh;
}

.chat-header {
  padding: 16px 20px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 75%;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.message.own {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.other {
  align-self: flex-start;
  background: var(--bg);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 0.7rem;
  opacity: 0.7;
  display: block;
  margin-top: 4px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.chat-form input:focus {
  border-color: var(--brand-light);
}

.btn-send {
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-send:hover {
  background: var(--brand-dark);
}

/* Profile Edit */
.profile-edit {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.profile-edit h2 {
  margin-bottom: 24px;
}

.profile-edit form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-edit label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: -8px;
}

.profile-edit input,
.profile-edit select,
.profile-edit textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.profile-edit input:focus,
.profile-edit select:focus,
.profile-edit textarea:focus {
  border-color: var(--brand-light);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-group label {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  accent-color: var(--brand);
}
