/* ==========================================================================
   CampusSwap — custom skin on top of Bootstrap 5
   Only what Bootstrap does not give us: brand colours, hero, listing cards,
   the details layout and a few small components.
   ========================================================================== */

:root {
  --cs-primary: #4f46e5;
  --cs-primary-dark: #4338ca;
  --cs-primary-soft: #eef0ff;
  --cs-ink: #0f172a;
  --cs-muted: #64748b;
  --cs-line: #e6e9f2;
  --cs-bg: #f7f8fc;
  --cs-radius: 16px;
  --cs-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06);
}

body.cs-body {
  background: var(--cs-bg);
  color: var(--cs-ink);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.container-xxl { flex: 1 0 auto; }

a { text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------- buttons ------------------------------------------------------- */
.btn-primary {
  --bs-btn-bg: var(--cs-primary);
  --bs-btn-border-color: var(--cs-primary);
  --bs-btn-hover-bg: var(--cs-primary-dark);
  --bs-btn-hover-border-color: var(--cs-primary-dark);
  --bs-btn-active-bg: var(--cs-primary-dark);
  --bs-btn-active-border-color: var(--cs-primary-dark);
  --bs-btn-focus-shadow-rgb: 79, 70, 229;
  font-weight: 600;
}

.btn { font-weight: 500; }
.btn-lg { font-weight: 600; }

/* ---------- navbar -------------------------------------------------------- */
.cs-navbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--cs-line);
  padding-top: .65rem;
  padding-bottom: .65rem;
}

.cs-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--cs-ink);
}

.cs-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 6px 14px rgba(99, 102, 241, .35);
}

.cs-brand-accent { color: var(--cs-primary); }

.cs-navsearch .input-group-text {
  background: #fff;
  border-right: 0;
  color: var(--cs-muted);
}
.cs-navsearch .form-control {
  border-left: 0;
  background: #fff;
}
.cs-navsearch .form-control:focus { box-shadow: none; border-color: var(--bs-border-color); }
.cs-navsearch .input-group:focus-within {
  border-radius: .5rem;
  box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15);
}

.cs-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
}
.cs-avatar-sm { width: 22px; height: 22px; flex-basis: 22px; font-size: .65rem; }
.cs-avatar-lg { width: 48px; height: 48px; flex-basis: 48px; font-size: 1.1rem; }

/* ---------- hero ---------------------------------------------------------- */
.cs-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 3rem 2.5rem;
  margin-bottom: 2rem;
  color: #fff;
  background: linear-gradient(125deg, #4f46e5 0%, #6d28d9 52%, #2563eb 100%);
  box-shadow: 0 24px 60px rgba(79, 70, 229, .28);
}

.cs-hero::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -140px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 65%);
  pointer-events: none;
}

.cs-hero-sub { color: rgba(255, 255, 255, .82); max-width: 34rem; }

.cs-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.cs-hero-card {
  background: #fff;
  color: var(--cs-ink);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
}

.cs-hero-card .form-control,
.cs-hero-card .form-select { background-color: #f8fafc; }

/* ---------- filter card --------------------------------------------------- */
.cs-filter-card { border-radius: var(--cs-radius); }

.cs-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cs-muted);
}

.form-label { font-weight: 600; font-size: .875rem; }

/* ---------- listing cards ------------------------------------------------- */
.cs-listing {
  border-radius: var(--cs-radius);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.cs-listing:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .12) !important;
}

.cs-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, #e0e7ff, #f1f5ff);
}
.cs-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}
.cs-listing:hover .cs-thumb img { transform: scale(1.06); }

.thumb-placeholder {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b9ec4;
}

.cs-thumb-tag,
.cs-thumb-status {
  position: absolute;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}
.cs-thumb-tag {
  top: .6rem;
  left: .6rem;
  background: rgba(15, 23, 42, .62);
  color: #fff;
}
.cs-thumb-status { top: .6rem; right: .6rem; background: #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, .12); }
.cs-thumb-status.status-available { color: #15803d; }
.cs-thumb-status.status-reserved { color: #b45309; }
.cs-thumb-status.status-sold { color: #475569; }


.cs-listing-title {
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 .25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.cs-listing-title a { color: var(--cs-ink); }
.cs-listing-title a:hover { color: var(--cs-primary); }

.cs-price {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--cs-primary);
}
.cs-price-lg { font-size: 2rem; }

.cs-desc {
  font-size: .84rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cs-desc-lg { font-size: .95rem; line-height: 1.6; white-space: pre-wrap; }

.cs-listing-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--cs-line);
  font-size: .78rem;
}
.cs-seller {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  color: var(--cs-muted);
}

/* ---------- badges / status ---------------------------------------------- */
.badge { font-weight: 600; padding: .38em .7em; }

.cs-badge-condition {
  background: var(--cs-primary-soft);
  color: #4338ca;
}

.status-available { background: #dcfce7; color: #15803d; }
.status-reserved  { background: #fef3c7; color: #b45309; }
.status-sold      { background: #e2e8f0; color: #475569; }

/* ---------- details page -------------------------------------------------- */
.cs-media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #e0e7ff, #f1f5ff);
}
.cs-media img { width: 100%; height: 100%; object-fit: cover; }

.breadcrumb { --bs-breadcrumb-divider-color: #94a3b8; }
.breadcrumb a { color: var(--cs-muted); }
.breadcrumb a:hover { color: var(--cs-primary); }

.cs-alert-soft {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  font-size: .9rem;
}

/* ---------- forms & auth -------------------------------------------------- */
.cs-form-card,
.cs-auth-card { border-radius: 20px; }

.cs-auth-card { margin-top: 1rem; }

.cs-auth-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 12px 24px rgba(99, 102, 241, .32);
}

.cs-demo-hint {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: .75rem .9rem;
  background: #f8fafc;
}

.form-control, .form-select {
  border-radius: 10px;
  border-color: #dbe2ef;
}
.form-control:focus, .form-select:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .14);
}
.input-group-text { border-radius: 10px; border-color: #dbe2ef; color: var(--cs-muted); }

/* ---------- empty / error states ----------------------------------------- */
.cs-empty {
  background: #fff;
  border: 1px dashed #d7dced;
  border-radius: 20px;
  padding: 3.5rem 1.5rem;
}

.cs-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cs-primary-soft);
  color: var(--cs-primary);
  font-size: 1.6rem;
}
.cs-empty-icon-lg { width: 78px; height: 78px; font-size: 2rem; }
.cs-empty-icon-warn { background: #fff1f2; color: #e11d48; }

/* ---------- footer -------------------------------------------------------- */
.cs-footer {
  background: #fff;
  border-top: 1px solid var(--cs-line);
}
.cs-footer-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cs-muted);
  margin-bottom: .75rem;
}
.cs-footer a { color: #475569; }
.cs-footer a:hover { color: var(--cs-primary); }
.cs-footer-bottom {
  border-top: 1px solid var(--cs-line);
  padding: 1rem 0;
}
.cs-footer code,
.cs-auth-card code { color: #4338ca; }

/* ---------- small screens -------------------------------------------------- */
@media (max-width: 767.98px) {
  .cs-hero { padding: 2rem 1.25rem; border-radius: 20px; }
  .cs-hero-card { padding: 1.15rem; }
  .cs-empty { padding: 2.5rem 1rem; }
  .cs-price-lg { font-size: 1.6rem; }
}

@media (min-width: 1400px) {
  .container-xxl { max-width: 1240px; }
}

/* ---- simplified flat look ---- */
body { background: #f8f9fa; }
.card { border-radius: 6px !important; box-shadow: none !important; border-color: #dee2e6 !important; }
.cs-listing:hover { transform: none; box-shadow: none !important; }
.cs-thumb { background: #e9ecef; }
.cs-thumb-tag, .cs-thumb-status, .badge, .rounded-pill { border-radius: 4px !important; }
.btn, .form-control, .form-select, .input-group-text { border-radius: 4px !important; }
.cs-price { color: #212529 !important; }
.cs-media { border-radius: 6px !important; background: #e9ecef !important; }
.cs-auth-card, .cs-filter-card, .cs-form-card, .cs-detail-card { border-radius: 6px !important; box-shadow: none !important; }
.btn-primary { --bs-btn-bg: #0d6efd; --bs-btn-border-color: #0d6efd; --bs-btn-hover-bg: #0b5ed7; --bs-btn-hover-border-color: #0a58ca; --bs-btn-active-bg: #0a58ca; --bs-btn-active-border-color: #0a58ca; }
a { color: #0d6efd; }
.form-control:focus, .form-select:focus { border-color: #86b7fe; box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15); }

/* ---- auth pages: centre the card in the viewport ---- */
.auth-shell { min-height: calc(100vh - 160px); display: flex; align-items: center; justify-content: center; }

/* ---- sticky footer + full-height auth pages ---- */
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
main.auth-main { display: flex; align-items: center; justify-content: center; }
.auth-shell { min-height: 0; width: 100%; }
