@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg2: #f7f7f6;
  --bg3: #f0efed;
  --text: #111110;
  --text2: #6b6b68;
  --text3: #a0a09d;
  --border: rgba(0,0,0,0.09);
  --border2: rgba(0,0,0,0.18);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --radius: 10px;
  --radius-lg: 14px;
  --nav-bg: rgba(255,255,255,0.88);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

[data-theme="dark"] {
  --bg: #111110;
  --bg2: #1a1a19;
  --bg3: #222221;
  --text: #f5f5f4;
  --text2: #a8a8a5;
  --text3: #6b6b68;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.15);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59,130,246,0.12);
  --success-light: rgba(22,163,74,0.15);
  --danger-light: rgba(220,38,38,0.15);
  --nav-bg: rgba(17,17,16,0.88);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* GREY PATTERN BACKGROUND */
.pattern-bg {
  background-color: var(--bg2);
  background-image: radial-gradient(circle, var(--border2) 1px, transparent 1px);
  background-size: 24px 24px;
}

[data-theme="dark"] .pattern-bg {
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
}

a { color: inherit; text-decoration: none; }

/* ANIMATIONS */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes notifPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.anim-fade-up { animation: fadeUp 0.4s ease both; }
.anim-fade-up-1 { animation: fadeUp 0.4s 0.05s ease both; }
.anim-fade-up-2 { animation: fadeUp 0.4s 0.1s ease both; }
.anim-fade-up-3 { animation: fadeUp 0.4s 0.15s ease both; }
.anim-fade-up-4 { animation: fadeUp 0.4s 0.2s ease both; }
.anim-fade-in { animation: fadeIn 0.3s ease both; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 0.5px solid var(--border);
  transition: background 0.3s;
}
.nav-inner {
  max-width: 1040px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo { font-size: 16px; font-weight: 500; letter-spacing: -0.4px; flex-shrink: 0; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 20px; list-style: none; }
.nav-links a { font-size: 13px; color: var(--text2); transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-btns { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* DARK MODE TOGGLE */
.dark-toggle {
  width: 32px; height: 32px; border-radius: 8px;
  border: 0.5px solid var(--border2);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: background 0.15s;
  color: var(--text2);
}
.dark-toggle:hover { background: var(--bg2); }

/* NOTIFICATION BELL */
.notif-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 0.5px solid var(--border2);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: background 0.15s;
  color: var(--text2); position: relative;
}
.notif-btn:hover { background: var(--bg2); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%;
  border: 1.5px solid var(--bg);
  animation: notifPop 0.2s ease;
}

/* BUTTONS */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  padding: 8px 16px; border-radius: 8px;
  cursor: pointer; border: none;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn-lg { font-size: 14px; padding: 12px 24px; border-radius: 9px; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; border: 0.5px solid var(--border2); color: var(--text); }
.btn-ghost:hover { background: var(--bg2); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* FORMS */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field input, .field select, .field textarea {
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  width: 100%; padding: 10px 14px;
  border: 0.5px solid var(--border2); border-radius: 8px;
  outline: none; background: var(--bg); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.field textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.field-hint { font-size: 12px; color: var(--text3); margin-top: 5px; }

/* CARDS */
.card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

/* ALERTS */
.alert { font-size: 13px; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; display: none; }
.alert.show { display: block; animation: fadeIn 0.2s ease; }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }

/* BADGE & TAG */
.badge { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 500; display: inline-block; }
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-gray { background: var(--bg3); color: var(--text2); }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 20px; border: 0.5px solid var(--border); color: var(--text2); display: inline-block; transition: border-color 0.15s; }
.tag:hover { border-color: var(--border2); }

/* AVATAR */
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 500; flex-shrink: 0; }

/* DIVIDERS */
.divider { height: 0.5px; background: var(--border); margin: 24px 0; }
.divider-text { text-align: center; font-size: 12px; color: var(--text3); position: relative; margin: 20px 0; }
.divider-text::before, .divider-text::after { content: ''; position: absolute; top: 50%; width: 42%; height: 0.5px; background: var(--border); }
.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

/* PAGE */
.page { max-width: 1040px; margin: 0 auto; padding: 40px 24px; }
.page-center { min-height: calc(100vh - 57px); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }

/* SECTION LABEL */
.section-label { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 24px; }

/* FOOTER */
footer { border-top: 0.5px solid var(--border); padding: 28px 24px; }
.footer-inner { max-width: 1040px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-copy { font-size: 12px; color: var(--text3); }
.footer-links { display: flex; gap: 20px; list-style: none; flex-wrap: wrap; }
.footer-links a { font-size: 12px; color: var(--text3); transition: color 0.15s; }
.footer-links a:hover { color: var(--text2); }

/* SPINNER */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; }

/* NOTIFICATION DROPDOWN */
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; background: var(--bg);
  border: 0.5px solid var(--border2); border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 200; display: none; overflow: hidden;
  animation: fadeUp 0.2s ease;
}
.notif-dropdown.open { display: block; }
.notif-header { padding: 14px 16px; border-bottom: 0.5px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-header h3 { font-size: 13px; font-weight: 500; }
.notif-item { padding: 12px 16px; display: flex; gap: 10px; border-bottom: 0.5px solid var(--border); transition: background 0.15s; cursor: pointer; }
.notif-item:hover { background: var(--bg2); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-light); }
[data-theme="dark"] .notif-item.unread { background: rgba(59,130,246,0.08); }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.notif-text { font-size: 13px; line-height: 1.5; }
.notif-time { font-size: 11px; color: var(--text3); margin-top: 2px; }
.notif-empty { padding: 32px; text-align: center; color: var(--text3); font-size: 13px; }

/* CHAT */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 57px); overflow: hidden; }
.chat-sidebar { border-right: 0.5px solid var(--border); overflow-y: auto; }
.chat-sidebar-header { padding: 16px; border-bottom: 0.5px solid var(--border); font-size: 14px; font-weight: 500; }
.chat-item { padding: 12px 16px; display: flex; gap: 10px; cursor: pointer; transition: background 0.15s; border-bottom: 0.5px solid var(--border); }
.chat-item:hover, .chat-item.active { background: var(--bg2); }
.chat-item-name { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.chat-item-preview { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-time { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.chat-main { display: flex; flex-direction: column; }
.chat-header { padding: 16px 20px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 70%; }
.msg-out { align-self: flex-end; }
.msg-in { align-self: flex-start; }
.msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.msg-out .msg-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-in .msg-bubble { background: var(--bg2); color: var(--text); border-bottom-left-radius: 4px; }
.msg-time { font-size: 11px; color: var(--text3); margin-top: 4px; text-align: right; }
.msg-in .msg-time { text-align: left; }
.chat-input-area { padding: 16px 20px; border-top: 0.5px solid var(--border); display: flex; gap: 10px; }
.chat-input {
  flex: 1; font-family: 'DM Sans', sans-serif; font-size: 14px;
  padding: 10px 14px; border: 0.5px solid var(--border2);
  border-radius: 20px; outline: none; background: var(--bg); color: var(--text);
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 14px; }

/* TOGGLE SWITCH */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 0.5px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-desc { font-size: 12px; color: var(--text2); margin-top: 2px; }
.toggle {
  width: 40px; height: 22px; background: var(--bg3);
  border-radius: 11px; position: relative; cursor: pointer;
  border: 0.5px solid var(--border2); transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: white;
  border-radius: 50%; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(18px); }

/* PRICE TYPE PILLS */
.price-types { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.price-type-btn {
  font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: 20px; cursor: pointer;
  border: 0.5px solid var(--border2); background: transparent; color: var(--text2);
  transition: all 0.15s;
}
.price-type-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.price-type-btn:hover:not(.active) { border-color: var(--text3); color: var(--text); }

/* POST CARDS */
.post-card {
  border: 0.5px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: all 0.2s; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}
.post-card:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(37,99,235,0.08); transform: translateY(-2px); }

/* ANON BADGE */
.anon-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 3px 9px; border-radius: 20px; background: var(--bg3); color: var(--text3); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .hide-mobile { display: none; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
}
