/* Color variables live in theme.css, the one file to edit to change the
   site's palette — see that file's header comment. */
@import url("theme.css");

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent-dark); }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.85rem;
}

/*
 * Fixed image sizes: every listing image is displayed at the same standard
 * size (object-fit: cover crops/fills consistently regardless of the
 * source image's actual dimensions), sized for typical mobile-phone-width
 * browsers. `max-width: 100%` is just a safety net for windows narrower
 * than the standard size — it won't grow past it.
 */
.item-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.item-card {
  width: 240px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.item-card:hover {
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.18);
  border-color: var(--accent-dark);
}

.item-image-link { display: block; }

.item-image {
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--surface-raised);
}

.item-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.item-card-body { padding: 0.85rem 1rem; }
.item-card-body h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.item-card-body h2 a { color: var(--text); text-decoration: none; }
.item-card-body h2 a:hover { text-decoration: underline; }

.price { font-weight: 700; color: var(--accent-dark); }

/* Team filter tabs (public listing + admin dashboard) */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.filter-tab {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* Team badges. Only two teams exist (AV, BOV); add another rule here if
   that ever changes. */
.team-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.team-badge-AV {
  background: #3a2f14;
  color: var(--text-bright);
}

.team-badge-BOV {
  background: #23262b;
  color: #c9d2dc;
}

.item-type-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
}

.item-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 360px;
  margin: 1rem auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
}

.item-detail-image-link { display: block; }

.item-detail-image {
  width: 300px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.item-detail-body { width: 100%; }
.item-detail-body h1 { margin-top: 0; }
.description { white-space: pre-wrap; text-align: left; }

/*
 * CSS-only lightbox: clicking a thumbnail jumps to a same-page anchor
 * (#img-N), which the browser matches against :target below to reveal a
 * fixed, centered overlay showing the image full-size. No JavaScript
 * involved, so it also works with scripts disabled. Closing sets the
 * fragment to "#!", which matches no element, so :target stops applying.
 */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox:target { display: flex; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 480px);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 2rem;
  height: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
}

.lightbox-newtab { font-size: 0.85rem; }

.back-link { display: inline-block; margin-bottom: 0.5rem; }

.empty { color: var(--muted); }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.admin-table th, .admin-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.row-actions { display: flex; gap: 0.75rem; align-items: center; }

.button, button {
  font: inherit;
  cursor: pointer;
}

.button, .button-secondary {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid transparent;
}

.button {
  background: var(--accent);
  color: var(--on-accent);
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.form {
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.form input, .form textarea, .form select {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text);
}

.form input::placeholder, .form textarea::placeholder {
  color: var(--muted);
}

.form-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}

.form-actions { display: flex; gap: 0.75rem; align-items: center; }

.form-actions button[type="submit"] {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
}

.inline-form { display: inline; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-dark);
  text-decoration: underline;
  font-size: 0.95rem;
}

.link-button.danger { color: var(--danger); }

.error {
  background: #2a1512;
  color: var(--danger);
  border: 1px solid #5c2a22;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
}

/* Used both for the "N pending purchase requests" bar shown to elevated/
   owner admins on every admin page, and the one-time "request submitted"
   confirmation a visitor sees back on the item page. */
.banner-alert {
  display: block;
  background: var(--surface-raised);
  color: var(--text-bright);
  border: 1px solid var(--accent);
  padding: 0.6rem 1.5rem;
  margin: 0 0 1rem;
  text-align: center;
}

.banner-alert-link {
  text-decoration: none;
  font-weight: 600;
}

.banner-alert-link:hover { text-decoration: underline; }

/* Append-only note thread on a purchase request's detail page. */
.note-thread {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.note-meta {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.note-body {
  margin: 0;
  white-space: pre-wrap;
}
