/* sxc.ai - Distinctive aesthetic
   Not pink gradients. Not purple cards. Not rounded everything.
   Dark, editorial, honest about what this is.
*/

:root {
  /* Dark base - not pure black */
  --bg-deep: #0a0a0b;
  --bg-surface: #111113;
  --bg-elevated: #18181b;
  --bg-hover: #222226;
  
  /* Text hierarchy */
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-muted: #52525b;
  
  /* Accent: warm amber, not cold blue */
  --accent: #f59e0b;
  --accent-dim: #b45309;
  --accent-glow: rgba(245, 158, 11, 0.15);
  
  /* Desire spectrum */
  --desire-high: #ef4444;
  --desire-mid: #f59e0b;
  --desire-low: #22c55e;
  --pass: #6366f1;
  
  /* Tiers */
  --tier-strong: #ef4444;
  --tier-good: #f59e0b;
  --tier-potential: #a855f7;
  
  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-visible: rgba(255, 255, 255, 0.12);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Typography */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono: 'DM Mono', 'SF Mono', monospace;
  
  /* Sizing */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 9999;
}

/* Views */
.view {
  display: none;
  min-height: 100vh;
}
.view.active {
  display: block;
}

/* Loading */
#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
}
.loading-content {
  text-align: center;
}
.logo-mark {
  font-size: 3rem;
  color: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
.loading-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-top: var(--space-md);
  letter-spacing: 0.2em;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Auth View */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.auth-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}
.logo {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-style: italic;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.logo-suffix {
  color: var(--accent);
}
.tagline {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: var(--space-sm);
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: var(--space-xl);
}
.auth-tabs {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-md);
}
.auth-tab {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  cursor: pointer;
  padding: var(--space-xs) 0;
  transition: color 0.2s;
}
.auth-tab:hover {
  color: var(--text-secondary);
}
.auth-tab.active {
  color: var(--accent);
}
.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}
.auth-error {
  color: var(--desire-high);
  font-size: 0.75rem;
  margin-top: var(--space-md);
  min-height: 1.5em;
}
.auth-footer {
  margin-top: var(--space-2xl);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
}

/* Form Elements */
.field {
  margin-bottom: var(--space-lg);
}
.field label {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  text-transform: lowercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border-visible);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: var(--space-sm) var(--space-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field textarea {
  resize: vertical;
  min-height: 100px;
}
.field-hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.625rem;
  margin-top: var(--space-xs);
}
.form-row {
  display: flex;
  gap: var(--space-md);
}
.form-row .field {
  flex: 1;
}
.field-small {
  flex: 0 0 80px !important;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: var(--accent);
  border: none;
  color: var(--bg-deep);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-md);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover {
  background: var(--accent-dim);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-secondary {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-visible);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: var(--space-md);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

/* Main Navigation */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 100;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--text-primary);
}
.nav-links {
  display: flex;
  gap: var(--space-xl);
}
.nav-link {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: var(--space-sm) 0;
  position: relative;
  transition: color 0.2s;
}
.nav-link:hover {
  color: var(--text-secondary);
}
.nav-link.active {
  color: var(--text-primary);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}
.nav-cycle {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.cycle-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.cycle-timer {
  font-size: 0.875rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Sections */
.section {
  display: none;
  padding-top: 56px;
  min-height: 100vh;
}
.section.active {
  display: block;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
}

/* Browse Section */
.browse-container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xl);
}
.profile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-xl);
}
.profile-photos {
  position: relative;
}
.photo-main {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
}
.photo-thumbnails {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-deep);
}
.photo-thumb {
  flex: 1;
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.photo-thumb:hover,
.photo-thumb.active {
  opacity: 1;
}
.profile-info {
  padding: var(--space-lg);
}
.profile-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.profile-name {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
}
.profile-age {
  font-size: 1.25rem;
  color: var(--text-secondary);
}
.profile-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.detail-tag {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: var(--space-xs) var(--space-sm);
}
.profile-bio {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Rating Interface */
.rating-interface {
  display: flex;
  gap: var(--space-md);
  align-items: stretch;
}
.rating-side {
  flex: 1;
  text-align: center;
}
.rating-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}
.rating-dislike .rating-label {
  color: var(--pass);
}
.rating-like .rating-label {
  color: var(--desire-high);
}
.rating-clicks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-xs);
}
.click-btn {
  aspect-ratio: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.click-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.click-btn.like:hover {
  border-color: var(--desire-high);
  color: var(--desire-high);
}
.click-btn.dislike:hover {
  border-color: var(--pass);
  color: var(--pass);
}
.click-btn.selected {
  transform: scale(1.1);
}
.click-btn.like.selected {
  background: var(--desire-high);
  border-color: var(--desire-high);
  color: white;
}
.click-btn.dislike.selected {
  background: var(--pass);
  border-color: var(--pass);
  color: white;
}
.rating-divider {
  width: 1px;
  background: var(--border-subtle);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
}
.empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.empty-state p {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Matches Section */
.matches-container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xl);
}
.matches-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.match-card {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: var(--space-lg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.match-card:hover {
  border-color: var(--border-visible);
  background: var(--bg-elevated);
}
.match-photo {
  width: 64px;
  height: 64px;
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.match-info {
  flex: 1;
  min-width: 0;
}
.match-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  margin-bottom: var(--space-xs);
}
.match-detail {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.match-tier {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: var(--space-xs) var(--space-sm);
}
.match-tier.strong {
  color: var(--tier-strong);
  border: 1px solid var(--tier-strong);
}
.match-tier.good {
  color: var(--tier-good);
  border: 1px solid var(--tier-good);
}
.match-tier.potential {
  color: var(--tier-potential);
  border: 1px solid var(--tier-potential);
}
.match-actions {
  display: flex;
  gap: var(--space-sm);
}
.match-action {
  background: none;
  border: 1px solid var(--border-visible);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: all 0.2s;
}
.match-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.match-action.accept:hover {
  border-color: var(--desire-low);
  color: var(--desire-low);
}
.match-action.reject:hover {
  border-color: var(--desire-high);
  color: var(--desire-high);
}
.match-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.match-status.accepted {
  color: var(--desire-low);
}
.match-status.waiting {
  color: var(--accent);
}

/* Conversation */
.conversation-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-deep);
  z-index: 200;
  padding-top: 0;
}
.conversation-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 600px;
  margin: 0 auto;
}
.conversation-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-sm);
}
.back-btn:hover {
  color: var(--text-primary);
}
.conversation-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
}
.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.message {
  max-width: 80%;
  padding: var(--space-md);
  font-size: 0.875rem;
  line-height: 1.5;
}
.message.sent {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg-deep);
}
.message.received {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}
.message-time {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}
.message.sent .message-time {
  color: rgba(0, 0, 0, 0.5);
}
.message-form {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.message-form input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border-visible);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: var(--space-md);
}
.message-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.send-btn {
  background: var(--accent);
  border: none;
  color: var(--bg-deep);
  font-size: 1.25rem;
  padding: 0 var(--space-lg);
  cursor: pointer;
}
.send-btn:hover {
  background: var(--accent-dim);
}

/* Profile Edit Section */
.profile-edit-container {
  max-width: 500px;
  margin: 0 auto;
  padding: var(--space-xl);
}
.profile-form {
  margin-bottom: var(--space-xl);
}
.form-section {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}
.form-section:last-of-type {
  border-bottom: none;
}
.form-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.05em;
}
.form-message {
  margin-top: var(--space-md);
  font-size: 0.75rem;
  min-height: 1.5em;
}
.form-message.success {
  color: var(--desire-low);
}
.form-message.error {
  color: var(--desire-high);
}
.logout-btn {
  margin-top: var(--space-2xl);
}

/* Photos Grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}
.photo-slot {
  aspect-ratio: 1;
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  position: relative;
}
.photo-slot.add-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-visible);
  cursor: pointer;
  transition: border-color 0.2s;
}
.photo-slot.add-photo:hover {
  border-color: var(--accent);
}
.photo-slot.add-photo span {
  font-size: 2rem;
  color: var(--text-muted);
}
.photo-slot .delete-photo {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-slot:hover .delete-photo {
  opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .main-nav {
    padding: 0 var(--space-md);
  }
  .nav-links {
    gap: var(--space-md);
  }
  .nav-link {
    font-size: 0.625rem;
  }
  .nav-cycle {
    display: none;
  }
  
  .browse-container,
  .matches-container,
  .profile-edit-container {
    padding: var(--space-md);
  }
  
  .rating-clicks {
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
  }
  .click-btn {
    font-size: 0.625rem;
  }
  
  .auth-card {
    padding: var(--space-lg);
  }
  
  .form-row {
    flex-direction: column;
  }
  .field-small {
    flex: 1 !important;
  }
  
  .match-card {
    flex-wrap: wrap;
  }
  .match-actions {
    width: 100%;
    margin-top: var(--space-sm);
  }
  .match-action {
    flex: 1;
    text-align: center;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-card {
  animation: slideUp 0.4s ease-out;
}
.match-card {
  animation: fadeIn 0.3s ease-out;
  animation-fill-mode: both;
}
.match-card:nth-child(1) { animation-delay: 0.05s; }
.match-card:nth-child(2) { animation-delay: 0.1s; }
.match-card:nth-child(3) { animation-delay: 0.15s; }
.match-card:nth-child(4) { animation-delay: 0.2s; }
.match-card:nth-child(5) { animation-delay: 0.25s; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}
