@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(255, 45, 120, 0.3);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent: #ff2d78;
  --accent-glow: rgba(255, 45, 120, 0.15);
  --gold: #ffd700;
  --gold-glow: rgba(255, 215, 0, 0.15);
  --success: #10b981;
  --danger: #ef4444;
  --info: #06b6d4;
  --rarity-common: #9ca3af;
  --rarity-rare: #6366f1;
  --rarity-epic: #a855f7;
  --rarity-legendary: #ffd700;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(255, 45, 120, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(99, 102, 241, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.85; }

/* ============ NAV ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; text-decoration: none;
}
.nav-brand-icon { font-size: 24px; }
.nav-brand-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #ff6b9d);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-link {
  padding: 8px 16px; border-radius: 8px;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  transition: var(--transition); cursor: pointer;
  border: none; background: none; font-family: inherit;
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); background: var(--bg-card); }
.nav-link.active { color: var(--accent); }

.nav-hearts {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--gold-glow); border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 20px; font-size: 14px; font-weight: 600; color: var(--gold);
}

.nav-username { font-weight: 500; font-size: 14px; color: var(--text-primary); }

.btn-logout {
  padding: 6px 14px;
  background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444; border-radius: 8px; font-size: 13px;
  cursor: pointer; transition: var(--transition);
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.2); }

/* ============ MAIN ============ */
.main { padding-top: 80px; min-height: 100vh; position: relative; z-index: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.view { display: none; }
.view.active { display: block; }

/* ============ AUTH ============ */
.auth-container { max-width: 420px; margin: 60px auto; padding: 0 24px; }
.auth-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
}
.auth-title { font-size: 28px; margin-bottom: 8px; text-align: center; }
.auth-subtitle { color: var(--text-secondary); text-align: center; margin-bottom: 32px; font-size: 15px; }

.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-primary);
  font-size: 15px; font-family: 'DM Sans', sans-serif;
  transition: var(--transition); outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
.form-error { color: var(--danger); font-size: 13px; margin-top: 8px; display: none; }
.form-error.visible { display: block; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: 10px;
  font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff6b9d);
  color: white; box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(255, 45, 120, 0.3); }

.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--border-accent); }

.btn-gold { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #1a1a2e; box-shadow: 0 4px 16px var(--gold-glow); }
.btn-gold:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(255, 215, 0, 0.3); }

.btn-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #ef4444; }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }

/* ============ MARKETPLACE ============ */
.marketplace-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 32px;
}
.marketplace-title { font-size: 32px; }
.marketplace-title span { color: var(--accent); }

.marketplace-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text-secondary); font-size: 13px;
  font-weight: 500; cursor: pointer; transition: var(--transition); font-family: inherit;
}
.filter-btn:hover, .filter-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.gf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px; margin-bottom: 60px;
}

/* ============ GIRLFRIEND CARD — SEDUCTIVE IMAGE CARDS ============ */
.gf-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}
.gf-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: var(--border-accent);
  box-shadow: 0 16px 48px rgba(255, 45, 120, 0.15);
}

/* Full-bleed image area */
.gf-card-image {
  width: 100%;
  height: 320px;
  position: relative;
  overflow: hidden;
}
.gf-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.5s ease;
}
.gf-card:hover .gf-card-image img {
  transform: scale(1.05);
}

/* Personality badge on image */
.personality-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
  z-index: 2;
}

/* Personality badge colors — each archetype gets a unique vibe */
.personality-tsundere { background: rgba(236, 72, 153, 0.85); color: white; }
.personality-yandere { background: rgba(220, 38, 38, 0.85); color: white; }
.personality-kuudere { background: rgba(99, 102, 241, 0.85); color: white; }
.personality-genki { background: rgba(34, 197, 94, 0.85); color: white; }
.personality-flirty { background: rgba(6, 182, 212, 0.85); color: white; }
.personality-dominant { background: rgba(245, 158, 11, 0.85); color: #1a1a2e; }
.personality-nurturing { background: rgba(16, 185, 129, 0.85); color: white; }
.personality-dark { background: rgba(75, 85, 99, 0.85); color: white; }
.personality-dandere { background: rgba(249, 115, 22, 0.85); color: white; }
.personality-wild { background: rgba(168, 85, 247, 0.85); color: white; }
.personality-mysterious { background: rgba(99, 102, 241, 0.85); color: white; }
.personality-sophisticated { background: rgba(14, 165, 233, 0.85); color: white; }
.personality-default { background: rgba(255, 45, 120, 0.85); color: white; }

/* Small personality badge for chat header */
.personality-badge-sm {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.personality-badge-sm.personality-tsundere { background: rgba(236, 72, 153, 0.2); color: #ec4899; }
.personality-badge-sm.personality-yandere { background: rgba(220, 38, 38, 0.2); color: #ef4444; }
.personality-badge-sm.personality-kuudere { background: rgba(99, 102, 241, 0.2); color: #6366f1; }
.personality-badge-sm.personality-genki { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.personality-badge-sm.personality-flirty { background: rgba(6, 182, 212, 0.2); color: #06b6d4; }
.personality-badge-sm.personality-dominant { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.personality-badge-sm.personality-nurturing { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.personality-badge-sm.personality-dark { background: rgba(75, 85, 99, 0.2); color: #9ca3af; }
.personality-badge-sm.personality-dandere { background: rgba(249, 115, 22, 0.2); color: #f97316; }
.personality-badge-sm.personality-wild { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.personality-badge-sm.personality-mysterious { background: rgba(99, 102, 241, 0.2); color: #6366f1; }
.personality-badge-sm.personality-sophisticated { background: rgba(14, 165, 233, 0.2); color: #0ea5e9; }
.personality-badge-sm.personality-default { background: rgba(255, 45, 120, 0.2); color: var(--accent); }

/* Rarity badge positioned on card image */
.card-rarity {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.gf-card-body { padding: 16px 20px 20px; }

.gf-card-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  font-family: 'Space Grotesk', sans-serif;
}

.gf-card-tagline {
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
  margin-bottom: 12px;
  line-height: 1.4;
}

.gf-card-traits { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.trait-tag {
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gf-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.gf-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.gf-status.available { color: var(--success); }
.gf-status.taken { color: var(--accent); }

.gf-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.gf-status.available .gf-status-dot { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.gf-status.taken .gf-status-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }

.gf-card-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
.gf-card-stats span { display: flex; align-items: center; gap: 3px; }

/* Rarity border glow */
.gf-card[data-rarity="rare"] { border-color: rgba(99, 102, 241, 0.3); }
.gf-card[data-rarity="rare"]:hover { box-shadow: 0 16px 48px rgba(99, 102, 241, 0.2); }
.gf-card[data-rarity="epic"] { border-color: rgba(168, 85, 247, 0.3); }
.gf-card[data-rarity="epic"]:hover { box-shadow: 0 16px 48px rgba(168, 85, 247, 0.2); }
.gf-card[data-rarity="legendary"] { border-color: rgba(255, 215, 0, 0.4); }
.gf-card[data-rarity="legendary"]:hover { box-shadow: 0 16px 48px rgba(255, 215, 0, 0.25); }
.gf-card[data-rarity="legendary"]::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 170, 0, 0.1), rgba(255, 215, 0, 0.3));
  z-index: -1;
  animation: legendaryShimmer 3s ease infinite;
}
@keyframes legendaryShimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.rarity-badge {
  padding: 3px 10px; border-radius: 12px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.rarity-common { background: rgba(156, 163, 175, 0.15); color: var(--rarity-common); }
.rarity-rare { background: rgba(99, 102, 241, 0.15); color: var(--rarity-rare); }
.rarity-epic { background: rgba(168, 85, 247, 0.15); color: var(--rarity-epic); }
.rarity-legendary { background: rgba(255, 215, 0, 0.15); color: var(--rarity-legendary); border: 1px solid rgba(255, 215, 0, 0.3); }

/* ============ PROFILE VIEW ============ */
.profile-hero {
  display: flex; gap: 32px; align-items: flex-start;
  margin-bottom: 40px; flex-wrap: wrap;
}

.profile-image-container {
  width: 320px;
  height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  border: 1px solid var(--border);
}
.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.profile-image-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px;
  display: flex;
  align-items: flex-end;
  min-height: 80px;
}
.profile-image-badges {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.profile-image-badges .personality-badge {
  position: static;
}

.profile-info { flex: 1; min-width: 280px; }

.profile-name {
  font-size: 36px; margin-bottom: 4px;
  display: flex; align-items: center; gap: 12px;
}

.profile-tagline {
  color: var(--text-secondary);
  font-style: italic; font-size: 16px;
  margin-bottom: 16px;
}

.profile-personality-section {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.profile-personality-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.profile-personality {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 14px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px; margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px; font-weight: 700; color: var(--text-primary);
}
.stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px;
}

.profile-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

.profile-owner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--accent-glow); border: 1px solid rgba(255, 45, 120, 0.2);
  border-radius: 10px; font-size: 14px; margin-bottom: 16px;
}
.profile-owner .owner-label { color: var(--text-secondary); }
.profile-owner .owner-name { color: var(--accent); font-weight: 600; }

/* ============ CHAT ============ */
.chat-container {
  max-width: 800px; margin: 0 auto;
  display: flex; flex-direction: column;
  height: calc(100vh - 100px);
}

.chat-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.chat-header-info h3 { font-size: 18px; }
.chat-header-info span { font-size: 13px; color: var(--text-secondary); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px 0;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.chat-msg {
  max-width: 75%; padding: 12px 18px;
  border-radius: 18px; font-size: 14px;
  line-height: 1.5; animation: msgIn 0.3s ease;
  word-wrap: break-word;
  word-break: break-word;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #ff6b9d);
  color: white; border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-secondary); border: 1px solid var(--border);
  color: var(--text-primary); border-bottom-left-radius: 4px;
}
.chat-msg-time { font-size: 10px; color: rgba(255, 255, 255, 0.5); margin-top: 4px; }
.chat-msg.assistant .chat-msg-time { color: var(--text-muted); }

.chat-input-container {
  display: flex; gap: 12px; padding: 16px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-primary);
  position: sticky;
  bottom: 0;
}
.chat-input {
  flex: 1; padding: 14px 20px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 24px; color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  outline: none; transition: var(--transition);
  resize: none;
  max-height: 120px;
  min-height: 48px;
  overflow-y: auto;
  line-height: 1.5;
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.chat-send-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ff6b9d);
  border: none; color: white; font-size: 18px;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-send-btn:hover:not(:disabled) { transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; }
.chat-send-btn:active:not(:disabled) { transform: scale(0.95); }

.chat-typing {
  align-self: flex-start;
  padding: 12px 18px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 18px; border-bottom-left-radius: 4px;
  display: none;
}
.chat-typing.visible { display: flex; gap: 4px; align-items: center; }

.typing-dot {
  width: 6px; height: 6px;
  background: var(--text-muted); border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ============ LEADERBOARD ============ */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px; margin-bottom: 60px;
}
.lb-section {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.lb-section-title {
  font-size: 18px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.lb-list { list-style: none; }
.lb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.lb-item:last-child { border-bottom: none; }

.lb-rank {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--bg-card); color: var(--text-secondary); flex-shrink: 0;
}
.lb-rank.gold { background: var(--gold-glow); color: var(--gold); }
.lb-rank.silver { background: rgba(192, 192, 192, 0.15); color: #c0c0c0; }
.lb-rank.bronze { background: rgba(205, 127, 50, 0.15); color: #cd7f32; }

.lb-item-info { flex: 1; min-width: 0; }
.lb-item-name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-item-sub { font-size: 12px; color: var(--text-muted); }
.lb-item-value {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}

.activity-list { max-height: 500px; overflow-y: auto; }
.activity-item {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: 13px; line-height: 1.5;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.activity-type { font-weight: 600; }
.activity-type.claim { color: var(--success); }
.activity-type.steal { color: var(--accent); }
.activity-type.steal_failed { color: var(--text-muted); }

/* ============ COLLECTION ============ */
.dashboard-header { margin-bottom: 32px; }
.dashboard-header h2 { font-size: 28px; margin-bottom: 8px; }

.dashboard-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; margin-bottom: 32px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.collection-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition); cursor: pointer;
}
.collection-card:hover { border-color: var(--border-accent); background: var(--bg-card-hover); }

.collection-avatar {
  width: 64px; height: 64px;
  border-radius: 50%; flex-shrink: 0;
  object-fit: cover;
  border: 2px solid var(--border);
}
.collection-info { flex: 1; min-width: 0; }
.collection-name { font-weight: 600; font-size: 16px; margin-bottom: 2px; }
.collection-personality {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 2px;
}
.collection-sub { font-size: 12px; color: var(--text-secondary); }
.collection-actions { display: flex; gap: 8px; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text-primary); }

/* ============ TOAST ============ */
.toast-container {
  position: fixed; top: 80px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
  max-width: 400px; box-shadow: var(--shadow);
}
.toast.success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--success); }
.toast.error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); }
.toast.info { background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); color: var(--info); }

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

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; display: none;
}
.modal-overlay.visible { display: flex; }

.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  max-width: 480px; width: 100%;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal h3 { font-size: 22px; margin-bottom: 12px; }
.modal p { color: var(--text-secondary); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ============ LOADING ============ */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-container { display: flex; justify-content: center; padding: 60px 0; }

/* Mobile loading state — dating app feel */
@media (max-width: 480px) {
  .spinner {
    width: 36px;
    height: 36px;
    border-width: 3px;
    border-top-color: var(--accent);
    border-right-color: rgba(255, 45, 120, 0.3);
  }
  .loading-container {
    padding: 100px 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ RESPONSIVE — MOBILE-FIRST DATING APP UX ============ */

/* Tablet: 768px and below */
@media (max-width: 768px) {
  /* iOS zoom prevention — CRITICAL for mobile forms */
  .form-input, .chat-input { font-size: 16px !important; }

  /* Touch targets — minimum 44px for easy tapping */
  .btn { min-height: 44px; padding: 12px 20px; }
  .nav-link { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .filter-btn { min-height: 40px; padding: 10px 16px; font-size: 14px; }

  /* Top nav adjustments */
  .nav { padding: 0 12px; height: 56px; }
  .nav-links { gap: 4px; }
  .nav-brand-text { display: none; }
  .nav-brand-icon { font-size: 22px; }

  /* Container spacing */
  .container { padding: 0 16px; }
  .main { padding-top: 70px; padding-bottom: 20px; }

  /* Typography — scale down for mobile */
  .marketplace-title { font-size: 26px; }
  .auth-title { font-size: 24px; }
  .profile-name { font-size: 28px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }

  /* Grid — 2 columns on tablet */
  .gf-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 40px;
  }
  .gf-card-image { height: 240px; }
  .gf-card-body { padding: 14px 16px 16px; }
  .gf-card-name { font-size: 18px; }
  .gf-card-tagline { font-size: 12px; }

  /* Profile view — full-screen hero */
  .profile-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    margin-bottom: 32px;
  }
  .profile-image-container {
    width: 100%;
    max-width: 100%;
    height: 60vh;
    min-height: 400px;
    max-height: 600px;
    border-radius: var(--radius);
  }
  .profile-info { text-align: left; }
  .profile-actions {
    flex-direction: column;
    gap: 12px;
  }
  .profile-actions .btn { width: 100%; }

  /* Chat — more screen space */
  .chat-container { height: calc(100vh - 80px); }
  .chat-header { padding: 12px 0; }
  .chat-messages { padding: 12px 0; }
  .chat-input-container { padding: 12px 0; }
  .chat-msg { max-width: 80%; padding: 10px 16px; }

  /* Modals — bottom sheet style */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px 20px 32px;
  }
  .modal h3 { font-size: 20px; }
  .paywall-title { font-size: 22px; }
  .paywall-amount { font-size: 40px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }

  /* Leaderboard */
  .leaderboard-grid { grid-template-columns: 1fr; gap: 20px; }

  /* Toast positioning — center on mobile like native apps */
  .toast-container {
    top: 70px;
    right: 16px;
    left: 16px;
    align-items: center;
  }
  .toast {
    max-width: 100%;
    animation: toastInMobile 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), toastOut 0.3s ease 3.7s forwards;
  }

  @keyframes toastInMobile {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* Collection */
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile: 480px and below — single column, thumb-optimized */
@media (max-width: 480px) {
  /* Typography — compact for small screens */
  .marketplace-title { font-size: 22px; }
  .marketplace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
  }
  .marketplace-filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; }

  /* Single column grid — Tinder-style focus with polish */
  .gf-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
  }
  .gf-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }
  .gf-card-image {
    height: 420px;
  }
  .gf-card-body {
    padding: 18px;
  }
  .gf-card-name {
    font-size: 22px;
    margin-bottom: 6px;
  }
  .gf-card-tagline {
    font-size: 14px;
    margin-bottom: 14px;
    line-height: 1.4;
  }
  .gf-card-footer {
    padding-top: 14px;
  }

  /* Auth forms */
  .auth-container { padding: 0 16px; margin-top: 20px; }
  .auth-card {
    padding: 28px 20px;
    border-radius: var(--radius);
  }
  .auth-title { font-size: 22px; margin-bottom: 6px; }
  .auth-subtitle { font-size: 14px; margin-bottom: 24px; }
  .form-group { margin-bottom: 18px; }
  .form-input {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 12px;
  }
  .form-label {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .btn-logout {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Profile — immersive full-screen like dating apps */
  .profile-image-container {
    height: 58vh;
    min-height: 400px;
    max-height: 550px;
    border-radius: var(--radius);
    margin: 0 -16px;
    width: calc(100% + 32px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }
  .profile-name {
    font-size: 26px;
    margin-bottom: 8px;
  }
  .profile-tagline {
    font-size: 15px;
    margin-bottom: 20px;
  }
  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 24px;
  }
  .stat-box { padding: 14px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 10px; }

  /* Make "Start Dating" button prominent */
  .profile-actions .btn-primary.btn-lg,
  .profile-actions .btn-gold.btn-lg {
    font-size: 17px;
    padding: 16px 28px;
    box-shadow: 0 6px 20px rgba(255, 45, 120, 0.3);
    font-weight: 700;
  }

  .profile-actions .btn-primary.btn-lg:active,
  .profile-actions .btn-gold.btn-lg:active {
    transform: scale(0.97);
    box-shadow: 0 4px 16px rgba(255, 45, 120, 0.4);
  }

  /* Back button on profile — sticky with clean shadow */
  #profile-content > div:first-child {
    position: sticky;
    top: 56px;
    z-index: 20;
    background: var(--bg-primary);
    padding: 12px 0;
    margin: -12px 0 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  #profile-content > div:first-child .btn {
    min-height: 40px;
  }

  /* Chat — full-screen messaging experience like iMessage */
  .chat-container {
    height: calc(100vh - 70px);
    max-width: 100%;
  }
  .chat-header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
    margin-bottom: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  .chat-messages {
    padding: 16px 0;
    gap: 12px;
    flex: 1;
    /* Smooth scroll behavior */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  .chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.45;
  }
  .chat-input {
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 22px;
    min-height: 48px;
    line-height: 1.5;
  }
  .chat-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 45, 120, 0.1);
  }
  .chat-send-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
    flex-shrink: 0;
  }
  .chat-input-container {
    padding: 14px 0;
    gap: 12px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  }

  /* Modals — full-width bottom sheets with polish */
  .modal {
    padding: 24px 20px 32px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
  }
  .paywall-modal {
    padding: 20px 20px 24px;
  }
  .paywall-icon {
    font-size: 56px;
    margin-bottom: 12px;
  }
  .paywall-title {
    font-size: 22px;
    margin-bottom: 8px;
  }
  .paywall-amount {
    font-size: 40px;
    letter-spacing: -0.02em;
  }
  .paywall-features {
    padding: 16px;
    margin: 20px 0;
  }
  .paywall-feature {
    font-size: 14px;
    padding: 8px 0;
    line-height: 1.5;
  }

  /* Make payment buttons extra prominent */
  .modal .btn-primary.btn-lg,
  .modal .btn-premium.btn-lg {
    font-size: 17px;
    padding: 16px 28px;
    min-height: 52px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(255, 45, 120, 0.35);
  }

  .modal .btn-premium.btn-lg {
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.35);
  }

  /* Collection */
  .collection-grid { grid-template-columns: 1fr; gap: 12px; }
  .collection-card { padding: 12px; }

  /* Hide elements that take up space */
  .nav-hearts { display: none; }
  .nav-username { display: none; }

  /* Bottom spacing for mobile */
  .main { padding-bottom: 40px; }
}

/* ============ PREMIUM / PAYWALL ============ */

.btn-premium {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 50%, #ff2d78 100%);
  color: #000;
  font-weight: 700;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-shadow: none;
  animation: premium-glow 3s ease-in-out infinite;
}

.btn-premium:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.btn-premium.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

@keyframes premium-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
}

.nav-premium-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 8px;
}

/* Paywall Modal */
.paywall-modal {
  text-align: center;
  padding: 8px 0;
}

.paywall-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.paywall-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffd700 0%, #ff2d78 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.paywall-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.paywall-price {
  margin: 16px 0 4px;
}

.paywall-amount {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
}

.paywall-period {
  font-size: 18px;
  color: var(--text-secondary);
}

.paywall-trial {
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}

.paywall-features {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.paywall-feature {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.paywall-feature:last-child {
  border-bottom: none;
}

/* ===== GALLERY CAROUSEL ===== */
.gallery-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
}

.gallery-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.gallery-slide {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  flex-grow: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-slide.active {
  opacity: 1;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 10;
  opacity: 0;
}

.gallery-carousel:hover .gallery-nav {
  opacity: 1;
}

.gallery-nav:hover {
  background: rgba(255, 45, 120, 0.8);
  border-color: rgba(255, 45, 120, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.gallery-nav-prev {
  left: 16px;
}

.gallery-nav-next {
  right: 16px;
}

.gallery-indicators {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.gallery-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.gallery-indicator:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: scale(1.2);
}

.gallery-indicator.active {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.3);
}

/* Mobile touch optimization */
@media (max-width: 768px) {
  .gallery-nav {
    opacity: 0.8;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .gallery-nav-prev {
    left: 12px;
  }

  .gallery-nav-next {
    right: 12px;
  }

  .gallery-indicators {
    bottom: 16px;
    gap: 8px;
  }

  .gallery-indicator {
    width: 8px;
    height: 8px;
    /* Visual circle stays small but tap area is large */
    position: relative;
  }

  .gallery-indicator::after {
    content: '';
    position: absolute;
    top: -18px;
    left: -18px;
    right: -18px;
    bottom: -18px;
  }

  /* Always show navigation on mobile */
  .gallery-carousel .gallery-nav {
    opacity: 0.7;
  }

  .gallery-carousel .gallery-nav:active {
    opacity: 1;
    transform: translateY(-50%) scale(0.95);
  }

  /* Better mobile card interaction — dating app tap feedback */
  .gf-card {
    transition: transform 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
  }

  /* Remove hover states on mobile, use tap instead */
  .gf-card:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
  }

  .gf-card:active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform 0.1s ease, opacity 0.1s ease;
  }
}

/* Prevent text selection during swipe */
.gallery-carousel * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ============ MOBILE-SPECIFIC ENHANCEMENTS ============ */
@media (max-width: 768px) {
  /* Smooth horizontal scroll for filters with gradient hint */
  .marketplace-header {
    position: relative;
  }

  .marketplace-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    padding-right: 40px; /* Space for gradient */
    position: relative;
  }

  .marketplace-filters::-webkit-scrollbar {
    display: none;
  }

  /* Subtle gradient to indicate more content */
  .marketplace-filters::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 4px;
    width: 40px;
    background: linear-gradient(90deg, transparent, var(--bg-primary));
    pointer-events: none;
    opacity: 0.9;
  }

  /* Better tap states for all interactive elements — dating app feel */
  .btn:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 0.1s cubic-bezier(0.4, 0.0, 0.2, 1);
  }

  .btn-primary:active:not(:disabled) {
    transform: scale(0.96);
    box-shadow: 0 2px 12px rgba(255, 45, 120, 0.4);
  }

  .filter-btn:active {
    transform: scale(0.93);
    transition: transform 0.1s ease;
  }

  .nav-link:active {
    background: var(--bg-card-hover);
    transform: scale(0.95);
  }

  /* Collection card tap feedback */
  .collection-card:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Chat send button tap */
  .chat-send-btn:active:not(:disabled) {
    transform: scale(0.9);
  }

  /* Improve touch scrolling */
  .chat-messages, .activity-list {
    -webkit-overflow-scrolling: touch;
  }

  /* Modal animation for bottom sheet — smooth native feel */
  .modal-overlay {
    animation: overlayFadeIn 0.25s ease;
  }

  @keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes modalIn {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .modal {
    animation: modalIn 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
  }

  /* Better card spacing for thumb scrolling */
  .gf-card {
    scroll-margin-top: 80px;
  }

  /* Safe area insets for iPhone notch */
  .nav {
    padding-top: env(safe-area-inset-top);
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .main {
    padding-top: calc(70px + env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .modal {
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .chat-input-container {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* Extra small mobile adjustments */
@media (max-width: 375px) {
  .marketplace-title { font-size: 20px; }
  .filter-btn { padding: 8px 14px; font-size: 13px; }
  .gf-card-name { font-size: 18px; }
}
