/* ===============================
   CSS VARIABLES & RESET
   =============================== */
:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --border: #e0ddd6;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --accent: #c8a84b;
  --accent-dark: #a8883b;
  --btn-cart: #333;
  --btn-email: #e6b800;
  --btn-email-text: #5a4500;
  --btn-fb: #1877f2;
  --btn-pdf: #28a745;
  --badge-new-bg: #E6F1FB;
  --badge-new-text: #185FA5;
  --badge-rare-bg: #FAEEDA;
  --badge-rare-text: #854F0B;
  --badge-avail-bg: #EAF3DE;
  --badge-avail-text: #3B6D11;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
}

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

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ===============================
   SCREEN SYSTEM
   =============================== */
.screen {
  display: none;
  min-height: 100vh;
  padding-bottom: 60px;
}

.screen.active {
  display: block;
}

/* ===============================
   SPLASH SCREEN
   =============================== */
#screen-splash {
  background-image: url('https://raw.githubusercontent.com/davegulliksen/cd-catalog/main/cd-catalog%20header.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

#screen-splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  z-index: 0;
}

.splash-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 60px 24px 60px;
  text-align: center;
}

.splash-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: normal;
  color: #ffffff;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.splash-sub {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.8);
  margin-bottom: 32px;
  font-style: italic;
}

.shipping-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  margin-bottom: 28px;
  text-align: left;
}

.shipping-box strong {
  color: #ffffff;
}

.splash-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
}

.splash-btn {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-family: Georgia, serif;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  transition: background 0.2s, transform 0.1s;
  text-align: left;
}

.splash-btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.splash-btn:active {
  transform: scale(0.98);
}

.splash-btn--outline {
  background: rgba(0,0,0,0.4);
  color: #ffffff;
  border-color: rgba(255,255,255,0.5);
}

.splash-btn--outline:hover {
  background: rgba(0,0,0,0.6);
}

.splash-btn-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.7);
  display: block;
  margin-top: 2px;
  font-style: italic;
}

/* ===============================
   SCREEN HEADER
   =============================== */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.home-btn {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-primary);
  white-space: nowrap;
}

.home-btn:hover {
  background: var(--bg);
}

.screen-title {
  font-size: 1.1rem;
  font-weight: normal;
  flex: 1;
}

.filter-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.filter-wrap label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-wrap select {
  font-size: 0.85rem;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
}

@media (max-width: 480px) {
  .screen-header {
    flex-wrap: wrap;
  }

  .filter-wrap {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ===============================
   CD GRID
   =============================== */
.cd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
}

.cd-thumb {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}

.cd-thumb:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.13);
  transform: translateY(-2px);
}

.cd-thumb:active {
  transform: scale(0.97);
}

.cd-thumb-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.cd-thumb-info {
  padding: 5px 7px 8px;
}

.cd-thumb-cat {
  font-size: 10px;
  color: #000000 !important;
  margin-bottom: 2px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.cd-thumb-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.cd-thumb-price {
  font-size: 13px;
  font-weight: bold;
  color: var(--text-primary);
}

.cd-thumb-badges {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

/* ===============================
   BADGES
   =============================== */
.badge {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: bold;
  font-family: Arial, sans-serif;
  letter-spacing: 0.02em;
}

.badge-new {
  background: var(--badge-new-bg);
  color: var(--badge-new-text);
}

.badge-rare {
  background: var(--badge-rare-bg);
  color: var(--badge-rare-text);
}

.badge-available {
  background: var(--badge-avail-bg);
  color: var(--badge-avail-text);
  font-size: 0.8rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: bold;
  font-family: Arial, sans-serif;
}

/* ===============================
   CD DETAIL MODAL
   =============================== */
.cd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}

.cd-modal-backdrop.hidden {
  display: none;
}

.cd-modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.cd-modal-close-row {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px 4px;
  flex-shrink: 0;
}

.cd-modal-close {
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  background: none;
  cursor: pointer;
  font-family: Georgia, serif;
}

.cd-modal-close:hover {
  background: var(--bg);
}

.cd-modal-top {
  display: flex;
  gap: 12px;
  padding: 0 14px 12px;
  flex-shrink: 0;
}

.cd-modal-cover {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
}

.cd-modal-meta {
  flex: 1;
  min-width: 0;
}

.cd-modal-meta h3 {
  font-size: 0.95rem;
  font-weight: normal;
  margin-bottom: 4px;
  line-height: 1.3;
  color: var(--text-primary);
}

.cd-modal-meta p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-family: Arial, sans-serif;
}

.modal-price {
  font-size: 1.1rem !important;
  font-weight: bold !important;
  color: var(--text-primary) !important;
  margin-top: 6px !important;
}

.modal-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.cd-modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
  font-family: Arial, sans-serif;
}

.cd-modal-desc {
  padding-top: 10px;
}

.cd-modal-cond {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.cd-modal-desc strong,
.cd-modal-cond strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 3px;
}

.cd-modal-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  flex-shrink: 0;
}

.btn-cart-modal {
  grid-column: span 2;
  padding: 9px;
  border-radius: var(--radius);
  font-family: Georgia, serif;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: var(--btn-cart);
  color: #fff;
  transition: background 0.2s;
}

.btn-cart-modal:hover { background: #111; }
.btn-cart-modal.in-cart { background: #888; cursor: not-allowed; }

.cd-modal-btns a {
  text-align: center;
  padding: 9px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  text-decoration: none;
  font-family: Arial, sans-serif;
  font-weight: bold;
  transition: opacity 0.2s;
}

.cd-modal-btns a:hover { opacity: 0.85; }

.btn-email {
  background: var(--btn-email);
  color: var(--btn-email-text);
}

.btn-fb {
  background: var(--btn-fb);
  color: #fff;
}

.btn-pdf {
  background: var(--btn-pdf);
  color: #fff;
  grid-column: span 2;
}

/* ===============================
   FAQ SCREEN
   =============================== */
.faq-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.faq-question {
  font-size: 1rem;
  font-weight: bold;
  margin-top: 22px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.faq-answer {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-left: 12px;
  border-left: 3px solid var(--border);
}

.faq-nav-bottom {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* ===============================
   COMING CDs SCREEN
   =============================== */
.coming-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.coming-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

#coming-list {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-primary);
  font-family: Arial, sans-serif;
}

.coming-line {
  padding: 3px 0;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.coming-line:last-child {
  border-bottom: none;
}

.coming-line-text {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

/* ===============================
   ADD CONFIRMATION ANIMATION
   =============================== */
.add-confirmation {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #28a745;
  color: white;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  font-family: Arial, sans-serif;
}

.add-confirmation.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===============================
   FLOATING CART BUTTON
   =============================== */
#cart-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: Arial, sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 9999;
  transition: background 0.2s;
}

#cart-button:hover { background: #111; }

/* ===============================
   CART MODAL
   =============================== */
#cart-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

#cart-modal.hidden { display: none; }

#cart-content {
  background: var(--surface);
  width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cart-header h2 {
  font-size: 1.1rem;
  font-weight: normal;
}

.close-btn {
  background: #c62828;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.close-btn:hover { background: #a61f1f; }

.return-btn.top-return {
  width: 100%;
  background: #444;
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: Georgia, serif;
}

.return-btn.top-return:hover { background: #222; }

.checkout-hint {
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  color: #444;
  margin-top: 4px;
  margin-bottom: 12px;
}

.cart-items { margin-bottom: 15px; }

.cart-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.cart-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  margin-right: 10px;
  object-fit: cover;
}

.cart-info { flex: 1; }
.cart-cat { font-size: 0.8rem; color: #666; }
.cart-price { font-size: 0.9rem; font-weight: bold; }

.remove-item {
  background: #c62828;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.remove-item:hover { background: #a61f1f; }

.cart-totals { margin-top: 10px; font-size: 0.95rem; }

.total-line {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: bold;
}

.free-shipping-box {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f5f9ff;
  border-left: 4px solid #4a90e2;
  border-radius: 4px;
  font-size: 0.92em;
  color: #333;
  line-height: 1.4;
}

#paypal-button-container { margin-top: 15px; }

/* ===============================
   FOOTER
   =============================== */
footer {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ===============================
   RESPONSIVE
   =============================== */
@media (max-width: 480px) {
  .cd-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .cd-modal-box {
    max-height: 95vh;
  }

  .cd-modal-cover {
    width: 90px;
    height: 90px;
  }

  .screen-header {
    gap: 8px;
  }

  .screen-title {
    font-size: 0.95rem;
  }

  #cart-content {
    width: calc(100vw - 32px);
  }
}
