/* ============================================
   TradeNest — Marketplace Stylesheet
   ============================================ */

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --accent: #f5c842;
  --accent2: #ff6b35;
  --text: #f0f0f0;
  --muted: #888;
  --green: #3ecf8e;
  --red: #ff4d4d;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-family: 'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============ NAVBAR ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgba(13,13,13,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
}
.nav-logo span { color: var(--accent); }

.nav-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface2);
  padding: 5px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

.tab-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 22px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.25s;
  background: transparent;
  color: var(--muted);
}
.tab-btn.active {
  background: var(--accent);
  color: #0d0d0d;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(245,200,66,0.35);
}

.nav-cart {
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 9px 18px;
  border-radius: 50px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  background: var(--surface);
}
.nav-cart:hover { border-color: var(--accent); color: var(--accent); }

.cart-count {
  background: var(--accent);
  color: #0d0d0d;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: 50px;
}

/* ============ HERO ============ */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 70px 40px 60px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px; left: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(245,200,66,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 16px;
}
.hero h1 em { font-style: italic; color: var(--accent); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 420px;
  line-height: 1.6;
}

.hero-art {
  display: flex;
  gap: 18px;
  flex-shrink: 0;
}

.float-card {
  width: 80px; height: 80px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: floatUp 3s ease-in-out infinite;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}
.delay1 { animation-delay: 0.6s; }
.delay2 { animation-delay: 1.2s; }

@keyframes floatUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* ============ SECTION ============ */
.section {
  padding: 50px 40px;
  max-width: 1300px;
  margin: 0 auto;
}
.hidden { display: none !important; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 36px;
}

.section-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
}

/* ---- SEARCH BAR ---- */
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s;
}
.search-bar input { width: 240px; }
.search-bar input:focus,
.search-bar select:focus { border-color: var(--accent); }
.search-bar select option { background: var(--surface2); }

/* ============ PRODUCT GRID ============ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(245,200,66,0.1);
}

.product-emoji {
  font-size: 2.8rem;
  width: 68px; height: 68px;
  background: var(--surface2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.product-badge {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid var(--border);
  text-transform: uppercase;
}

.product-name {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.product-desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.product-price {
  font-family: 'Syne', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
}

.product-stock {
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 500;
}
.product-stock.low { color: var(--red); }

.qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.qty-btn {
  width: 32px; height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.qty-btn:hover { background: var(--accent); color: #0d0d0d; border-color: var(--accent); }

.qty-display {
  font-weight: 700;
  font-size: 1rem;
  min-width: 24px;
  text-align: center;
}

.btn-primary {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 18px;
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.btn-primary:hover {
  background: #ffd94d;
  box-shadow: 0 4px 18px rgba(245,200,66,0.3);
}
.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

.empty-msg {
  color: var(--muted);
  text-align: center;
  padding: 60px 0;
  font-size: 1.05rem;
}

/* ============ SELLER FORM ============ */
.seller-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 40px;
}

.seller-form-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  outline: none;
  resize: vertical;
  transition: border 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group select option { background: var(--surface2); }

.form-error {
  color: var(--red);
  font-size: 0.83rem;
  margin: 10px 0 4px;
  min-height: 18px;
}

.seller-form-card .btn-primary {
  width: auto;
  padding: 12px 34px;
  margin-top: 6px;
}

/* ============ SELLER LIST ============ */
.seller-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seller-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color 0.2s;
}
.seller-item:hover { border-color: var(--border); }

.seller-item-emoji {
  font-size: 2rem;
  width: 56px; height: 56px;
  background: var(--surface2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.seller-item-info { flex: 1; }
.seller-item-info h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}
.seller-item-info p {
  font-size: 0.82rem;
  color: var(--muted);
}

.seller-item-price {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.btn-remove {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
.btn-remove:hover { background: var(--red); color: #fff; }

/* ============ CART SIDEBAR ============ */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  backdrop-filter: blur(4px);
}
.cart-overlay.open { display: block; }

.cart-sidebar {
  position: fixed;
  top: 0; right: -400px;
  width: 380px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow);
}
.cart-sidebar.open { right: 0; }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.cart-header h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.cart-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.cart-close:hover { background: var(--red); border-color: var(--red); color: #fff; }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item-emoji {
  font-size: 1.8rem;
  width: 48px; height: 48px;
  background: var(--bg);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.cart-item-info { flex: 1; }
.cart-item-info h5 {
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.cart-item-info p { font-size: 0.78rem; color: var(--muted); }

.cart-item-subtotal {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  white-space: nowrap;
}

.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.cart-total {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.cart-total strong {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  color: var(--text);
}

.cart-footer .btn-primary { font-size: 1rem; padding: 14px; }

.empty-cart {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--green);
  color: #0d0d0d;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: 50px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(62,207,142,0.35);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.4s;
  opacity: 0;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============ ORDERS ============ */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.order-id {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.order-status {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 50px;
  background: rgba(62,207,142,0.15);
  color: var(--green);
  border: 1px solid rgba(62,207,142,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--muted);
}
.order-item-row span:first-child { color: var(--text); }

.order-total {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  text-align: right;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ============ FOOTER ============ */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .navbar { padding: 14px 20px; }
  .hero { flex-direction: column; padding: 40px 20px; gap: 30px; }
  .section { padding: 36px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .cart-sidebar { width: 100%; right: -100%; }
  .hero-art { justify-content: center; }
  .section-header { flex-direction: column; align-items: flex-start; }
}