:root {
  --bg-dark: rgb(15, 23, 42);
  --bg-panel: #1e293b;
  --primary: #ec4899;
  --primary-hover: #db2777;
  --danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --header-height: 65px;
  --nav-height: 65px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  accent-color: var(--primary);
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  resize: none;
  user-select: none;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
    Noto Color Emoji;
  background: var(--bg-panel);
  color: var(--text-main);
  overscroll-behavior-y: none;
}

/* Base Layout */
#app {
  height: 100dvh;
  margin-left: auto;
  margin-right: auto;
  max-width: 640px;
  width: 100%;
  background: var(--bg-dark);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

#app-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--nav-height);
  position: relative;
  animation: fadeIn 0.3s ease-in-out; /* NEW: Smooth transitions */
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* NEW: Global Dynamic Header */
.top-header {
  height: var(--header-height);
  padding: 0 15px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px); /* Glassmorphism */
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  gap: 15px;
}

.top-header h2 {
  flex-grow: 8;
  text-align: left;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  width: 100%;
}

.header-btn {
  font-size: 26px !important;
  color: var(--text-muted) !important;
}

.header-actions {
  right: 15px;
  display: flex;
  gap: 10px;
}

.header-actions button.btn-icon {
  aspect-ratio: 1/1;
  flex-shrink: 0;
  font-size: 24px;
}

/* Remove old hardcoded headers you previously had */
.chat-header,
.profile-top-bar {
  display: none !important;
}
/* Forms & Inputs */
.auth-container {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 30px;
  height: 100%;
}

.auth-container h1 {
  font-size: 2.5rem;
  margin-top: 0px;
  margin-bottom: 0px;
  background: linear-gradient(to right, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}
.auth-container h2 {
  text-align: center;
}
.auth-container h2 span {
  background: linear-gradient(to right, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-container p.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.auth-footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 15px;
  height: 100%;
  text-align: center;
  color: rgba(30, 41, 59, 1);
}

form {
  width: 100%;
}

form label {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

input,
select {
  width: 100%;
  padding: 14px;
  margin: 8px 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.5);
  color: white;
  font-size: 16px;
  transition: border-color 0.3s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

button {
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  width: 100%;
}

button:active {
  transform: scale(0.98);
}
button.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
button.btn-icon {
  background: transparent;
  color: var(--text-muted);
  width: auto;
  padding: 5px 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.auth-switch,
.switch-auth {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.auth-switch a,
.switch-auth a {
  color: var(--primary);
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
}

/* Bottom Nav & Badges */
.bottom-nav {
  bottom: 0;
  width: 100%;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border-color);
  z-index: 1000;
}

.nav-item {
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  transition: color 0.3s, transform 0.2s;
  padding: 10px;
  text-decoration: none;
  position: relative;
}
.nav-item.active {
  color: var(--primary);
  transform: translateY(-3px);
}

.badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  position: absolute;
  top: 5px;
  right: 0;
  border: 2px solid var(--bg-dark);
}

/* --- ONLINE INDICATORS & TAGS --- */
.online-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: #10b981;
  border-radius: 50%;
  margin-left: 8px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  border: 2px solid var(--bg-dark);
}

.online-text {
  color: #10b981;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.attr-tag {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.attr-tag i {
  color: var(--primary);
  font-size: 16px;
}

/* --- NEW PROFILE EDITOR & INTERESTS UI --- */
textarea {
  width: 100%;
  padding: 14px;
  margin: 8px 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.5);
  color: white;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.3s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-section-title {
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 15px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

.interest-pill {
  background: rgba(236, 72, 153, 0.1);
  color: var(--primary);
  border: 1px solid rgba(236, 72, 153, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  display: inline-block;
  text-transform: capitalize;
}

/* --- PROFILE TABS & LIVE PREVIEW --- */
.profile-tabs {
  display: flex;
  margin-top: 15px;
  border-bottom: 1px solid var(--border-color);
}
.profile-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.profile-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.profile-content-area {
  padding: 20px;
}

/* Info Chips */
.info-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.info-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Photo Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.photo-grid-item {
  aspect-ratio: 1;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.photo-grid-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  display: flex;
  justify-content: space-around;
  padding: 5px;
}
.photo-action-btn {
  background: transparent;
  border: none;
  color: white;
  padding: 5px;
  cursor: pointer;
  font-size: 16px;
}
.photo-action-btn.primary-active {
  color: #fbbf24;
}
.photo-action-btn.delete {
  color: var(--danger);
}

/* Interactive Tag Input */
.tag-input-container {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 15px;
  margin: 8px 0 16px;
}

#tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-input-container input {
  border: none;
  background: transparent;
  padding: 4px;
  margin: 0;
  flex: 1;
  min-width: 120px;
}
.tag-input-container input:focus {
  border: none;
  outline: none;
}
.tag-pill {
  background: rgba(236, 72, 153, 0.2);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tag-pill i {
  cursor: pointer;
  font-weight: bold;
}

/* --- CARD STACK --- */
.swipe-card {
  height: 100%;
  width: 100%;
  position: absolute; /* Stacks cards on top of each other */
  top: 0;
  left: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform-origin: 50% 100%; /* Makes the swipe rotation look natural */
  will-change: transform;
}

#cardStack .empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  padding: 20px;
}

.card-overlay {
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.95) 85%);
  padding: 40px 20px 20px;
}

.card-overlay h2 {
  margin: 0 0 8px;
  font-size: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-overlay p {
  margin: 0 0 20px;
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1.4;
}

.action-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 10px;
}

.action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.action-btn.pass {
  color: var(--danger);
}
.action-btn.like {
  color: var(--primary);
  background: rgba(236, 72, 153, 0.1);
  border-color: var(--primary);
}

/* Matches Grid */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 0 15px 15px;
}

.match-item {
  background: var(--bg-panel);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.match-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.match-info {
  padding: 12px;
}
.match-info h4 {
  margin: 0 0 4px;
  font-size: 16px;
}
.match-info p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-info p.unread-text {
  color: var(--text-main);
  font-weight: bold;
}

/* Profile Layout & Settings */
.profile-top-bar {
  display: flex;
  justify-content: space-between;
  padding: 15px;
}
.profile-header {
  text-align: center;
  padding: 20px 20px;
}

.avatar-container {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background-color: var(--primary);
  margin: 0 auto 20px;
  border: 4px solid var(--bg-dark);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.4);
  position: relative;
}

.edit-photo-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--bg-panel);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
  color: white;
}

.bubble-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px;
  justify-content: center;
}

.bubble {
  background: rgba(51, 65, 85, 0.6);
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.premium-badge {
  background: linear-gradient(45deg, #fbbf24, #d97706);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
}

/* Settings UI */
.settings-group {
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}
.setting-item:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider:before {
  transform: translateX(22px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Chat UI */
.chat-header {
  padding: 15px;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 15px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
}
.chat-bubble.me {
  align-self: flex-end;
  background: var(--primary);
  border-bottom-right-radius: 4px;
}
.chat-bubble.them {
  align-self: flex-start;
  background: var(--bg-panel);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

/* --- Message Meta & Ticks --- */
.chat-bubble {
  position: relative;
  padding-bottom: 22px; /* Make room for time/ticks */
  min-width: 90px;
}
.chat-meta {
  position: absolute;
  right: 12px;
  bottom: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-tick {
  font-size: 14px;
  margin-top: 2px;
}
.chat-tick.read {
  color: #3b82f6;
}
.chat-tick.delivered {
  color: var(--text-muted);
}

/* --- Date Dividers --- */
.chat-date-divider {
  text-align: center;
  margin: 15px 0;
}
.chat-date-divider span {
  background: rgba(30, 41, 59, 0.8);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- Reply Quotes --- */
.reply-quote {
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--primary);
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-preview-bar {
  display: none;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  padding: 10px 15px;
  align-items: center;
  justify-content: space-between;
  border-left: 4px solid var(--primary);
  font-size: 14px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- Deleted Messages --- */
.chat-bubble.deleted {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-style: italic;
}

/* --- Context Menu (Long Press) --- */
.msg-context-menu {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 150px;
}
.msg-context-menu button {
  background: transparent;
  color: white;
  padding: 12px 15px;
  text-align: left;
  border-radius: 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-context-menu button:last-child {
  border-bottom: none;
}
.msg-context-menu button:hover {
  background: rgba(255, 255, 255, 0.05);
}
.msg-context-menu button.danger {
  color: var(--danger);
}

.chat-input-area {
  padding: 15px;
  background: var(--bg-panel);
  display: flex;
  gap: 10px;
  padding-bottom: calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-color);
}

.chat-input-area input {
  margin: 0;
  border-radius: 24px;
  background: var(--bg-dark);
  padding-left: 20px;
}
.chat-input-area button {
  width: 50px;
  height: 50px;
  aspect-ratio: 1/1;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Chat Image Upload & Bubbles --- */
.chat-attach-btn {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
}
.chat-attach-btn:active {
  color: var(--primary);
  transform: scale(0.95);
}

.chat-image-preview {
  display: none;
  padding: 10px 15px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  position: relative;
}
.chat-image-preview img {
  height: 60px;
  width: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  object-fit: cover;
}
.chat-image-preview button {
  position: absolute;
  top: 2px;
  left: 65px;
  width: 26px;
  height: 26px;
  padding: 0;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  border: 2px solid var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.chat-msg-img {
  max-width: 100%;
  border-radius: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: block;
}
.chat-bubble {
  display: flex;
  flex-direction: column;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
}
.toast {
  background: #334155;
  color: white;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease forwards;
}
.toast.success {
  border-left: 4px solid #10b981;
}
.toast.error {
  border-left: 4px solid #ef4444;
}
.toast.match {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border: none;
  font-weight: bold;
  justify-content: center;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}
.empty-state i {
  font-size: 64px;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* Top Tabs for Matches/Likes */
.top-tabs {
  display: flex;
  padding: 15px;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-tabs button {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 20px;
  cursor: pointer;
}
.top-tabs button.active {
  background: rgba(236, 72, 153, 0.1);
  color: var(--primary);
  border-color: var(--primary);
}

/* --- SKELETON LOADER ANIMATIONS --- */
.skeleton-card {
  height: 100%;
  width: 100%;
  scroll-snap-align: start;
  background: var(--bg-panel);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  animation: shimmer 1.5s infinite;
  z-index: 1;
}

.skeleton-text {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  margin-bottom: 12px;
  height: 20px;
}

.skeleton-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* --- UPDATED TOP TABS (NOW USING A TAGS FOR HASHES) --- */
.top-tabs {
  display: flex;
  padding: 15px;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-block;
  font-size: 14px;
}

.top-tabs a.active {
  background: rgba(236, 72, 153, 0.1);
  color: var(--primary);
  border-color: var(--primary);
}

/* Photo Carousel Progress Bars */
.card-progress-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.card-progress-bar .bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}
.card-progress-bar .bar.active {
  background: #fff;
}

/* Premium Features */
.blurred-img {
  filter: blur(12px);
  pointer-events: none;
}
.premium-banner {
  padding: 15px;
  text-align: center;
}
.premium-banner button {
  background: linear-gradient(45deg, #fbbf24, #d97706);
  border: none;
  font-weight: bold;
  padding: 12px 20px;
  border-radius: 24px;
  color: white;
  width: 100%;
  cursor: pointer;
}

/* Ensure tap zones for carousel work */
.swipe-card .card-overlay {
  pointer-events: none; /* Let clicks pass through the dark gradient to the tap zones */
}

.swipe-card .action-buttons {
  pointer-events: auto; /* Re-enable clicks for the actual swipe buttons */
}

/* Ensure empty states center properly in the flex view */
.empty-state {
  margin: auto;
  padding-top: 20%; /* Pushes it down to visual center */
}

/* Safety Modal */
.safety-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.safety-modal {
  background: var(--bg-panel);
  padding: 20px;
  border-radius: 16px;
  width: 90%;
  max-width: 350px;
  text-align: center;
  border: 1px solid var(--border-color);
}
.safety-modal .btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
  margin-top: 10px;
  width: 100%;
}
.safety-modal .btn-outline {
  width: 100%;
}

/* --- CUSTOM MODALS --- */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.custom-modal {
  background: var(--bg-panel);
  padding: 24px;
  border-radius: 20px;
  width: 85%;
  max-width: 350px;
  text-align: center;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideUpModal 0.3s ease forwards;
}

.custom-modal h3 {
  margin: 0 0 10px;
  font-size: 20px;
}
.custom-modal p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.custom-modal .btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
}

@keyframes slideUpModal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- BOTTOM SHEET (FULL PROFILE) --- */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.bottom-sheet-overlay.active {
  opacity: 1;
}

.bottom-sheet {
  background: var(--bg-panel);
  margin-left: auto;
  margin-right: auto;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 40px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
  overflow-y: auto;
}
.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.drag-handle {
  width: 40px;
  height: 5px;
  background: var(--border-color);
  border-radius: 5px;
  margin: 0 auto 20px;
}

/* --- EMPTY STATE IMPROVEMENTS --- */
.radar-wrapper {
  width: 100px;
  height: 100px;
  aspect-ratio: 1/1;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(236, 72, 153, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: pulse 2s infinite;
}
.radar-wrapper i {
  font-size: 40px;
  color: var(--primary);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4);
  }
  70% {
    box-shadow: 0 0 0 30px rgba(236, 72, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(236, 72, 153, 0);
  }
}

/* --- COLLECTIONS GRID (PREMIUM) --- */
.collection-section {
  margin-bottom: 30px;
}
.collection-title {
  margin: 0 0 12px;
  font-size: 18px;
  display: flex;
  align-items: center;
  color: var(--text-main);
}
.collection-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.collection-row::-webkit-scrollbar {
  display: none; /* Hide scrollbar for clean look */
}
.collection-card {
  min-width: 140px;
  width: 140px;
  height: 190px;
  scroll-snap-align: start;
  background: var(--bg-panel);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}
.collection-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.collection-card .info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 25px 10px 10px;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.95));
}
.collection-card .info h4 {
  margin: 0;
  font-size: 14px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* Update info padding to make room for action buttons */
.collection-card .info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 25px 10px 48px; /* Extra bottom padding */
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.95));
}

/* Collections Mini Action Buttons */
.col-actions {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 10;
}
.col-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, background 0.2s;
  padding: 0;
}
.col-btn:active {
  transform: scale(0.85);
}
.col-btn.pass {
  color: var(--danger);
}
.col-btn.like {
  color: var(--primary);
}
.col-btn.super {
  color: #3b82f6;
}

/* --- IT'S A MATCH MODAL --- */
.match-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.match-modal {
  text-align: center;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  animation: scaleUpBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.match-modal h2 {
  font-size: 42px;
  margin: 0 0 10px;
  background: linear-gradient(to right, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
  letter-spacing: 1px;
}

.match-modal p {
  color: #cbd5e1;
  font-size: 16px;
  margin-bottom: 30px;
}

.match-avatars {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 35px;
}

.match-avatars img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  box-shadow: 0 0 25px rgba(236, 72, 153, 0.4);
}

.match-modal .btn-primary {
  background: linear-gradient(45deg, #ec4899, #8b5cf6);
  border: none;
  padding: 16px;
  border-radius: 30px;
  font-size: 16px;
  margin-bottom: 15px;
  width: 100%;
}

.match-modal .btn-outline {
  border: 2px solid var(--border-color);
  color: var(--text-main);
  padding: 16px;
  border-radius: 30px;
  width: 100%;
}

@keyframes scaleUpBounce {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.premium_benefits li {
  display: flex;
  justify-content: flex-start;
  gap: 15px;
  width: 100%;
}

/* Encouragement Banners */
.profile-banners:not(:empty) {
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* two columns */
  gap: 10px;
}

.encouragement-banner {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
}

.completion-banner .progress-container {
  width: 100%;
  height: 8px;
  background: var(--bg-dark);
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}

.completion-banner .progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--primary), #8b5cf6);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.encouragement-banner p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 5px 0 15px 0;
  line-height: 1.4;
}

.encouragement-banner strong {
  color: var(--text-main);
}

.verification-banner i {
  font-size: 32px;
  color: #3b82f6; /* Trust blue */
  margin-bottom: 10px;
  display: inline-block;
}

/* Modal Enhancements */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-panel);
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
}

.modal-content label {
  display: block;
  margin: 15px 0 5px;
  font-size: 14px;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
}

.text-danger {
  color: var(--danger);
}
/* --- FULLSCREEN IMAGE VIEWER (LIGHTBOX) --- */
.image-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  z-index: 100000; /* Extremely high to cover headers/navs */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeIn 0.2s forwards;
}

.image-viewer-content {
  max-width: 95%;
  max-height: 90%;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.image-viewer-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 2;
}

.image-viewer-close:active {
  background: rgba(255, 255, 255, 0.4);
}

@keyframes popIn {
  to {
    transform: scale(1);
  }
}
/* --- Input Wrappers & Icons --- */
.input-wrapper {
  position: relative;
  width: 100%;
  margin: 8px 0 16px;
}

.input-wrapper input,
.input-wrapper select {
  margin: 0; /* Margin handled by the wrapper */
  padding-left: 45px; /* Make room for the left icon */
}

.input-wrapper.has-right-icon input {
  padding-right: 45px; /* Make room for the right toggle icon */
}

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
  pointer-events: none; /* Allows clicking "through" the icon to focus the input */
  z-index: 2;
}

.input-wrapper .pwd-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
  z-index: 2;
}

.input-wrapper .pwd-toggle:hover {
  color: var(--primary);
}

.input-wrapper .pwd-toggle:active {
  transform: translateY(-50%) scale(0.9);
}