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

:root {
  --primary: #ff6b35;
  --primary-dark: #e55a2b;
  --secondary: #7c4dff;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --dark: #1a1a2e;
  --darker: #16162a;
  --light: #eaeaea;
  --gray: #888;
  --card-bg: #252542;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--dark);
  color: var(--light);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 400px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.screen {
  min-height: 100vh;
  padding: 16px;
  padding-bottom: 80px;
}

.hidden {
  display: none !important;
}

/* Loading */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--card-bg);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

.loading-spinner.small {
  width: 24px;
  height: 24px;
}

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

/* Buttons */
.btn {
  background: var(--card-bg);
  color: var(--light);
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-upgrade {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  width: 100%;
  margin-top: 20px;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--gray);
}

input[type="text"],
input[type="date"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--light);
  font-size: 16px;
}

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

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

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--card-bg);
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--light);
}

.checkbox-group input[type="checkbox"] {
  width: auto;
}

/* Login */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.logo {
  font-size: 64px;
  color: var(--primary);
  margin-bottom: 16px;
}

#login-screen h1 {
  margin-bottom: 16px;
}

/* Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 400px;
  background: var(--darker);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  border-top: 1px solid var(--card-bg);
  z-index: 100;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
}

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

.nav-btn .icon {
  font-size: 24px;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab {
  background: var(--card-bg);
  border: none;
  color: var(--gray);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}

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

/* Profile Card */
.profile-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.card-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--darker);
}

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

.card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.card-info h3 {
  font-size: 24px;
  margin-bottom: 4px;
}

.card-info p {
  color: var(--gray);
  font-size: 14px;
}

.card-about {
  padding: 16px;
  color: var(--gray);
  font-size: 14px;
  line-height: 1.5;
}

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

.action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  cursor: pointer;
  transition: transform 0.2s;
}

.action-btn:active {
  transform: scale(0.9);
}

.action-btn.pass {
  background: var(--darker);
  color: var(--danger);
}

.action-btn.like {
  background: var(--primary);
  color: white;
}

.action-btn.superlike {
  background: var(--secondary);
  color: white;
  width: 50px;
  height: 50px;
  font-size: 20px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}

/* Matches List */
.matches-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.match-item {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.match-item:hover {
  transform: scale(1.02);
}

.match-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.match-item-info {
  padding: 8px;
  text-align: center;
}

.match-item-info h4 {
  font-size: 14px;
  margin-bottom: 2px;
}

.match-item-info p {
  font-size: 12px;
  color: var(--gray);
}

/* Conversations */
.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  border-radius: 12px;
  cursor: pointer;
}

.conversation-item img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

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

.conversation-info h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.conversation-info p {
  font-size: 14px;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item.unread {
  border-left: 3px solid var(--primary);
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 12px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--light);
  font-size: 24px;
  cursor: pointer;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
}

.message.sent {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

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

.message-input {
  display: flex;
  gap: 8px;
  padding: 12px 0;
}

.message-input input {
  flex: 1;
}

/* Profile View */
.profile-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-photo {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
}

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

.btn-edit-photo {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: 3px solid var(--dark);
  cursor: pointer;
  font-size: 20px;
}

.tier-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  text-transform: uppercase;
}

.tier-badge.free {
  background: var(--card-bg);
}

.tier-badge.plus {
  background: var(--secondary);
}

.tier-badge.gold {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
}

.profile-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.profile-section h3 {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 8px;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photos-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.toggle input {
  width: 48px;
  height: 24px;
}

/* Popup */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.popup-content {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.match-content h2 {
  margin-bottom: 20px;
}

.match-photos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.match-photos img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

.match-photos .heart {
  font-size: 32px;
  color: var(--primary);
}

.match-content .btn {
  display: block;
  width: 100%;
  margin-top: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--darker);
}

::-webkit-scrollbar-thumb {
  background: var(--card-bg);
  border-radius: 3px;
}
