/* ============================================
   VinylDB - Modern Discogs Clone UI
   Based on modern design patterns from Behance/Dribbble
   ============================================ */

/* ---------- CSS Variables & Design Tokens ---------- */
:root {
  /* Colors - Modern Palette */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.1);
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  
  --accent: #f59e0b;
  --accent-hover: #d97706;
  
  --bg: #fafafa;
  --bg-secondary: #f3f4f6;
  --surface: #ffffff;
  --surface-hover: #f9fafb;
  --surface-active: #f3f4f6;
  
  --ink: #111827;
  --ink-secondary: #374151;
  --ink-muted: #6b7280;
  --ink-light: #9ca3af;
  
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --border-focus: #3b82f6;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --success-hover: #059669;
  
  /* Shadows - Modern Depth System */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
  
  /* Spacing - Consistent Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Transitions */
  --transition-fast: 100ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Z-Index Scale */
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-modal: 200;
  --z-tooltip: 300;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.01em;
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: var(--space-8);
  }
}

/* ---------- Navigation ---------- */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: var(--space-3) var(--space-4);
  transition: all var(--transition);
}

@media (min-width: 640px) {
  .navbar {
    padding: var(--space-3) var(--space-6);
  }
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: 1280px;
  margin: 0 auto;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.375rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.navbar-brand:hover {
  color: var(--primary);
  text-decoration: none;
}

.navbar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-gradient);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  font-weight: 700;
}

.navbar-menu {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  z-index: calc(var(--z-sticky) - 1);
}

.navbar-menu.active {
  display: flex;
}

@media (min-width: 768px) {
  .navbar-menu {
    display: flex;
    flex-direction: row;
    position: static;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    gap: var(--space-1);
  }
}

.navbar-link {
  color: var(--ink-secondary);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  transition: all var(--transition);
  font-size: 0.9375rem;
}

.navbar-link:hover {
  background: var(--bg-secondary);
  color: var(--ink);
  text-decoration: none;
}

.navbar-spacer {
  flex: 1;
}

.navbar-search {
  display: none;
}

@media (min-width: 640px) {
  .navbar-search {
    display: flex;
    flex: 1;
    max-width: 400px;
    margin-left: auto;
  }
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  padding-left: var(--space-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  background: var(--bg-secondary);
  transition: all var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.navbar-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.navbar-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.navbar-toggle:hover {
  background: var(--bg-secondary);
}

.navbar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all var(--transition);
}

@media (min-width: 768px) {
  .navbar-toggle {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.5;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::before {
  opacity: 1;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm), 0 1px 2px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: white;
  box-shadow: var(--shadow-md), 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--ink-light);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-secondary);
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: var(--shadow-sm), 0 1px 2px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--danger-hover);
  color: white;
  box-shadow: var(--shadow-md), 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: 1rem;
  min-height: 48px;
  border-radius: var(--radius-md);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition);
  position: relative;
}

.card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

.release-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: pointer;
}

.release-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.release-card .cover {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  text-align: center;
  padding: var(--space-4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  position: relative;
}

.release-card .cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.2) 100%);
  pointer-events: none;
}

.release-card .title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink);
}

.release-card .title a {
  color: inherit;
  text-decoration: none;
}

.release-card .title a:hover {
  color: var(--primary);
}

.release-card .meta {
  font-size: 0.875rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--ink-secondary);
}

.badge-vinyl {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-cd {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
}

.badge-cassette {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink);
  transition: all var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--ink-light);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ---------- Tables ---------- */
.table-container {
  overflow-x: auto;
  margin: var(--space-4) 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  font-weight: 600;
  color: var(--ink-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-secondary);
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Section Titles ---------- */
.section-title {
  font-size: 1.375rem;
  font-weight: 600;
  margin: var(--space-10) 0 var(--space-5);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

@media (min-width: 640px) {
  .section-title {
    font-size: 1.5rem;
    margin: var(--space-12) 0 var(--space-6);
  }
}

/* ---------- Forum ---------- */
.thread {
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-4) 0;
  transition: background var(--transition);
}

.thread:hover {
  background: var(--surface-hover);
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-4);
  border-radius: var(--radius);
}

.thread:last-child {
  border-bottom: none;
}

.thread-title {
  font-weight: 600;
  font-size: 1.0625rem;
  margin-bottom: var(--space-1);
  color: var(--ink);
}

.thread-title a {
  color: inherit;
  text-decoration: none;
}

.thread-title a:hover {
  color: var(--primary);
}

.thread-meta {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.post {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: all var(--transition);
}

.post:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  font-size: 0.875rem;
}

.post-author {
  font-weight: 600;
  color: var(--ink);
}

.post-time {
  color: var(--ink-muted);
}

.post-body {
  line-height: 1.7;
  color: var(--ink-secondary);
}

/* ---------- Misc Classes ---------- */
.muted {
  color: var(--ink-muted);
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
  margin: var(--space-2) 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stars {
  color: var(--accent);
  letter-spacing: 1px;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-16);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

@media (min-width: 640px) {
  .footer {
    padding: var(--space-10);
  }
}

/* ---------- Page Specific ---------- */
.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (min-width: 640px) {
  .page-title {
    font-size: 2.5rem;
  }
}

.page-subtitle {
  color: var(--ink-muted);
  font-size: 1.125rem;
}

/* Release Detail */
.release-layout {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .release-layout {
    grid-template-columns: 320px 1fr;
    gap: var(--space-10);
  }
}

.release-cover {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  padding: var(--space-8);
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.release-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.2) 100%);
  pointer-events: none;
}

.release-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.release-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .release-meta {
    grid-template-columns: repeat(3, 1fr);
  }
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.meta-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.meta-value {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 500;
}

/* Tracklist */
.tracklist {
  margin: var(--space-6) 0;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.track {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  gap: var(--space-4);
  transition: background var(--transition);
}

.track:last-child {
  border-bottom: none;
}

.track:hover {
  background: var(--surface-hover);
}

.track-position {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  min-width: 40px;
}

.track-title {
  flex: 1;
  font-weight: 500;
  color: var(--ink);
}

.track-duration {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* Auth Forms */
.auth-card {
  max-width: 420px;
  margin: var(--space-10) auto;
}

.auth-card .card {
  padding: var(--space-8);
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-6);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Collection Grid */
.collection-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

@media (max-width: 640px) {
  .collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
  }
}

/* Profile Stats */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--ink-muted);
  font-weight: 500;
}

/* Review Form */
.review-form {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.review-rating {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Search Results */
.search-filters {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
  .search-filters {
    display: flex;
    gap: var(--space-4);
    align-items: flex-end;
  }
  
  .search-filters .form-group {
    margin-bottom: 0;
    flex: 1;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--space-2); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }
.mb-sm { margin-bottom: var(--space-2); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }
.hidden { display: none !important; }

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-5);
  }
}

/* Flex Utilities */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.col {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .row {
    flex-direction: column;
  }
  
  .col {
    min-width: 100%;
  }
}

/* Mobile-only */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
}

/* Desktop-only */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}
