*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy:     #0B1D3E;
  --blue:     #1A56DB;
  --orange:   #E85D26;
  --white:    #FFFFFF;
  --gray-50:  #F8F9FB;
  --gray-100: #F0F2F5;
  --gray-200: #E2E6ED;
  --gray-300: #CDD3DC;
  --gray-400: #9AA3B0;
  --gray-600: #5A6478;
  --gray-700: #3D4658;
  --gray-800: #1E2533;
  --green:    #059669;
  --radius:   12px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.11);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.18);
  --font:     'Inter', sans-serif;
  --font-d:   'Manrope', sans-serif;
  --t:        .2s ease;
  --app-sidebar-w: 72px;
  --app-sidebar-expanded: 230px;
  --topbar-h: 58px;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--gray-800); background: var(--gray-50); -webkit-font-smoothing: antialiased; display: flex; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── APP SIDEBAR ─────────────────────────────── */
.app-sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--app-sidebar-w); background: var(--navy);
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 0 24px; z-index: 200;
  transition: width .28s cubic-bezier(.4,0,.2,1); overflow: hidden;
}
.app-sidebar:hover, .app-sidebar.expanded {
  width: var(--app-sidebar-expanded); align-items: flex-start;
}
.app-sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; margin-bottom: 36px; flex-shrink: 0;
  white-space: nowrap; overflow: hidden;
}
.app-sidebar-logo img { height: 36px; width: auto; flex-shrink: 0; filter: brightness(0) invert(1); }
.app-sidebar-nav { width: 100%; flex: 1; }
.app-sidebar-group { margin-bottom: 6px; }
.app-sidebar-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: 10px 20px 4px; white-space: nowrap; opacity: 0; transition: opacity .2s;
}
.app-sidebar:hover .app-sidebar-label,
.app-sidebar.expanded .app-sidebar-label { opacity: 1; }
.app-sidebar-link {
  display: flex; align-items: center; gap: 13px; padding: 11px 18px;
  color: rgba(255,255,255,.65); font-size: .875rem; font-weight: 500;
  white-space: nowrap; transition: background var(--t), color var(--t); position: relative;
}
.app-sidebar-link:hover { background: rgba(255,255,255,.08); color: var(--white); }
.app-sidebar-link.active { background: rgba(26,86,219,.25); color: var(--white); }
.app-sidebar-link.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--blue); border-radius: 0 2px 2px 0;
}
.app-sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.app-sidebar-text { opacity: 0; transition: opacity .18s; }
.app-sidebar:hover .app-sidebar-text,
.app-sidebar.expanded .app-sidebar-text { opacity: 1; }
.app-sidebar-bottom { width: 100%; border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; margin-top: 8px; }

/* ── MAIN WRAPPER ────────────────────────────── */
.main-wrapper {
  margin-left: var(--app-sidebar-w); flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}

/* ── TOP BAR ─────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.97); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: var(--topbar-h);
}
.topbar-search {
  flex: 1; display: flex; align-items: center;
  background: var(--gray-100); border: 1.5px solid var(--gray-200);
  border-radius: 10px; overflow: hidden; max-width: 560px;
  transition: border-color var(--t), box-shadow var(--t);
}
.topbar-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.topbar-search-icon { padding: 0 10px 0 14px; color: var(--gray-400); display: flex; align-items: center; }
.topbar-search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font); font-size: .875rem; color: var(--gray-800); padding: 10px 0;
}
.topbar-search-input::placeholder { color: var(--gray-400); }
.topbar-search-btn {
  background: var(--blue); color: white; font-size: .82rem; font-weight: 700;
  padding: 10px 18px; white-space: nowrap; transition: opacity var(--t);
}
.topbar-search-btn:hover { opacity: .88; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.btn-sell {
  display: flex; align-items: center; gap: 6px;
  background: var(--orange); color: white; font-size: .82rem; font-weight: 700;
  padding: 8px 16px; border-radius: 8px; transition: opacity var(--t); white-space: nowrap;
}
.btn-sell:hover { opacity: .88; }
.btn-primary {
  background: var(--blue); color: white; font-size: .82rem; font-weight: 700;
  padding: 8px 16px; border-radius: 8px; transition: opacity var(--t); white-space: nowrap;
}
.btn-primary:hover { opacity: .88; }

/* ── HERO BANNER ─────────────────────────────── */
.market-hero {
  background: var(--navy); position: relative; overflow: hidden;
  padding: 48px 32px 40px;
}
.market-hero-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 32px; flex-wrap: wrap; position: relative; z-index: 2;
}
.hero-badge {
  display: inline-block; background: rgba(26,86,219,.25);
  color: #60A5FA; font-size: .72rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 14px;
}
.market-hero-text h1 {
  font-family: var(--font-d); font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 800; color: var(--white); line-height: 1.2;
  letter-spacing: -.4px; margin-bottom: 12px;
}
.market-hero-text h1 span { color: #60A5FA; }
.market-hero-text p { color: rgba(255,255,255,.6); font-size: .95rem; line-height: 1.7; margin-bottom: 22px; max-width: 420px; }
.btn-hero-sell {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--orange); color: white; font-size: .9rem; font-weight: 700;
  padding: 12px 24px; border-radius: 10px; transition: opacity var(--t);
}
.btn-hero-sell:hover { opacity: .88; }

.market-hero-stats {
  display: flex; align-items: center; gap: 20px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px; padding: 20px 28px; flex-shrink: 0;
}
.hero-stat-val { font-family: var(--font-d); font-size: 1.6rem; font-weight: 800; color: white; line-height: 1; margin-bottom: 4px; }
.hero-stat-lbl { font-size: .72rem; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.hero-stat-div { width: 1px; height: 36px; background: rgba(255,255,255,.15); flex-shrink: 0; }

.hero-deco-1 { position: absolute; width: 400px; height: 400px; border-radius: 50%; background: rgba(26,86,219,.12); top: -160px; right: -100px; }
.hero-deco-2 { position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(232,93,38,.1); bottom: -80px; left: 200px; }

/* ── CATEGORY BAR ────────────────────────────── */
.category-bar {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  position: sticky; top: var(--topbar-h); z-index: 90;
}
.category-bar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; gap: 6px; padding: 12px 32px;
  overflow-x: auto; scrollbar-width: none;
}
.category-bar-inner::-webkit-scrollbar { display: none; }

.cat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 20px; white-space: nowrap;
  font-size: .82rem; font-weight: 600; color: var(--gray-600);
  border: 1.5px solid var(--gray-200); background: var(--white);
  transition: all var(--t); flex-shrink: 0;
}
.cat-pill:hover { border-color: var(--blue); color: var(--blue); }
.cat-pill.active { background: var(--blue); color: white; border-color: var(--blue); }
.cat-pill svg { flex-shrink: 0; }

/* ── MARKET CONTENT ──────────────────────────── */
.market-content { max-width: 1200px; margin: 0 auto; padding: 24px 32px 64px; width: 100%; }

/* ── TOOLBAR ─────────────────────────────────── */
.market-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.toolbar-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.items-count { font-weight: 700; font-size: .9rem; font-family: var(--font-d); color: var(--gray-800); white-space: nowrap; }
.condition-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cond-chip {
  padding: 5px 12px; border-radius: 20px; font-size: .76rem; font-weight: 600;
  border: 1.5px solid var(--gray-200); color: var(--gray-600); background: var(--white);
  transition: all var(--t);
}
.cond-chip:hover { border-color: var(--blue); color: var(--blue); }
.cond-chip.active { background: var(--blue); color: white; border-color: var(--blue); }
.sort-select {
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  padding: 8px 12px; font-family: var(--font); font-size: .82rem;
  color: var(--gray-700); font-weight: 600; background: var(--white);
  outline: none; cursor: pointer; transition: border-color var(--t);
}
.sort-select:focus { border-color: var(--blue); }

/* ── ITEMS GRID ──────────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

/* ── ITEM CARD ───────────────────────────────── */
.item-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--gray-200); overflow: hidden;
  cursor: pointer; transition: transform var(--t), box-shadow var(--t);
  display: flex; flex-direction: column;
}
.item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.item-img-wrap { position: relative; overflow: hidden; }
.item-img-wrap img { width: 100%; height: 170px; object-fit: cover; transition: transform .4s ease; }
.item-card:hover .item-img-wrap img { transform: scale(1.05); }

.item-save {
  position: absolute; top: 9px; right: 9px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center;
  color: var(--gray-400); box-shadow: var(--shadow-sm);
  transition: color .12s ease;
}
.item-save:hover { color: var(--orange); }
.item-save.saved { color: var(--orange); }
.item-save svg path { transition: fill-opacity .12s ease; }
.item-save.saved svg path { fill-opacity: 1; }

.item-condition {
  position: absolute; bottom: 8px; left: 8px;
  font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px;
}
.cond-new      { background: rgba(5,150,105,.9);  color: white; }
.cond-like-new { background: rgba(26,86,219,.9);  color: white; }
.cond-good     { background: rgba(251,191,36,.9); color: var(--gray-800); }
.cond-fair     { background: rgba(232,93,38,.9);  color: white; }

.item-body { padding: 11px 12px 8px; flex: 1; }
.item-cat { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); margin-bottom: 4px; }
.item-name { font-weight: 700; font-size: .875rem; color: var(--gray-800); margin-bottom: 5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-seller { font-size: .75rem; color: var(--gray-400); display: flex; align-items: center; gap: 4px; }

.item-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 11px; border-top: 1px solid var(--gray-100); margin-top: 8px;
}
.item-price { font-family: var(--font-d); font-size: 1rem; font-weight: 800; color: var(--orange); }
.item-views { font-size: .72rem; color: var(--gray-400); display: flex; align-items: center; gap: 3px; }

/* ── EMPTY STATE ─────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 20px; text-align: center; gap: 14px;
}
.empty-state h3 { font-family: var(--font-d); font-size: 1.1rem; font-weight: 800; color: var(--gray-700); }
.empty-state p { font-size: .875rem; color: var(--gray-400); }
.btn-reset {
  margin-top: 6px; background: var(--blue); color: white;
  padding: 10px 22px; border-radius: 8px; font-size: .875rem; font-weight: 700;
  transition: opacity var(--t);
}
.btn-reset:hover { opacity: .88; }

/* ── LOAD MORE ───────────────────────────────── */
.load-more-wrap { display: flex; justify-content: center; margin-top: 32px; }
.btn-load-more {
  padding: 12px 36px; border-radius: 10px; font-size: .875rem; font-weight: 700;
  border: 1.5px solid var(--gray-200); color: var(--gray-700); background: var(--white);
  transition: all var(--t);
}
.btn-load-more:hover { border-color: var(--blue); color: var(--blue); }

/* ── SELL CTA BANNER ─────────────────────────── */
.sell-cta-banner {
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a7a 100%);
  padding: 48px 32px; margin-top: 0;
}
.sell-cta-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.sell-cta-inner h2 {
  font-family: var(--font-d); font-size: 1.5rem; font-weight: 800;
  color: white; margin-bottom: 6px;
}
.sell-cta-inner p { color: rgba(255,255,255,.6); font-size: .9rem; }
.btn-cta-sell {
  display: inline-block; background: var(--orange); color: white;
  font-size: .95rem; font-weight: 700; padding: 13px 30px;
  border-radius: 10px; transition: opacity var(--t); white-space: nowrap; flex-shrink: 0;
}
.btn-cta-sell:hover { opacity: .88; }

/* ── ITEM MODAL ──────────────────────────────── */
.item-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.item-modal.open { opacity: 1; pointer-events: auto; }
.item-modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
}
.item-modal-card {
  position: relative; z-index: 1;
  background: var(--white); border-radius: 16px;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px); transition: transform .25s;
}
.item-modal.open .item-modal-card { transform: translateY(0); }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  font-size: 1.5rem; color: var(--gray-400); z-index: 2;
  line-height: 1; transition: color var(--t);
}
.modal-close:hover { color: var(--gray-800); }
.modal-img-wrap { position: relative; }
.modal-img-wrap img { width: 100%; height: 280px; object-fit: cover; border-radius: 16px 16px 0 0; }
.modal-condition-badge {
  position: absolute; bottom: 12px; left: 12px;
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
}
.modal-body { padding: 20px 24px 28px; }
.modal-cat { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); margin-bottom: 6px; }
.modal-title { font-family: var(--font-d); font-size: 1.3rem; font-weight: 800; color: var(--gray-800); margin-bottom: 8px; line-height: 1.25; }
.modal-price { font-family: var(--font-d); font-size: 1.5rem; font-weight: 800; color: var(--orange); margin-bottom: 12px; }
.modal-desc { font-size: .875rem; color: var(--gray-600); line-height: 1.7; margin-bottom: 18px; }
.modal-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.modal-meta-item { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--gray-600); }
.modal-meta-item svg { color: var(--blue); flex-shrink: 0; }
.modal-actions { display: flex; gap: 10px; }
.btn-contact-seller {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: white; font-size: .9rem; font-weight: 700;
  padding: 13px; border-radius: 10px; transition: opacity var(--t);
}
.btn-contact-seller:hover { opacity: .88; }
.btn-modal-save {
  width: 46px; height: 46px; border-radius: 10px;
  border: 1.5px solid var(--gray-200); color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  transition: color .12s ease, border-color .12s ease;
}
.btn-modal-save:hover { color: var(--orange); border-color: var(--orange); }
.btn-modal-save.saved { color: var(--orange); border-color: var(--orange); }
.btn-modal-save svg path { transition: fill-opacity .12s ease; }
.btn-modal-save.saved svg path { fill-opacity: 1; }

/* ── SCROLL TOP ──────────────────────────────── */
.scroll-top {
  position: fixed; bottom: 26px; right: 26px;
  width: 42px; height: 42px; background: var(--blue); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none;
  transition: opacity var(--t); z-index: 900;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; }

/* ── MOBILE TOP BAR ──────────────────────────── */
.mobile-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  height: 56px; background: var(--navy); z-index: 300;
  align-items: center; padding: 0 16px; gap: 14px;
}
.mobile-topbar img { height: 32px; filter: brightness(0) invert(1); }
.hamburger { width: 36px; height: 36px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; margin-left: auto; }
.hamburger span { width: 20px; height: 2px; background: white; border-radius: 2px; display: block; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 190; }
.sidebar-overlay.visible { display: block; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 900px) {
  .market-hero-stats { display: none; }
  .market-content { padding: 20px 20px 48px; }
  .category-bar-inner { padding: 10px 20px; }
}
@media (max-width: 768px) {
  .app-sidebar { transform: translateX(-100%); width: var(--app-sidebar-expanded); transition: transform .28s cubic-bezier(.4,0,.2,1); }
  .app-sidebar.expanded { transform: translateX(0); }
  .app-sidebar .app-sidebar-text { opacity: 1; }
  .app-sidebar .app-sidebar-label { opacity: 1; }
  .main-wrapper { margin-left: 0; padding-top: 56px; }
  .mobile-topbar { display: flex; }
  .topbar { display: none; }
  .market-hero { padding: 32px 20px 28px; }
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .item-modal-card { max-width: calc(100vw - 32px); }
}
@media (max-width: 480px) {
  .items-grid { grid-template-columns: 1fr 1fr; }
  .sell-cta-inner { flex-direction: column; align-items: flex-start; }
  .market-toolbar { flex-direction: column; align-items: flex-start; }
}