:root {
  --bg: #f0f4fa;
  --surface: #ffffff;
  --surface-2: #e8eef8;
  --text: #0c1e3d;
  --text-muted: #5a6b85;
  --primary: #0B3D7A;
  --primary-dark: #082952;
  --primary-soft: #dce8f8;
  --accent: #C2563E;
  --accent-dark: #9E4532;
  --accent-soft: #fde8e3;
  --terracotta: #B85445;
  --gold: #D4A017;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #d4deef;
  --shadow: 0 4px 24px rgba(11, 61, 122, 0.1);
  --shadow-lg: 0 16px 48px rgba(11, 61, 122, 0.16);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Outfit", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.9s ease-in-out;
  pointer-events: none;
  z-index: -2;
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(240, 244, 250, 0.82) 0%, rgba(240, 244, 250, 0.94) 55%, rgba(240, 244, 250, 0.97) 100%),
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(11, 61, 122, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(194, 86, 62, 0.08), transparent);
  pointer-events: none;
}

.container {
  width: min(1120px, 92vw);
  margin-inline: auto;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(11, 61, 122, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
  position: relative;
}

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

.header-user {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
}

.logo em { color: var(--accent); font-style: normal; }

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #1a5fad);
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(11, 61, 122, 0.25);
}

.logo-badge.lg { width: 52px; height: 52px; font-size: 1.1rem; border-radius: 14px; }
.logo-badge.sm { width: 28px; height: 28px; font-size: 0.7rem; border-radius: 8px; }

/* JKLU Logo — transparent PNG */
.jklu-logo {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(11, 61, 122, 0.15));
}

/* White backdrop — logo only, keeps logo text readable */
.logo-on-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 2px 12px rgba(11, 61, 122, 0.1);
  border: 1px solid rgba(11, 61, 122, 0.08);
}

.header-logo-wrap {
  flex-shrink: 0;
}

.header-logo {
  height: 42px;
  width: auto;
  filter: none;
}

.footer-logo-wrap {
  margin-bottom: 0.75rem;
  width: fit-content;
}

.footer-logo {
  height: 68px;
  width: auto;
  margin: 0;
  filter: none;
}

.auth-logo-wrap {
  flex-shrink: 0;
}

.auth-form-logo {
  height: 40px;
  width: auto;
  filter: none;
}

.auth-form-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  padding: 0;
  background: none;
  box-shadow: none;
  width: fit-content;
}

.auth-form-header .auth-brand {
  color: var(--text);
  font-size: 1.35rem;
}

.auth-form-header .auth-brand em {
  color: var(--accent);
}

.corner-logo {
  position: fixed;
  width: 90px;
  height: auto;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

.corner-logo-tr { top: 88px; right: 28px; }
.corner-logo-bl { bottom: 130px; left: 28px; transform: rotate(-8deg); opacity: 0.05; }

.hero-watermark {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 100px;
  height: auto;
  opacity: 0.35;
  z-index: 2;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.3));
  animation: float 5s ease-in-out infinite;
}

.slide-watermark {
  position: absolute;
  width: 80px;
  height: auto;
  opacity: 0.22;
  z-index: 1;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.slide-watermark-tl { top: 1.25rem; left: 1.25rem; }
.slide-watermark-br { bottom: 5.5rem; right: 1.25rem; transform: rotate(8deg); }

.logo-icon { font-size: 1.5rem; }

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-1px);
}

.nav-link { transition: background 0.2s, color 0.2s, transform 0.2s; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* Main */
main { flex: 1; padding-bottom: 3rem; }

/* Hero */
.jklu-hero {
  position: relative;
  color: white;
  padding: 4.5rem 0 5rem;
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: center;
}

.hero-bg-slides {
  position: absolute;
  inset: 0;
}

.hero-bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  image-rendering: auto;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 1.4s ease, transform 10s ease;
  will-change: transform, opacity;
}

.hero-bg-slide.active {
  opacity: 1;
  transform: scale(1);
}

/* Section banner — unique campus photo per page */
.page-banner {
  position: relative;
  margin: 0 calc(-1 * ((100vw - min(1120px, 92vw)) / 2)) 2rem;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.page-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(11, 61, 122, 0.82) 0%, rgba(11, 61, 122, 0.45) 45%, rgba(194, 86, 62, 0.35) 100%);
}

.page-banner-content {
  position: relative;
  z-index: 1;
  padding: 2.5rem 0 2rem;
  color: #fff;
}

.page-banner-content h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
}

.page-banner-content p {
  margin: 0;
  opacity: 0.92;
  font-size: 1rem;
}

.page-banner-caption {
  margin-top: 0.75rem !important;
  font-size: 0.85rem !important;
  opacity: 0.75 !important;
  font-style: italic;
}

.sell-user-line {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(8, 41, 82, 0.82) 0%, rgba(11, 61, 122, 0.68) 45%, rgba(194, 86, 62, 0.4) 100%);
}

.hero-shapes .shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  animation: float 6s ease-in-out infinite;
}

.shape-1 { width: 300px; height: 300px; top: -80px; right: -60px; animation-delay: 0s; }
.shape-2 { width: 180px; height: 180px; bottom: 20px; left: 10%; animation-delay: 2s; }
.shape-3 { width: 120px; height: 120px; top: 40%; right: 20%; animation-delay: 4s; }

.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #1a5fad 100%);
  color: white;
  padding: 3.5rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
}

.text-gradient {
  background: linear-gradient(90deg, #fff 0%, #f0c4a8 50%, #ffd699 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content { position: relative; text-align: center; max-width: 680px; margin-inline: auto; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.hero p {
  font-size: 1.125rem;
  opacity: 0.92;
  margin: 0 0 1.75rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

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

.btn-primary {
  background: white;
  color: var(--primary-dark);
  box-shadow: var(--shadow);
}

.btn-primary:hover { box-shadow: var(--shadow-lg); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.25); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
}

.btn-accent:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-glow {
  box-shadow: 0 4px 20px rgba(232, 93, 4, 0.4);
}

.btn-glow:hover { box-shadow: 0 8px 28px rgba(232, 93, 4, 0.5); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover { background: var(--primary-soft); }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm { padding: 0.45rem 1rem; font-size: 0.875rem; }

.btn-block { width: 100%; }

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: -2rem;
  position: relative;
  z-index: 1;
  padding-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--primary);
}

.stat-float {
  animation: float 4s ease-in-out infinite;
}

.jklu-tag, .tag.jklu-tag {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.75rem;
}

.jklu-campus-chip {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.stat-card span {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Filters */
.filters-section {
  padding: 2rem 0 1rem;
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  background: var(--surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--surface-2);
  transition: border-color 0.2s;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.45;
  pointer-events: none;
}

select, .input {
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

select:focus, .input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pill {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.pill:hover { border-color: var(--primary); color: var(--primary); }

.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Listings grid */
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.listing-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.listing-image {
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
  background: #f0f3f8;
  border-bottom: 1px solid var(--border);
}

.listing-image .product-photo {
  position: absolute;
  inset: 0;
}

.listing-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--accent-soft);
  color: #047857;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  z-index: 2;
}

/* Product photo frame — marketplace style */
.product-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f6fa 100%);
  box-sizing: border-box;
}

.product-photo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(11, 61, 122, 0.1);
  background: #fff;
}

.product-photo-emoji {
  font-size: 3rem;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f8 100%);
}

.detail-image .product-photo {
  min-height: 100%;
  padding: 1.5rem;
}

.detail-image .product-photo-emoji.detail-emoji {
  font-size: 5rem;
}

.detail-image .product-photo img {
  max-height: 420px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(11, 61, 122, 0.12);
}

.product-photo-lg {
  min-height: 220px;
  max-width: 320px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.upload-preview {
  margin-top: 0.75rem;
  display: none;
}

.upload-preview.visible {
  display: block;
}

.upload-preview.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.preview-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.listing-image img {
  /* legacy — replaced by .product-photo img */
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.listing-badge.sold { background: #fee2e2; color: #b91c1c; }

.listing-card.sold { opacity: 0.75; }

.sold-label, .owner-label {
  display: inline-block;
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.tag.verified { background: var(--accent-soft); color: #047857; }

.seller-contact { font-size: 0.875rem; color: var(--text); margin-top: 0.25rem; }

/* Auth pages */
.auth-page {
  padding: 2.5rem 0 3rem;
  display: flex;
  justify-content: center;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem;
  box-shadow: var(--shadow);
  width: min(440px, 100%);
}

.auth-card.wide { width: min(560px, 100%); }

.auth-card h2 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.form-subtitle {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.auth-footer {
  text-align: center;
  margin: 1.25rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer a { color: var(--primary); font-weight: 600; }

.step-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.step-dot {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.step-dot.active { background: var(--primary); }

/* ID capture */
.id-capture-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.id-video, .id-preview {
  aspect-ratio: 4/3;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  overflow: hidden;
  object-fit: cover;
}

.id-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

.id-preview img { width: 100%; height: 100%; object-fit: cover; }

.id-placeholder { font-size: 1.5rem; color: var(--text-muted); }

.id-actions, .form-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-actions-row { justify-content: space-between; margin-top: 1rem; }

.hidden { display: none !important; }

.otp-input {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-weight: 700;
}

.demo-otp {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.verify-badges {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: var(--accent-soft); color: var(--accent-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

/* Messages */
.messages-page { padding-bottom: 2rem; }

.messages-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1rem;
  min-height: 480px;
}

.conv-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.conv-item {
  display: block;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.conv-item:hover, .conv-item.active { background: var(--primary-soft); }

.conv-item strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }

.conv-item span { font-size: 0.8rem; color: var(--text-muted); }

.conv-item p {
  margin: 0.35rem 0 0;
  font-size: 0.825rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.chat-header strong { display: block; }

.chat-header span { font-size: 0.85rem; color: var(--text-muted); }

.chat-messages {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 320px;
  max-height: 420px;
}

.chat-bubble {
  max-width: 75%;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-size: 0.925rem;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--surface-2);
  border-bottom-left-radius: 4px;
}

.bubble-time {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.chat-input-row .input { flex: 1; }

.chat-placeholder, .chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
}

.chat-placeholder .emoji { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* Checkout */
.checkout-page { padding-bottom: 2rem; }

.checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.checkout-summary h3, .checkout-grid form h3 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0 0;
  font-weight: 700;
  font-size: 1.1rem;
}


.listing-body {
  padding: 1rem 1.15rem 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.listing-price {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.listing-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 0.35rem;
  line-height: 1.35;
}

.listing-meta {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.listing-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--text-muted);
  border-radius: 50%;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

.empty-state .emoji { font-size: 3rem; margin-bottom: 1rem; }

.empty-state h3 {
  font-family: var(--font-display);
  margin: 0 0 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

/* Detail page */
.detail-page { padding: 2rem 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.back-link:hover { color: var(--primary); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.detail-image {
  aspect-ratio: 1;
  background: #f0f3f8;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

.detail-image img {
  object-fit: contain;
}

.detail-info h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.detail-price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 1rem;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tag {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.detail-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.seller-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.seller-card h4 {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

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

.seller-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.seller-name { font-weight: 600; }
.seller-campus { font-size: 0.875rem; color: var(--text-muted); }

.detail-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Forms */
.page-header {
  padding: 2.5rem 0 1rem;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 0.35rem;
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
}

.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 640px;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

textarea.input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  cursor: text;
}

.input { width: 100%; cursor: text; }

.image-preview {
  display: none;
}

.upload-preview.visible .product-photo-lg {
  margin-top: 0;
}

/* Profile */
.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.profile-sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.profile-logo-wrap {
  margin: 0 auto 0.75rem;
  width: fit-content;
}

.profile-logo {
  height: 64px;
  width: auto;
  margin: 0;
  filter: none;
}

.auth-brand-logo {
  height: 80px;
  width: auto;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.45));
}
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.profile-sidebar h2 {
  font-family: var(--font-display);
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.profile-sidebar .campus-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.profile-stat strong {
  display: block;
  font-family: var(--font-display);
  color: var(--primary);
  font-size: 1.25rem;
}

.profile-stat span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.my-listings .listing-card { position: relative; }

.section-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.5rem 0 1rem;
}

.sold-section-title {
  margin-top: 2rem;
}

.empty-state.compact {
  padding: 1.5rem;
  border-width: 1px;
}

.empty-state.compact p {
  margin: 0;
  color: var(--text-muted);
}

.listing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.15rem 1.15rem;
}

/* Footer */
.footer {
  background: var(--text);
  color: rgba(255, 255, 255, 0.75);
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2.5rem 0 1.5rem;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand strong {
  display: block;
  color: white;
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0.25rem 0;
}

.footer-brand p {
  margin: 0;
  font-size: 0.875rem;
  max-width: 280px;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a:hover { color: white; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 0;
}

.footer-bottom p {
  margin: 0;
  font-size: 0.8rem;
  text-align: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: white;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 200;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .nav.open { display: flex; }

  .stats-bar { grid-template-columns: 1fr; margin-top: -1rem; }

  .detail-grid,
  .profile-grid,
  .form-row,
  .checkout-grid,
  .messages-layout,
  .id-capture-area {
    grid-template-columns: 1fr;
  }

  .header-actions .btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

  .filters-bar { flex-direction: column; align-items: stretch; }

  .filters-bar select { width: 100%; }

  .auth-shell { grid-template-columns: 1fr !important; min-height: auto !important; }
  .auth-visual { min-height: 220px; }
  .jklu-hero { min-height: 360px; padding: 3rem 0; }

  .corner-logo { display: none; }
  .hero-watermark { width: 60px; top: 1rem; right: 1rem; }
  .header-logo { height: 34px; }
}

/* Auth split layout with JKLU photo slideshow */
.auth-shell {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: calc(100vh - 140px);
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.auth-visual {
  position: relative;
  min-height: 520px;
  overflow: hidden;
}

.auth-slideshow {
  position: absolute;
  inset: 0;
}

.auth-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.2s ease, transform 8s ease;
  will-change: transform, opacity;
}

.auth-slide.active {
  opacity: 1;
  transform: scale(1);
}

.auth-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 41, 82, 0.92) 0%, rgba(11, 61, 122, 0.4) 50%, rgba(11, 61, 122, 0.2) 100%);
}

.auth-slide-caption {
  position: absolute;
  bottom: 5rem;
  left: 1.5rem;
  right: 1.5rem;
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.auth-visual-brand {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 2;
  padding: 0;
  background: none;
  box-shadow: none;
}

.auth-visual-location {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.slide-dots {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 2;
}

.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}

.slide-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--surface);
}

.auth-form-inner {
  width: min(420px, 100%);
}

.auth-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
}

.auth-brand em { color: var(--accent); font-style: normal; }

.auth-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.auth-form-inner h2 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.footer {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.listing-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.listing-card:hover {
  transform: translateY(-5px) scale(1.01);
}

.pill.active {
  background: linear-gradient(135deg, var(--primary), #1a5fad);
  border-color: var(--primary);
}

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

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

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.animate-in {
  animation: fadeInUp 0.55s ease both;
}

.animate-fade {
  animation: fadeIn 0.5s ease both;
}

.animate-slide-up {
  animation: slideUp 0.6s ease both;
}

.animate-caption {
  animation: fadeInUp 0.8s ease 0.3s both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
