/* Secondary Pages Stylesheet — Reuse, Wishlist Edit, Wishlist View */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;500;600&display=swap');
@import url('base/tokens.css');
@import url('base/forms.css');
@import url('components/entries.css');

/* ── Base ───────────────────────────────────────────────────── */
html {
  font-family: 'Source Sans 3', 'Segoe UI', sans-serif;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: var(--text-primary);
  background: var(--burgundy-deep);
  background-image: radial-gradient(ellipse at 30% 0%, rgba(90, 35, 36, 0.25) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ── Container ──────────────────────────────────────────────── */
#container {
  max-width: 620px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  animation: pageReveal 0.6s ease-out;
}

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

/* ── Typography ─────────────────────────────────────────────── */
h1 {
  font-family: 'Source Sans 3', 'Georgia', serif;
  font-weight: 700;
  font-size: 2rem;
  text-align: center;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

h2 {
  font-family: 'Source Sans 3', 'Georgia', serif;
  font-weight: 600;
  font-size: 1.25rem;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}

.helper-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-weight: 300;
}

/* ── Glass Card Sections ────────────────────────────────────── */
section, #search-section {
  background: var(--frost);
  border: 1px solid var(--frost-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  animation: cardSlide 0.5s ease-out both;
}

section:nth-child(2) { animation-delay: 0.08s; }
section:nth-child(3) { animation-delay: 0.16s; }
section:nth-child(4) { animation-delay: 0.24s; }

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--frost-border), transparent);
  margin: 8px 0 20px;
}

/* ── Form Input Overrides (secondary pages) ───────────────── */
select,
input[type="email"],
input[type="url"],
input[type="text"],
input[type="tel"],
textarea {
  width: 100%;
  margin-bottom: 10px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: auto;
  max-height: none;
  margin: 0;
  background: #69292a;
  color: rgba(255, 255, 255, 0.9);
}

.button:hover {
  background: #7a3233;
}

.button:active {
  background: #5a2122;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button.primary {
  font-size: 1rem;
  padding: 12px 32px;
  width: 100%;
  margin-top: 8px;
}

.button.primary:hover {
  background: #7a3233;
}

/* ── Add-Form Row (URL + Title + Button) ────────────────────── */
#add-wishlist-form,
#add-item-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: start;
}

#add-item-form {
  grid-template-columns: 1fr auto auto;
}

#add-item-form .item-form-url {
  grid-column: 1 / -1;
}

#add-wishlist-form input,
#add-item-form input {
  margin-bottom: 0;
}

#add-wishlist-form label,
#add-item-form label {
  margin-bottom: 2px;
}

#add-wishlist-form .button,
#add-item-form .button {
  height: 40px;
  padding: 0 16px;
  white-space: nowrap;
  align-self: end;
}

/* ── Item Price ────────────────────────────────────────────── */
.item-price {
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
  margin-right: 12px;
}

#item-price {
  width: 100px;
}

/* ── Wishlist Entries ───────────────────────────────────────── */
.wishlist-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.wishlist-entry:hover {
  background: rgba(0, 0, 0, 0.3);
}

.wishlist-entry a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 12px;
  transition: color 0.15s;
}

.wishlist-entry a:hover {
  color: #fff;
}

/* ── Exchange Results (Reuse page) ──────────────────────────── */
#results-section {
  margin-top: 20px;
}

.exchange-result {
  background: var(--frost);
  border: 1px solid var(--frost-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: cardSlide 0.4s ease-out both;
}

.exchange-result:hover {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.exchange-result h3 {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  color: #fff;
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.exchange-result p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.exchange-result p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.exchange-result .button {
  margin-top: 12px;
}

/* ── Wishlist View Page ─────────────────────────────────────── */
#wishlist-content {
  animation: cardSlide 0.5s ease-out 0.1s both;
}

#wishlist-content h2 {
  margin-top: 24px;
}

#wishlist-content h2:first-child {
  margin-top: 0;
}

#wishlist-content ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

#wishlist-content li {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

#wishlist-content li:hover {
  background: rgba(0, 0, 0, 0.3);
}

#wishlist-content a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

#wishlist-content a:hover {
  color: #fff;
  text-decoration: underline;
}

#wishlist-content p {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 32px;
}

/* ── Snackbar Overrides ─────────────────────────────────────── */
#snackbar {
  min-width: 280px;
  max-width: 440px;
  text-align: center;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  position: fixed;
  z-index: 100;
  left: 50%;
  transform: translateX(-50%);
  top: 24px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.3s, top 0.3s;
}

#snackbar.hidden {
  visibility: hidden;
  opacity: 0;
  top: 0;
}

#snackbar.success {
  background: rgba(25, 140, 10, 0.9);
  border: 1px solid rgba(44, 184, 24, 0.4);
  color: #fff;
  visibility: visible;
  animation: snackIn 0.4s ease-out;
}

#snackbar.error {
  background: rgba(140, 30, 30, 0.9);
  border: 1px solid rgba(200, 60, 60, 0.4);
  color: #fff;
  visibility: visible;
  animation: snackIn 0.4s ease-out;
}

@keyframes snackIn {
  from { opacity: 0; top: 0; }
  to { opacity: 1; top: 24px; }
}

/* ── Search Section (Reuse page) ────────────────────────────── */
#search-section {
  text-align: center;
}

#search-section label {
  text-transform: none;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
  margin-bottom: 16px;
}

#search-section input {
  max-width: 360px;
  margin: 0 auto 12px;
  text-align: center;
}

/* ── Contact Section Spacing ────────────────────────────────── */
#contact-section label {
  margin-top: 12px;
}

#contact-section label:first-of-type {
  margin-top: 0;
}

/* ── Back Link ──────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 24px;
  transition: color 0.15s;
}

.back-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.back-link::before {
  content: '\2190';
  font-size: 1.1em;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media screen and (max-width: 480px) {
  #container {
    padding: 24px 16px 48px;
  }

  h1 {
    font-size: 1.6rem;
  }

  section, #search-section {
    padding: 18px 16px;
  }

  #add-wishlist-form,
  #add-item-form {
    grid-template-columns: 1fr;
  }

  #add-item-form .item-form-url {
    grid-column: 1;
  }

  #item-price {
    width: 100%;
  }

  #add-wishlist-form .button,
  #add-item-form .button {
    width: 100%;
    height: auto;
    padding: 10px;
  }
}
