/* DJ Next — Clean, minimal, Squarespace-aesthetic PWA */

:root {
  --bg: #ffffff;
  --text: #111111;
  --text-muted: #888888;
  --text-light: #aaaaaa;
  --accent: #0066FF;
  --accent-light: #e8f0ff;
  --border: #e8e8e8;
  --card-bg: #f8f8f8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===================== LAYOUT ===================== */

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================== HEADER ===================== */

.app-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.app-logo span {
  color: var(--accent);
}

.header-stats {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

/* ===================== EVENT MODE BAR ===================== */

.event-mode-bar {
  display: flex;
  gap: 8px;
  padding: 14px 20px 0;
}

.event-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-btn:active {
  transform: scale(0.96);
}

.event-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.event-btn.active[data-mode="friday"] {
  background: #7c3aed;
  border-color: #7c3aed;
}

.event-btn.active[data-mode="saturday"] {
  background: #059669;
  border-color: #059669;
}

.rec-badge.event-badge {
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
}

/* ===================== MAIN SCREEN ===================== */

#main-screen {
  padding: 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Now Playing section */
.now-playing-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.now-playing-card {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow);
}

.now-playing-card:active {
  transform: scale(0.98);
}

.now-playing-card.empty {
  background: var(--card-bg);
  color: var(--text-muted);
  border: 2px dashed var(--border);
  box-shadow: none;
}

.now-playing-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}

.now-playing-artist {
  font-size: 14px;
  opacity: 0.7;
  margin-bottom: 12px;
}

.now-playing-card.empty .now-playing-name {
  font-size: 16px;
  font-weight: 500;
}

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}

.badge.bpm { }
.badge.key { }

/* Crowd rating buttons */
.crowd-ratings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 2px;
}

.crowd-ratings.hidden {
  display: none;
}

.crowd-sep {
  color: var(--text-light);
  font-size: 11px;
  user-select: none;
}

.crowd-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.crowd-btn:active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.crowd-btn-flash {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

/* Search trigger */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  color: var(--text-muted);
  font-size: 15px;
}

.search-trigger:active {
  background: var(--accent-light);
  border-color: var(--accent);
}

.search-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Up Next section */
.up-next-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.up-next-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.up-next-mode {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
  padding: 3px 8px;
  border-radius: 20px;
}

.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Recommendation card */
.rec-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.rec-card:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

.rec-card.removing {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
}

/* Vote buttons on recommendation cards */
.rec-vote-btns {
  position: absolute;
  top: 6px;
  right: 8px;
  display: flex;
  gap: 3px;
  z-index: 1;
}

.rec-vote-btn {
  background: none;
  border: none;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.45;
  border-radius: 4px;
  transition: opacity 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.rec-vote-up {
  color: #3a8c4a;
}

.rec-vote-down {
  color: #b83030;
}

.rec-vote-btn:hover,
.rec-vote-btn:active {
  opacity: 1;
}

.rec-vote-up.rec-vote-flash {
  background: rgba(58, 140, 74, 0.15);
  opacity: 1;
}

.rec-vote-down.rec-vote-flash {
  background: rgba(184, 48, 48, 0.15);
  opacity: 1;
}

.rec-remove-btn {
  background: none;
  border: none;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.3;
  border-radius: 4px;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  margin-left: 2px;
}

.rec-remove-btn:hover,
.rec-remove-btn:active {
  opacity: 1;
}

.rec-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  width: 18px;
  flex-shrink: 0;
  text-align: center;
}

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

.rec-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-artist {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.rec-badge {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.rec-badge.key-badge {
  color: var(--accent);
  border-color: var(--accent-light);
  background: var(--accent-light);
}

.rec-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  margin-top: 3px;
}

/* Button row: More Mixes + Lane Change side-by-side */
.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* More Mixes button */
.more-mixes-btn {
  flex: 1;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.more-mixes-btn:active,
.more-mixes-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Lane Change button */
.lane-change-btn {
  flex: 1;
  background: none;
  border: 1.5px solid #e07000;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #e07000;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.lane-change-btn:active,
.lane-change-btn:hover {
  background: rgba(224, 112, 0, 0.08);
  border-color: #c05a00;
  color: #c05a00;
}

/* Lane Change back link */
.lane-change-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0 10px;
  text-align: left;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.lane-change-back:hover,
.lane-change-back:active {
  color: var(--accent);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 14px;
  line-height: 1.6;
}

/* Loading state */
.loading-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ===================== SEARCH OVERLAY ===================== */

/* ── Inline search ── */
.search-wrap {
  margin: 0 0 8px 0;
}

.search-inline {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card-bg);
  overflow: hidden;
}

.search-inline .search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
}

.search-inline .search-icon {
  color: var(--text-light);
  font-size: 15px;
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 16px; /* prevent iOS zoom */
  font-family: inherit;
  color: var(--text);
  outline: none;
}

#search-input::placeholder {
  color: var(--text-light);
}

.search-cancel-inline {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-results-inline {
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--border);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s ease;
}

.search-result-item:active {
  background: var(--accent-light);
}

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

.result-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-artist {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-badges {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.result-badge {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.search-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.search-prompt {
  padding: 24px 20px;
  color: var(--text-light);
  font-size: 13px;
}

/* ===================== BOTTOM SAFE AREA ===================== */

.bottom-safe {
  height: env(safe-area-inset-bottom, 16px);
}

/* ===================== ANIMATIONS ===================== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rec-card {
  animation: fadeIn 0.25s ease both;
}

.rec-card:nth-child(2) { animation-delay: 0.05s; }
.rec-card:nth-child(3) { animation-delay: 0.10s; }
.rec-card:nth-child(4) { animation-delay: 0.15s; }
.rec-card:nth-child(5) { animation-delay: 0.20s; }

/* ===================== MANUAL TRANSITION MODAL ===================== */

.manual-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  padding-bottom: env(safe-area-inset-bottom);
}

.manual-overlay.hidden {
  display: none;
}

.manual-modal {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.manual-modal-header {
  margin-bottom: 16px;
}

.manual-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.manual-modal-from {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manual-modal-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.manual-modal-search .search-icon {
  font-size: 15px;
  flex-shrink: 0;
}

#manual-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.manual-search-results {
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
}

.manual-result-item {
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.manual-result-item:last-child {
  border-bottom: none;
}

.manual-result-item:active {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

.manual-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.manual-result-artist {
  font-size: 12px;
  color: var(--text-muted);
}

.manual-section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  padding: 10px 4px 6px;
}

.manual-hint {
  padding: 8px 4px;
  color: var(--text-light);
  font-size: 13px;
}

.manual-loading {
  opacity: 0.6;
}

.manual-result-spotify {
  border-left: 2px solid #1DB954;
  padding-left: 10px;
}

.manual-result-year {
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-light);
}

.manual-cancel-btn {
  width: 100%;
  padding: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* Add Mix button row */
.add-mix-row {
  margin-top: 10px;
}

.add-mix-btn {
  width: 100%;
  padding: 9px 16px;
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  background: transparent;
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}

.add-mix-btn:active {
  background: var(--accent);
  color: #fff;
  transform: scale(0.97);
}

/* ===================== RESPONSIVE ===================== */

@media (min-width: 481px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
