/* ============================================
   JASON'S COLLECTION v2.0 — Firebase Edition
   Aesthetic: Collector's Cabinet / Warm Dark
   ============================================ */


:root {
  --bg:         #111009;
  --bg-surface: #1a1812;
  --bg-card:    #211f18;
  --border:     #332f24;
  --gold:       #c9a84c;
  --gold-light: #e8c87a;
  --gold-dim:   #7a6430;
  --text:       #e8e0d0;
  --text-muted: #8a7f6a;
  --text-dim:   #5a5245;
  --red:        #c04a3a;
  --blue:       #3a7abf;
  --radius:     8px;
  --radius-lg:  14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── LOGIN ───────────────────────────────── */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1e1a0e 0%, var(--bg) 70%);
}

#loginBox {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  position: relative;
}

#loginBox::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#loginBox h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem;
  color: var(--gold-light);
  margin-bottom: 6px;
}

#loginBox p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

#loginBox input {
  display: block;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}

#loginBox input:focus { border-color: var(--gold); }

#loginBtn {
  width: 100%;
  padding: 11px;
  background: var(--gold);
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}

#loginBtn:hover { background: var(--gold-light); transform: translateY(-1px); }

/* ── HEADER ──────────────────────────────── */
header {
  background: linear-gradient(180deg, #0d0b08 0%, var(--bg-surface) 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 40px 20px;
  text-align: center;
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

header h4 {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 6px;
}

#mainTitle {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  color: var(--gold-light);
  margin-bottom: 18px;
}

/* ── USER INFO ───────────────────────────── */
.user-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.user-info span { font-size: 0.78rem; color: var(--text-muted); }

.logout-button {
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-button:hover { background: var(--gold); color: var(--bg); }

/* ── CONTROLS ────────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

#searchBar, #categorySelector, #sortOptions {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  padding: 8px 13px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

#searchBar { min-width: 200px; }
#categorySelector, #sortOptions { min-width: 165px; }
#searchBar:focus, #categorySelector:focus, #sortOptions:focus { border-color: var(--gold); }
#searchBar::placeholder { color: var(--text-dim); }

#addButton, #searchVinylBtn {
  background: var(--gold);
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 8px 18px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(201,168,76,0.2);
}

#addButton:hover { background: var(--gold-light); transform: translateY(-1px); }

#searchVinylBtn {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  box-shadow: none;
}

#searchVinylBtn:hover { background: var(--gold); color: var(--bg); }

/* ── GRID ────────────────────────────────── */
main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  padding: 28px;
}

/* ── CARDS ───────────────────────────────── */
.box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.box:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  border-color: var(--gold-dim);
}

.box img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: #18160f;
  border-bottom: 1px solid var(--border);
  padding: 8px;
}

.box h2 {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 10px 12px 3px;
  line-height: 1.3;
}

.box .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 12px 10px;
}

.button-container {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0 10px 12px;
  flex-wrap: wrap;
}

.edit-btn, .delete-btn, .track-btn, .select-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.edit-btn   { background: rgba(58,122,191,0.14); color: #6aaee8; border: 1px solid rgba(58,122,191,0.3); }
.edit-btn:hover { background: var(--blue); color: #fff; }

.delete-btn { background: rgba(192,74,58,0.12);  color: #e07a6d; border: 1px solid rgba(192,74,58,0.3); }
.delete-btn:hover { background: var(--red); color: #fff; }

.track-btn, .select-btn { background: rgba(201,168,76,0.12); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.track-btn:hover, .select-btn:hover { background: var(--gold); color: var(--bg); }

/* ── EMPTY STATE ─────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  padding: 60px 0;
  font-size: 0.9rem;
}

/* ── LOADING ─────────────────────────────── */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 0.9rem;
}

/* ── MODALS ──────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  padding-top: 60px;
  overflow-y: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0 auto 40px;
  padding: 28px 30px;
  width: 90%;
  max-width: 480px;
  position: relative;
}

.modal-wide { max-width: 760px; }

.modal-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  color: var(--gold-light);
  margin-bottom: 6px;
}

.hint { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 16px; }

.close {
  position: absolute;
  top: 14px; right: 18px;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}
.close:hover { color: var(--text); }

/* ── FORM FIELDS ─────────────────────────── */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field input,
.field select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  padding: 9px 12px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus, .field select:focus { border-color: var(--gold); }

.field .image-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.field .image-preview img {
  width: 52px; height: 52px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

#addSubmitBtn, #editSubmitBtn {
  margin-top: 18px;
  width: 100%;
  padding: 11px;
  background: var(--gold);
  color: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#addSubmitBtn:hover, #editSubmitBtn:hover { background: var(--gold-light); transform: translateY(-1px); }
#addSubmitBtn:disabled, #editSubmitBtn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── TRACKLIST ───────────────────────────── */
#tracklistContainer { list-style: none; padding: 0; margin-top: 12px; }
#tracklistContainer li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
#tracklistContainer li:last-child { border-bottom: none; }

/* ── DISCOGS RESULTS ─────────────────────── */
#discogsResults {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

/* ── ERROR / SUCCESS MESSAGES ────────────── */
.error-msg { color: #e07a6d; font-size: 0.8rem; margin-top: 8px; min-height: 18px; }

/* ── UPLOAD PROGRESS ─────────────────────── */
.upload-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
  display: none;
}
.upload-bar {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 0.2s;
}

/* ── FOOTER ──────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 32px;
  margin-top: 10px;
}
footer p {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 2;
}

/* ── SCROLLBAR ───────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 600px) {
  header { padding: 18px 16px 16px; }
  main { padding: 16px 12px; gap: 12px; }
  .controls { gap: 8px; }
  #searchBar, #categorySelector, #sortOptions { min-width: 140px; width: 90%; }
  .modal-content { padding: 22px 18px; }
}
