/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black: #111111;
  --white: #ffffff;
  --gray-bg: #f5f5f5;
  --gray-text: #777;
  --border: #e4e4e4;
  --teal: #1f7a8c;
  --teal-dark: #166377;
  --teal-light: #e8f4f6;
  --bottom-nav-h: 64px;
}

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--white);
  color: var(--black);
  padding-bottom: calc(var(--bottom-nav-h) + 8px);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ===== TOP NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border);
}
.brand { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.3px; }
.menu-btn { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.menu-btn span { display: block; width: 20px; height: 2px; background: var(--black); border-radius: 2px; }
.profile-btn { background: none; border: none; cursor: pointer; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.profile-btn svg { width: 22px; height: 22px; }

/* ===== MARKETPLACE TOP NAVBAR ===== */
.nav-logo { font-size: 1.1rem; font-weight: 700; color: var(--teal); letter-spacing: -0.3px; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { font-size: 14px; font-weight: 500; color: #555; text-decoration: none; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--teal); }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.btn-login { background: var(--teal); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; text-decoration: none; transition: background 0.2s; }
.btn-login:hover { background: var(--teal-dark); }

/* ===== HERO ===== */
.hero {
  position: relative;
  width: 100%;           /* ← fixed from 9000px typo */
  height: 420px;
  overflow: hidden;
  background: #071428;  /* dark fallback while image loads */
}

/* Real photo — fills hero edge-to-edge */
.hero-bg,
.hero-real-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  z-index: 1;
}

/* SVG illustration fallback sits behind the photo */
.hero-bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.05) 0%,
    rgba(0,0,0,0.18) 40%,
    rgba(0,0,0,0.68) 100%
  );
  z-index: 2;
}

.hero-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0 16px 24px;
  z-index: 3;
}

.hero-content h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.35;
  margin-bottom: 14px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: 10px;
  padding: 10px 14px;
  gap: 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.search-icon { width: 16px; height: 16px; flex-shrink: 0; }
.search-bar input { flex: 1; border: none; outline: none; font-family: inherit; font-size: 0.875rem; color: #333; background: transparent; }
.search-bar input::placeholder { color: #aaa; }

/* Hero subtitle */
.hero-subtitle {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 6px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  display: flex; align-items: center; gap: 4px;
}

/* ===== CATEGORIES ===== */
.categories { display: flex; gap: 8px; padding: 14px 16px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.categories::-webkit-scrollbar { display: none; }
.cat-btn { flex-shrink: 0; border: 1px solid var(--border); border-radius: 20px; background: var(--white); color: #444; font-family: inherit; font-size: 0.82rem; font-weight: 500; padding: 6px 14px; cursor: pointer; transition: all 0.15s; }
.cat-btn.active { background: var(--black); color: var(--white); border-color: var(--black); }
.cat-btn:not(.active):hover { background: var(--gray-bg); }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 12px; }
.section-header h2 { font-size: 1rem; font-weight: 700; }
.view-all { font-size: 0.75rem; font-weight: 600; color: #555; letter-spacing: 0.5px; }

/* ===== FEATURED COLLECTIONS ===== */
.featured { padding-top: 8px; }
.collection-card { margin: 0 16px 12px; border-radius: 14px; overflow: hidden; background: var(--gray-bg); cursor: pointer; transition: transform 0.15s; }
.collection-card:active { transform: scale(0.98); }
.collection-img { width: 100%; height: 200px; object-fit: cover; display: block; }
.collection-info { padding: 14px 14px 16px; }
.tag { display: inline-block; background: var(--black); color: var(--white); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.6px; padding: 3px 9px; border-radius: 20px; margin-bottom: 8px; text-transform: uppercase; }
.collection-info h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 5px; }
.collection-info p { font-size: 0.82rem; color: var(--gray-text); margin-bottom: 10px; line-height: 1.45; }
.shop-btn { font-size: 0.82rem; font-weight: 600; color: var(--black); }
.shop-btn:hover { text-decoration: underline; }
.grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px; margin-bottom: 12px; }
.grid-two .collection-card { margin: 0; }
.grid-two .collection-img { height: 120px; }

/* ===== TRENDING SECTION ===== */
.trending { padding-top: 16px; }
.items-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px; }

.item-card { border-radius: 12px; overflow: hidden; background: var(--gray-bg); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; display: block; text-decoration: none; color: inherit; }
.item-card:active { transform: scale(0.97); }
.item-card:hover  { box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-2px); }
.item-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.item-card-no-img { width: 100%; height: 110px; background: #e8e8e8; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.item-details { padding: 10px 10px 12px; }
.item-name { font-size: 0.8rem; font-weight: 600; color: var(--black); margin-bottom: 3px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-price { font-size: 0.85rem; font-weight: 700; color: #222; }
.item-price-orig { font-size: 0.72rem; color: #999; text-decoration: line-through; margin-left: 4px; }
.item-cat-badge { display: inline-block; font-size: 0.65rem; font-weight: 600; color: #555; background: #ebebeb; border-radius: 10px; padding: 2px 7px; margin-bottom: 4px; }

/* ===== SKELETON LOADERS ===== */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton-card { border-radius: 12px; height: 160px; background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%); background-size: 800px 100%; animation: shimmer 1.4s infinite linear; }

/* ===== SELL BANNER ===== */
.sell-banner { margin: 20px 16px 8px; background: var(--black); border-radius: 16px; padding: 22px 20px; }
.sell-text h2 { color: var(--white); font-size: 1rem; font-weight: 700; margin-bottom: 5px; }
.sell-text p { color: rgba(255,255,255,0.6); font-size: 0.8rem; line-height: 1.4; margin-bottom: 14px; }
.sell-cta { display: inline-block; background: var(--white); color: var(--black); font-size: 0.82rem; font-weight: 700; padding: 9px 18px; border-radius: 8px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; color: #bbb; font-size: 0.65rem; font-weight: 500;
  flex: 1; padding: 6px 0; transition: color 0.15s;
  text-decoration: none; position: relative;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active, .nav-item:hover { color: var(--black); }
.sell-nav { background: var(--black); color: var(--white) !important; width: 46px; height: 46px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.28); }
.sell-nav svg { width: 20px; height: 20px; }

/* Cart badge */
.cart-badge {
  position: absolute; top: 2px; right: calc(50% - 18px);
  background: #e53e3e; color: #fff;
  font-size: 0.58rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
  transform: scale(0); transition: transform 0.2s;
}
.cart-badge.visible { transform: scale(1); }

/* ===== LOADING MSG ===== */
.loading-msg { text-align: center; padding: 24px; color: #999; font-size: 0.85rem; grid-column: 1 / -1; }

/* ============================================================
   MARKETPLACE PAGE
   ============================================================ */
.page-header { background: linear-gradient(135deg, var(--teal) 0%, #0d4f5e 100%); padding: 28px 20px 24px; color: #fff; }
.page-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.page-header p { font-size: 13.5px; opacity: 0.82; margin-bottom: 16px; line-height: 1.5; }
.page-header .search-bar { margin-bottom: 14px; }

.category-pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.category-pills::-webkit-scrollbar { display: none; }
.pill { flex-shrink: 0; background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 20px; font-family: inherit; font-size: 0.8rem; font-weight: 500; padding: 6px 14px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.pill.active { background: #fff; color: var(--teal); border-color: #fff; font-weight: 700; }
.pill:not(.active):hover { background: rgba(255,255,255,0.25); }

.marketplace-main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.marketplace-main .section-header { padding: 0 0 14px; margin-bottom: 4px; }
.section-title { font-size: 1rem; font-weight: 700; color: var(--black); }

.item-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
@media (max-width: 600px) { .item-container { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* Item card (marketplace) */
.item-card {
  background: #fff; border-radius: 14px; overflow: hidden;
  cursor: pointer; transition: transform 0.18s, box-shadow 0.18s;
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
}
.item-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.10); }
.item-card:active { transform: scale(0.97); }

.item-card-img-wrap { position: relative; width: 100%; aspect-ratio: 4/3; overflow: hidden; background: #f0f0f0; }
.item-card-img-wrap a { display: block; width: 100%; height: 100%; }
.item-card-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; cursor: pointer; }
.item-card:hover .item-card-img { transform: scale(1.04); }
.item-card-cat-badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.55); color: #fff; font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 20px; backdrop-filter: blur(4px); pointer-events: none; }

.item-card-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.badge-featured { display: inline-block; background: #fff8e1; color: #e67e22; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; width: fit-content; }
.item-card-college { font-size: 10px; color: var(--teal); font-weight: 600; }
.item-card-name { font-size: 0.85rem; font-weight: 700; color: var(--black); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card-desc { font-size: 0.72rem; color: #888; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card-price-row { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.price-current { font-size: 1rem; font-weight: 700; color: var(--black); }
.price-original { font-size: 0.75rem; color: #aaa; text-decoration: line-through; }
.item-card-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.btn-buy { flex: 1; background: var(--teal); color: #fff; border: none; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.2s; white-space: nowrap; }
.btn-buy:hover { background: var(--teal-dark); }
.btn-secondary { background: var(--teal-light); color: var(--teal); border: none; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.2s; white-space: nowrap; }
.btn-secondary:hover { background: #cde9ef; }

/* ===== FOOTER ===== */
footer { background: var(--black); color: rgba(255,255,255,0.7); padding: 20px 24px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
footer a { color: rgba(255,255,255,0.6); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: #fff; }
footer strong { color: #fff; }


/* ── DESKTOP LAYOUT FIX ── */
@media (min-width: 600px) {
  /* Reset everything to full width — no centering columns */
  .featured-section,
  .trending-section,
  .categories,
  .sell-banner {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  .categories {
    padding: 14px 24px 12px !important;
  }

  .featured-section .section-header,
  .trending-section .section-header {
    padding: 16px 24px 10px !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .card-grid-2 {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 24px 16px !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px !important;
  }

  .sell-banner {
    margin: 12px 24px !important;
    width: calc(100% - 48px) !important;
  }

  /* Hero improvements */
  .hero { height: 480px; }
  .hero-content { padding: 0 32px 36px; }
  .hero-content h1 { font-size: 1.8rem; }
  .hero-search { max-width: 460px; }

  /* Top nav full width */
  .top-nav { padding: 0 24px; }

  /* Fix bottom nav — keep it full width, no transform */
  .bottom-nav {
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }

  .mp-card2-img-wrap { height: 160px !important; }
}

@media (min-width: 900px) {
  .card-grid-2 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  .mp-card2-img-wrap { height: 150px !important; }
  .hero { height: 560px; }
  .hero-content { padding: 0 48px 48px; }
  .hero-content h1 { font-size: 2rem; }

  .categories { padding: 14px 40px 12px !important; }
  .card-grid-2 { padding: 0 40px 16px !important; }
  .featured-section .section-header,
  .trending-section .section-header { padding: 16px 40px 10px !important; }
  .sell-banner { margin: 12px 40px !important; width: calc(100% - 80px) !important; }
}

@media (min-width: 1200px) {
  .card-grid-2 { grid-template-columns: repeat(5, 1fr) !important; }
  .categories { padding: 14px 56px 12px !important; }
  .card-grid-2 { padding: 0 56px 16px !important; }
  .featured-section .section-header,
  .trending-section .section-header { padding: 16px 56px 10px !important; }
  .sell-banner { margin: 12px 56px !important; width: calc(100% - 112px) !important; }
}