/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
  /* Core Dark Palette */
  --bg-primary: #0a0e13;
  --bg-secondary: #151b23;
  --bg-tertiary: #1f2937;
  --bg-elevated: #252d3a;
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-subtle: #475569;
  
  /* Green System (Primary) */
  --green-50: #dcfce7;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  
  /* Orange System (Complementary) */
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  
  /* Neutrals */
  --border-subtle: #334155;
  --border-light: #475569;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  
  /* Typography */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
}

.app-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
header {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  background: rgba(10, 14, 19, 0.8);
  backdrop-filter: blur(12px);
  position: relative;
}

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

.logo {
  width: 32px;
  height: 32px;
}

h1 {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Navigation */
.tabs {
  display: flex;
  justify-content: center;
  background: rgba(21, 27, 35, 0.6);
  backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: 16px;
  border: none;
  gap: 4px;
}

.tab-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.tab-button.active {
  background: var(--green-600);
  color: white;
  font-weight: 600;
  box-shadow: none;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: none;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: var(--orange-600);
  color: white;
}

/* Tab Content */
.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.tab-content h2 {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 32px 0;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.tab-content h3 {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  margin: 40px 0 20px 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Login Landing */
.login-container {
  text-align: center;
  max-width: 480px;
  margin: 40px auto 0;
  padding: 0 8px;
}

.login-container h2 {
  font-family: 'Fraunces', serif;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.login-container > p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
}

.features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

.feature {
  background: var(--bg-secondary);
  padding: 24px 16px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-light);
}

.feature h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.feature p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.login-btn {
  display: inline-block;
  background: var(--green-600);
  color: white;
  font-size: 16px;
  font-weight: 600;
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.login-btn:hover {
  background: var(--green-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.login-note {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Access Request */
.access-request {
  background: rgba(21, 27, 35, 0.4);
  backdrop-filter: blur(8px);
  padding: 20px;
  border-radius: 20px;
  border: none;
  margin-bottom: 24px;
  text-align: center;
}

.access-request h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: var(--text-primary);
}

.access-request p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
}

.access-form {
  display: flex;
  gap: 10px;
  max-width: 300px;
  margin: 0 auto 10px auto;
}

#emailInput {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

#emailInput:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.request-btn {
  background: var(--green-600);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.request-btn:hover {
  background: var(--green-700);
}

.access-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* Search Controls */
.search-box, .party-search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

#searchInput, #partySearchInput {
  flex: 1;
  padding: 12px 16px;
  background: rgba(21, 27, 35, 0.6);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s ease;
}

#searchInput:focus, #partySearchInput:focus {
  outline: none;
  background: rgba(21, 27, 35, 0.8);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

#searchButton, #partySearchButton {
  background: var(--green-600);
  color: white;
  border: none;
  padding: 12px 18px;
  border-radius: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

#searchButton:hover, #partySearchButton:hover {
  background: var(--green-700);
}

#clearSearch, #partyClearSearch {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border: none;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

#clearSearch:hover, #partyClearSearch:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

/* Controls & Dropdowns */
.sort-controls, .stats-controls {
  background: rgba(21, 27, 35, 0.4);
  backdrop-filter: blur(8px);
  padding: 16px;
  border-radius: 20px;
  border: none;
  margin-bottom: 24px;
}

.filter-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.filter-label, .sort-label {
  color: var(--green-400);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.filter-dropdown, .sort-dropdown {
  min-width: 160px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: none;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cbd5e1'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  transition: all 0.2s ease;
}

.filter-dropdown:hover, .sort-dropdown:hover {
  background: rgba(255, 255, 255, 0.12);
}

.filter-dropdown:focus, .sort-dropdown:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* Stats Toggle Buttons */
.view-toggle {
  display: flex;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px;
  border-radius: 14px;
  border: none;
  gap: 4px;
}

.stat-btn {
  padding: 8px 14px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  flex: 1;
}

.stat-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.stat-btn.active {
  background: var(--green-600);
  color: white;
  font-weight: 600;
  box-shadow: none;
}

/* Card Grids - Instagram-sized, 2-column layout */
.album-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 0;
  max-width: 600px;
  margin: 0 auto;
}

.song-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0;
}

/* Album Cards - Instagram-style with hero images */
.album-card {
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.album-card:hover {
  transform: translateY(-2px);
}

.album-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.album-card:hover img {
  box-shadow: var(--shadow-xl);
}

.album-info {
  padding: 0 4px;
}

.album-info h3 {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-info p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-score {
  color: var(--green-400);
  font-weight: 600;
}

/* Song Cards */
.song-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}

.song-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  transform: translateX(2px);
}

.song-card img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

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

.song-info h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-info p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Buttons */
.add-song-btn, .save-score, .delete-score {
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.add-song-btn, .save-score {
  background: var(--green-600);
  color: white;
}

.add-song-btn:hover, .save-score:hover {
  background: var(--green-700);
}

.delete-score {
  background: var(--orange-600);
  color: white;
}

.delete-score:hover {
  background: var(--orange-700);
}

.add-song-btn:disabled {
  background: var(--text-subtle);
  cursor: not-allowed;
}

/* Score Controls */
.score-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.score-select {
  padding: 8px 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cbd5e1'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  transition: all 0.2s ease;
}

.score-select:hover {
  border-color: var(--green-500);
  background-color: var(--bg-tertiary);
}

.score-select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

/* Feedback Widget */
.feedback-widget {
  margin-top: 40px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.feedback-toggle {
  cursor: pointer;
}

.feedback-toggle summary {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-toggle summary::-webkit-details-marker {
  display: none;
}

.feedback-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-form textarea {
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

.feedback-form textarea:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.feedback-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feedback-btn {
  background: var(--green-600);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.feedback-btn:hover {
  background: var(--green-700);
}

.feedback-context {
  font-size: 12px;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  max-width: calc(100vw - 40px);
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Responsive Design */
@media (max-width: 640px) {
  .app-container {
    padding: 0 12px;
  }
  
  .album-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: none;
  }
  
  header {
    padding: 16px 0;
    margin-bottom: 24px;
  }
  
  .tabs {
    flex-direction: column;
    gap: 4px;
  }
  
  .tab-button {
    flex: none;
  }
  
  .logout-btn {
    margin-left: 0;
    margin-top: 4px;
  }
  
  .search-box, .party-search-box {
    flex-direction: column;
  }
  
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .view-toggle {
    flex-direction: column;
    gap: 4px;
  }
  
  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .access-form {
    flex-direction: column;
    max-width: none;
  }
  
  .login-container {
    margin: 20px auto 0;
  }
  
  .login-container h2 {
    font-size: 32px;
  }
}

@media (min-width: 768px) {
  .app-container {
    padding: 0 24px;
  }
  
  .tabs {
    flex-direction: row;
  }
  
  .logout-btn {
    margin-left: 8px;
  }
  
  .filter-row {
    flex-direction: row;
  }
  
  .view-toggle {
    flex-direction: row;
  }
}

@media (min-width: 1024px) {
  .app-container {
    max-width: 1200px;
    padding: 0 32px;
  }
  
  .album-grid {
    max-width: 700px;
    gap: 32px;
  }
}