/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0f;
  --bg2: #141417;
  --bg3: #1c1c21;
  --border: #2a2a32;
  --accent: #e8ff47;
  --accent2: #ff6b35;
  --text: #f0f0f5;
  --text2: #9090a8;
  --card-bg: #18181d;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 32px rgba(0,0,0,0.5);
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --nav-h: 64px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ========== NAVBAR ========== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 999;
  height: var(--nav-h);
  background: rgba(13,13,15,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -1px;
  color: var(--text);
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap;
}
.nav-links a {
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg3); }
.nav-links .discord-btn {
  background: #5865F2;
  color: #fff !important;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 17px;
}
.nav-links .discord-btn:hover { background: #4752c4; }

.burger {
  display: none;
  background: none; border: 1px solid var(--border);
  color: var(--text); padding: 8px 11px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
}

/* ========== HERO ========== */
.hero {
  position: relative;
  min-height: 360px;
  display: flex; align-items: center; justify-content: center;
  margin-top: var(--nav-h);
  overflow: hidden;
  text-align: center;
  padding: 60px 24px;
}
.hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(232,255,71,0.12) 0%, transparent 60%),
              linear-gradient(180deg, #0d0d0f 0%, #141417 100%);
}
.hero-bg::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.02'%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");
}
.hero-content { position: relative; z-index: 1; }
.hero-content h1 {
  font-family: var(--font-head);
  font-size: clamp(42px, 8vw, 80px);
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  margin-bottom: 16px;
}
.hero-content h1 span { color: var(--accent); }
.hero-content p {
  font-size: clamp(15px, 2.5vw, 18px);
  color: var(--text2);
  margin-bottom: 32px;
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: #0d0d0f;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: 50px;
  border: none; cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.btn-primary:hover { background: #d4eb00; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,255,71,0.25); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: 50px;
  border: 1px solid var(--border); cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,60,60,0.12);
  color: #ff6b6b;
  font-size: 13px; font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,60,60,0.2); cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(255,60,60,0.22); }

/* ========== FILTERS ========== */
.filters-section {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
}
.filters-container {
  max-width: 1100px; margin: 0 auto;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
}
.filter-group {
  display: flex; flex-direction: column; gap: 6px;
  flex: 1; min-width: 160px;
}
.filter-group label {
  font-size: 12px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-group select,
.filter-group input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.filter-group select:focus,
.filter-group input:focus { border-color: var(--accent); }

.btn-filter {
  background: var(--accent); color: #0d0d0f;
  border: none; cursor: pointer;
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-family: var(--font-head); font-weight: 700; font-size: 14px;
  transition: all 0.2s; white-space: nowrap;
  align-self: flex-end;
}
.btn-filter:hover { background: #d4eb00; }

/* ========== LISTINGS ========== */
.listings-section {
  max-width: 1100px; margin: 0 auto;
  padding: 40px 24px;
}
.listings-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
}
.listings-header h2 {
  font-family: var(--font-head);
  font-size: 26px; font-weight: 700;
}
.count-badge {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 50px; font-size: 13px;
}

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

.loading-spinner {
  grid-column: 1/-1;
  text-align: center; color: var(--text2);
  padding: 60px; font-size: 16px;
}

/* ========== LISTING CARD ========== */
.listing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.listing-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.card-img {
  width: 100%; height: 180px;
  object-fit: cover;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 40px;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title {
  font-family: var(--font-head);
  font-size: 16px; font-weight: 700;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: 13px; color: var(--text2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}
.card-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 4px;
}
.tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2); font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 50px;
  display: flex; align-items: center; gap: 4px;
}
.tag.accent { border-color: rgba(232,255,71,0.3); color: var(--accent); background: rgba(232,255,71,0.07); }
.card-price {
  font-family: var(--font-head);
  font-size: 20px; font-weight: 800;
  color: var(--accent);
  margin-top: 4px;
}
.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-date { font-size: 12px; color: var(--text2); }
.card-contact-btn {
  background: var(--accent); color: #0d0d0f;
  border: none; cursor: pointer;
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-family: var(--font-head); font-weight: 700; font-size: 13px;
  transition: all 0.2s;
}
.card-contact-btn:hover { background: #d4eb00; }
.card-contact-btn.locked {
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border);
  cursor: not-allowed;
}

/* ========== MODAL ========== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  padding: 32px;
  position: relative;
}
.modal h2 {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 800; margin-bottom: 20px;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--text); background: var(--border); }

/* ========== FORMS ========== */
.form-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 12px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color 0.2s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 100px; resize: vertical; }

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

/* ========== CHAT ========== */
.chat-container {
  display: flex; flex-direction: column;
  height: 420px;
}
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.chat-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.mine {
  background: var(--accent); color: #0d0d0f;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.theirs {
  background: var(--bg3); color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}
.chat-msg .msg-meta { font-size: 11px; margin-top: 4px; opacity: 0.6; }
.chat-input-row {
  display: flex; gap: 8px;
}
.chat-input-row input {
  flex: 1;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-input-row button {
  background: var(--accent); color: #0d0d0f;
  border: none; cursor: pointer; padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 16px; transition: all 0.2s;
}
.chat-input-row button:hover { background: #d4eb00; }

/* ========== DISCORD FAB ========== */
.discord-fab {
  position: fixed; bottom: 28px; right: 24px; z-index: 900;
  background: #5865F2;
  color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-radius: 50px;
  box-shadow: 0 8px 32px rgba(88,101,242,0.4);
  font-family: var(--font-head); font-weight: 700; font-size: 14px;
  transition: all 0.25s;
  text-decoration: none;
}
.discord-fab:hover {
  background: #4752c4;
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(88,101,242,0.5);
}
.discord-fab i { font-size: 20px; }

/* ========== FOOTER ========== */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer p { font-size: 13px; color: var(--text2); }
.discord-link {
  display: flex; align-items: center; gap: 8px;
  color: #5865F2; font-weight: 600; font-size: 14px;
  transition: opacity 0.2s;
}
.discord-link:hover { opacity: 0.8; }

/* ========== PAGE: ADD / EDIT LISTING ========== */
.page-wrapper {
  max-width: 700px; margin: 0 auto;
  padding: calc(var(--nav-h) + 40px) 24px 60px;
}
.page-header {
  margin-bottom: 32px;
}
.page-header h1 {
  font-family: var(--font-head);
  font-size: 32px; font-weight: 800; margin-bottom: 6px;
}
.page-header p { color: var(--text2); }

.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

/* ========== PAGE: LOGIN / REGISTER ========== */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%; max-width: 420px;
}
.auth-logo {
  font-family: var(--font-head);
  font-size: 28px; font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 28px;
  display: block;
}
.auth-logo span { color: var(--accent); }
.auth-title {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700; margin-bottom: 24px;
}
.auth-switch { font-size: 13px; color: var(--text2); margin-top: 16px; text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-error {
  background: rgba(255,60,60,0.1);
  border: 1px solid rgba(255,60,60,0.3);
  color: #ff8080; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px;
  margin-bottom: 16px; display: none;
}

/* ========== ADMIN PANEL ========== */
.admin-wrapper {
  max-width: 1100px; margin: 0 auto;
  padding: calc(var(--nav-h) + 40px) 24px 60px;
}
.admin-header {
  margin-bottom: 32px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.admin-header h1 { font-family: var(--font-head); font-size: 30px; font-weight: 800; }
.admin-tabs {
  display: flex; gap: 8px; margin-bottom: 28px; flex-wrap: wrap;
}
.admin-tab {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 10px 20px;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-head); font-weight: 600; font-size: 14px;
  transition: all 0.2s;
}
.admin-tab.active { background: var(--accent); color: #0d0d0f; border-color: var(--accent); }

.admin-table {
  width: 100%; border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.admin-table th {
  background: var(--bg3); color: var(--text2);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 16px; text-align: left;
}
.admin-table td {
  padding: 14px 16px; font-size: 14px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg3); }

.status-badge {
  padding: 3px 10px; border-radius: 50px; font-size: 12px; font-weight: 600;
}
.status-badge.active { background: rgba(100,220,100,0.15); color: #6fdc6f; border: 1px solid rgba(100,220,100,0.25); }
.status-badge.pending { background: rgba(255,200,50,0.15); color: #ffc832; border: 1px solid rgba(255,200,50,0.25); }

.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== LISTING DETAIL ========== */
.detail-wrapper {
  max-width: 900px; margin: 0 auto;
  padding: calc(var(--nav-h) + 40px) 24px 60px;
}
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; }
.detail-main { display: flex; flex-direction: column; gap: 20px; }
.detail-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.detail-title {
  font-family: var(--font-head); font-size: 28px; font-weight: 800;
  margin-bottom: 12px; line-height: 1.2;
}
.detail-price {
  font-family: var(--font-head); font-size: 36px; font-weight: 800;
  color: var(--accent); margin-bottom: 16px;
}
.detail-desc { color: var(--text2); line-height: 1.7; white-space: pre-wrap; }
.detail-sidebar { display: flex; flex-direction: column; gap: 20px; }
.contact-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.contact-card h3 {
  font-family: var(--font-head); font-size: 16px; font-weight: 700; margin-bottom: 16px;
}
.contact-info { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.contact-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px;
}
.contact-row i { color: var(--accent); width: 16px; }
.locked-info {
  text-align: center; padding: 20px;
  color: var(--text2); font-size: 14px;
}
.locked-info i { font-size: 32px; margin-bottom: 10px; display: block; }
.locked-info a { color: var(--accent); font-weight: 600; }

/* ========== ALERT ========== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: rgba(100,220,100,0.1); border: 1px solid rgba(100,220,100,0.3); color: #6fdc6f; }
.alert-error { background: rgba(255,60,60,0.1); border: 1px solid rgba(255,60,60,0.3); color: #ff8080; }
.alert { display: none; }
.alert.show { display: flex; }

/* ========== IMG PREVIEW ========== */
.img-preview {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px;
}
.img-preview-item {
  width: 80px; height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden; position: relative;
  border: 1px solid var(--border);
}
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-item .remove-img {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,0.7); border: none; color: #fff;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  font-size: 10px; display: flex; align-items: center; justify-content: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .burger { display: flex; }
  .nav-links {
    display: none;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: 16px; flex-direction: column; gap: 4px;
    z-index: 998;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 16px; font-size: 16px; }

  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .admin-table { font-size: 13px; }
  .admin-table th, .admin-table td { padding: 10px 12px; }

  .footer-inner { flex-direction: column; text-align: center; }
  .discord-fab span { display: none; }
  .discord-fab { padding: 16px; border-radius: 50%; }
}

@media (max-width: 480px) {
  .modal { padding: 24px 20px; }
  .form-card { padding: 24px 20px; }
  .auth-card { padding: 32px 24px; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ========== TOAST ========== */
.toast-container {
  position: fixed; bottom: 88px; right: 24px; z-index: 3000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: 14px; min-width: 220px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid #6fdc6f; }
.toast.error { border-left: 3px solid #ff8080; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========== NO RESULTS ========== */
.no-results {
  grid-column: 1/-1; text-align: center; padding: 60px 20px;
  color: var(--text2);
}
.no-results i { font-size: 48px; margin-bottom: 16px; display: block; opacity: 0.4; }
.no-results h3 { font-family: var(--font-head); font-size: 20px; margin-bottom: 8px; color: var(--text); }
