/* PixieHaul Marketplace - Design System */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --midnight: #0a0e1a;
  --deep: #111832;
  --navy: #1a2342;
  --navy-light: #1f2a4f;
  --gold: #d4a853;
  --gold-light: #f0d48a;
  --gold-dim: rgba(212, 168, 83, 0.15);
  --purple: #8b5cf6;
  --purple-soft: #a78bfa;
  --purple-dim: rgba(139, 92, 246, 0.15);
  --dust: #e8dff0;
  --white: #f4f0fb;
  --text: #c8c2d6;
  --text-bright: #eee8f5;
  --danger: #ef4444;
  --success: #22c55e;
  --border: rgba(139, 92, 246, 0.12);
  --border-hover: rgba(212, 168, 83, 0.3);
  --card-bg: linear-gradient(145deg, rgba(17, 24, 50, 0.8), rgba(10, 14, 26, 0.9));
  --input-bg: rgba(17, 24, 50, 0.6);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--midnight);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: 'Outfit', sans-serif; color: var(--text-bright); }

a { color: var(--purple-soft); text-decoration: none; }
a:hover { color: var(--gold); }

/* Ambient glow */
.glow-orb { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; }
.glow-1 { width: 600px; height: 600px; background: rgba(139, 92, 246, 0.08); top: -200px; left: -200px; }
.glow-2 { width: 500px; height: 500px; background: rgba(212, 168, 83, 0.06); top: 40%; right: -200px; }

/* Navigation */
.app-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0.8rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-left { display: flex; align-items: center; gap: 2rem; }
.nav-right { display: flex; align-items: center; gap: 1rem; }

.logo {
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.4rem;
  color: var(--white); letter-spacing: -0.5px; cursor: pointer;
}
.logo span { color: var(--gold); }

.nav-links { display: flex; gap: 0.5rem; }
.nav-link {
  padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem;
  color: var(--text); cursor: pointer; transition: all 0.2s;
  background: transparent; border: none; font-family: 'DM Sans', sans-serif;
}
.nav-link:hover { color: var(--text-bright); background: var(--purple-dim); }
.nav-link.active { color: var(--gold); background: var(--gold-dim); }

.nav-badge {
  background: var(--danger); color: #fff; font-size: 0.7rem;
  padding: 0.1rem 0.4rem; border-radius: 10px; margin-left: 0.3rem;
  font-weight: 600;
}

/* Hamburger button (hidden on desktop) */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px; cursor: pointer;
  background: transparent; border: none; padding: 4px; flex-shrink: 0;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-bright); border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile full-screen menu overlay */
.mobile-menu {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 14, 26, 0.98);
  backdrop-filter: blur(20px);
  z-index: 200;
  flex-direction: column;
  padding: 4.5rem 1.5rem 2rem;
  gap: 0.25rem;
  overflow-y: auto;
}
.mobile-menu.open { display: flex; }
.mobile-menu-close {
  position: absolute; top: 0.9rem; right: 1.25rem;
  background: transparent; border: none; color: var(--text);
  font-size: 2rem; cursor: pointer; padding: 0.4rem; line-height: 1;
}
.mobile-menu-logo {
  position: absolute; top: 1rem; left: 1.5rem;
  font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.4rem;
  color: var(--white); letter-spacing: -0.5px;
}
.mobile-menu-logo span { color: var(--gold); }
.mobile-menu-link {
  width: 100%; padding: 0.9rem 1.1rem; border-radius: 10px;
  font-size: 1rem; color: var(--text); cursor: pointer;
  background: transparent; border: none;
  font-family: 'DM Sans', sans-serif; text-align: left;
  transition: all 0.2s;
}
.mobile-menu-link:hover { color: var(--text-bright); background: var(--purple-dim); }
.mobile-menu-link.active { color: var(--gold); background: var(--gold-dim); }
.mobile-menu-divider {
  height: 1px; background: var(--border); margin: 0.5rem 0;
}
.mobile-menu-user {
  font-size: 0.85rem; color: var(--text); padding: 0.5rem 1.1rem;
  opacity: 0.7;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem; border-radius: 10px; font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  cursor: pointer; transition: all 0.2s; border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--midnight); font-weight: 600;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3); }

.btn-secondary {
  background: var(--purple-dim); color: var(--purple-soft);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.btn-secondary:hover { border-color: var(--purple-soft); }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--border-hover); color: var(--text-bright); }

.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }

/* Layout */
.app-content {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 5rem 2rem 2rem;
  min-height: 100vh;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}

.page-header h1 { font-size: 2rem; font-weight: 700; letter-spacing: -1px; }

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 1.5rem;
  transition: all 0.3s;
}
.card:hover { border-color: var(--border-hover); }
.card-clickable { cursor: pointer; }
.card-clickable:hover { transform: translateY(-2px); }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: 0.85rem; font-weight: 500;
  color: var(--text-bright); margin-bottom: 0.4rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 0.7rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-bright);
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--purple);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { appearance: none; cursor: pointer; }
.form-hint { font-size: 0.8rem; color: var(--text); margin-top: 0.3rem; }

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

/* Listing Card */
.listing-card { overflow: hidden; padding: 0; }
.listing-card-img {
  width: 100%; height: 200px; object-fit: cover;
  background: var(--deep);
}
.listing-card-placeholder {
  width: 100%; height: 200px; display: flex; align-items: center; justify-content: center;
  background: var(--deep); color: var(--text); font-size: 3rem;
}
.listing-card-body { padding: 1rem 1.25rem; }
.listing-card-title {
  font-size: 1rem; font-weight: 600; color: var(--text-bright);
  margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.listing-card-price {
  font-family: 'Outfit', sans-serif; font-size: 1.3rem; font-weight: 700;
  color: var(--gold); margin-bottom: 0.5rem;
}
.listing-card-meta {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}

/* Tags/Badges */
.tag {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 6px; font-size: 0.75rem; font-weight: 500;
}
.tag-category { background: rgba(139, 92, 246, 0.15); color: var(--purple-soft); }
.tag-size { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tag-ship { background: var(--gold-dim); color: var(--gold); }
.tag-local { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.tag-pickup { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* Filters */
.filters-bar {
  display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap;
  align-items: center;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-input-wrap input {
  width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-bright);
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
}
.search-input-wrap input:focus { outline: none; border-color: var(--purple); }
.search-icon {
  position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%);
  color: var(--text); font-size: 0.9rem;
}
.filter-select {
  padding: 0.6rem 1rem; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-bright); font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--purple); }

/* Image Upload */
.image-upload-area {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 2rem; text-align: center; cursor: pointer;
  transition: all 0.2s;
}
.image-upload-area:hover { border-color: var(--gold); background: var(--gold-dim); }
.image-upload-area.dragover { border-color: var(--gold); background: var(--gold-dim); }

.image-previews {
  display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem;
}
.image-preview {
  position: relative; width: 100px; height: 100px;
  border-radius: 8px; overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-remove {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.7); color: #fff;
  border: none; border-radius: 50%; width: 22px; height: 22px;
  cursor: pointer; font-size: 0.7rem; display: flex;
  align-items: center; justify-content: center;
}

/* Listing Detail */
.listing-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.listing-gallery { display: flex; flex-direction: column; gap: 0.75rem; }
.listing-main-image {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 12px; background: var(--deep);
}
.listing-main-placeholder {
  width: 100%; aspect-ratio: 4/3; display: flex;
  align-items: center; justify-content: center;
  background: var(--deep); border-radius: 12px;
  font-size: 5rem; color: var(--text);
}
.listing-thumbs { display: flex; gap: 0.5rem; overflow-x: auto; }
.listing-thumb {
  width: 70px; height: 70px; object-fit: cover;
  border-radius: 8px; cursor: pointer; border: 2px solid transparent;
  transition: border-color 0.2s; flex-shrink: 0;
}
.listing-thumb.active { border-color: var(--gold); }

.listing-info h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.listing-price {
  font-family: 'Outfit', sans-serif; font-size: 2.5rem;
  font-weight: 800; color: var(--gold); margin-bottom: 1rem;
}
.listing-meta-row {
  display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.listing-description {
  font-size: 0.95rem; line-height: 1.8; color: var(--text);
  margin-bottom: 1.5rem; white-space: pre-wrap;
}
.listing-seller {
  padding: 1rem; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 1.5rem;
}
.listing-seller-name { font-weight: 600; color: var(--text-bright); }
.listing-seller-since { font-size: 0.8rem; color: var(--text); }

/* Messages */
.messages-layout { display: grid; grid-template-columns: 350px 1fr; gap: 1.5rem; min-height: 70vh; }
.conversations-list {
  display: flex; flex-direction: column; gap: 0.5rem;
  overflow-y: auto; max-height: 70vh;
}
.conversation-item {
  padding: 1rem; border-radius: 12px; cursor: pointer;
  background: var(--input-bg); border: 1px solid var(--border);
  transition: all 0.2s;
}
.conversation-item:hover { border-color: var(--border-hover); }
.conversation-item.active { border-color: var(--gold); background: var(--gold-dim); }
.conversation-title { font-weight: 600; color: var(--text-bright); font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-preview { font-size: 0.8rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.2rem; }
.conversation-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.3rem; }
.conversation-time { font-size: 0.75rem; color: var(--text); }

.chat-area {
  display: flex; flex-direction: column;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.chat-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-header h3 { font-size: 1rem; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  min-height: 400px; max-height: 55vh;
}
.message-bubble { max-width: 70%; padding: 0.7rem 1rem; border-radius: 12px; font-size: 0.9rem; }
.message-mine { align-self: flex-end; background: var(--purple-dim); color: var(--text-bright); border-bottom-right-radius: 4px; }
.message-theirs { align-self: flex-start; background: var(--deep); color: var(--text-bright); border-bottom-left-radius: 4px; }
.message-time { font-size: 0.7rem; color: var(--text); margin-top: 0.2rem; }
.message-sender { font-size: 0.75rem; color: var(--purple-soft); margin-bottom: 0.2rem; }

.chat-input-area {
  padding: 0.75rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem;
}
.chat-input {
  flex: 1; padding: 0.6rem 1rem;
  background: var(--midnight); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-bright);
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
}
.chat-input:focus { outline: none; border-color: var(--purple); }

/* Auth Page */
.auth-container {
  max-width: 400px; margin: 4rem auto;
}
.auth-card { padding: 2rem; }
.auth-title { font-size: 1.5rem; text-align: center; margin-bottom: 0.5rem; }
.auth-subtitle { text-align: center; color: var(--text); margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-toggle { text-align: center; margin-top: 1rem; font-size: 0.9rem; }
.auth-toggle a { cursor: pointer; color: var(--gold); }

/* Empty States */
.empty-state {
  text-align: center; padding: 4rem 2rem;
}
.empty-state-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text); max-width: 400px; margin: 0 auto; }

/* Loading */
.loading { text-align: center; padding: 3rem; color: var(--text); }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; top: 5rem; right: 2rem; z-index: 1000;
  padding: 0.75rem 1.25rem; border-radius: 10px;
  font-size: 0.9rem; animation: slideIn 0.3s ease;
}
.toast-success { background: rgba(34, 197, 94, 0.15); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.toast-error { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.toast-info { background: rgba(99, 102, 241, 0.12); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsive */
@media (max-width: 900px) {
  .listing-detail { grid-template-columns: 1fr; }
  .messages-layout { grid-template-columns: 1fr; }
  .conversations-list { max-height: 300px; }
  .app-nav { padding: 0.6rem 1rem; }
  .nav-links { gap: 0.25rem; }
  .nav-link { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-right { display: none; }
  .hamburger { display: flex; }
}
@media (max-width: 600px) {
  .app-content { padding: 4.5rem 1rem 1rem; }
  .listings-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.5rem; }
}

/* Favourite / Heart Button */
.fav-btn {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
  background: rgba(15, 15, 30, 0.75); border: none; cursor: pointer;
  border-radius: 50%; width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: transform 0.15s ease, background 0.15s ease;
  backdrop-filter: blur(4px);
}
.fav-btn:hover { transform: scale(1.15); background: rgba(15, 15, 30, 0.9); }
.fav-btn.fav-active { background: rgba(239, 68, 68, 0.15); }

/* Share button on listing cards */
.share-card-btn {
  position: absolute; bottom: 0.6rem; right: 0.6rem; z-index: 2;
  background: rgba(15, 15, 30, 0.75); border: none; cursor: pointer;
  border-radius: 50%; width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: transform 0.15s ease, background 0.15s ease;
  backdrop-filter: blur(4px); color: var(--text);
}
.share-card-btn:hover { transform: scale(1.15); background: rgba(15, 15, 30, 0.9); color: var(--gold); }

/* Sold/Unavailable overlay on listing cards */
.listing-sold-overlay {
  position: absolute; top: 0.6rem; left: 0.6rem; z-index: 2;
}
.listing-sold-overlay span {
  background: rgba(239, 68, 68, 0.85); color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.5rem;
  border-radius: 6px; letter-spacing: 0.05em; text-transform: uppercase;
}

/* Favourite detail button */
.fav-detail-btn { min-width: 130px; }
.fav-detail-btn.fav-active { border-color: var(--danger,#f87171); color: var(--danger,#f87171); }

/* ==================== WALLET PAGE ==================== */
.wallet-balance-card {
  background: linear-gradient(135deg, #1a1242 0%, #2a1a5e 50%, #1a2b42 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 20px; padding: 32px; margin-bottom: 28px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(139, 92, 246, 0.15);
}
.wallet-balance-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text); opacity: 0.7; margin-bottom: 8px; }
.wallet-balance-amount {
  font-family: 'Outfit', sans-serif; font-size: 3rem; font-weight: 800;
  color: var(--gold); line-height: 1; margin-bottom: 20px;
  text-shadow: 0 2px 20px rgba(212, 168, 83, 0.4);
}

.wallet-section { margin-bottom: 32px; }
.wallet-section-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; color: var(--text-bright); }
.wallet-section-desc { font-size: 0.88rem; color: var(--text); opacity: 0.7; margin-bottom: 16px; }

.wallet-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 560px) { .wallet-steps { grid-template-columns: 1fr; } }

.wallet-step {
  background: rgba(17, 24, 50, 0.7); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 14px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.wallet-step:hover { border-color: rgba(139, 92, 246, 0.4); transform: translateY(-2px); }
.wallet-step.done { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.05); cursor: default; }
.wallet-step:not(.done) { border-color: rgba(212, 168, 83, 0.25); }
.wallet-step-icon { font-size: 1.8rem; margin-bottom: 8px; }
.wallet-step-label { font-size: 0.85rem; font-weight: 600; color: var(--text-bright); margin-bottom: 6px; }
.wallet-step-action { font-size: 0.78rem; color: var(--gold); }

.wallet-panel {
  background: rgba(17, 24, 50, 0.8); border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px; padding: 24px; margin-bottom: 24px;
}
.wallet-panel-header {
  font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700;
  color: var(--text-bright); margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

.wallet-alert {
  padding: 12px 16px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 16px;
}
.wallet-alert-info { background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.3); color: var(--dust); }
.wallet-alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #86efac; }

/* Withdrawal status badges */
.status-badge { font-size: 0.75rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.status-processing { background: rgba(212, 168, 83, 0.2); color: var(--gold); }
.status-completed { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.status-pending { background: rgba(139, 92, 246, 0.15); color: var(--purple-soft); }
.status-failed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* bg-subtle for code blocks */
.bg-subtle { --bg-subtle: rgba(10, 14, 26, 0.8); }
code { background: rgba(10, 14, 26, 0.8); padding: 4px 8px; border-radius: 6px; font-family: monospace; }
