/* ============================================================
   ChatMarket — assets/css/style.css
   Aesthetic: Dark editorial with amber gold accents
   ============================================================ */

:root {
  --bg:        #0d0d0f;
  --bg2:       #141417;
  --bg3:       #1c1c21;
  --border:    #2a2a32;
  --gold:      #e8a020;
  --gold2:     #f5c842;
  --text:      #e8e8ec;
  --muted:     #7a7a8c;
  --danger:    #e05c5c;
  --success:   #4ecb8d;
  --radius:    10px;
  --radius-lg: 18px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --shadow:    0 8px 32px rgba(0,0,0,0.45);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img { max-width: 100%; display: block; }

/* ── NAV ─────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  height: 62px;
  background: rgba(13,13,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 0.4rem;
}
.brand-icon { color: var(--gold); font-size: 1.1rem; }

.nav-links {
  display: flex; align-items: center; gap: 1.4rem;
}
.nav-links a { color: var(--muted); font-size: 0.9rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--text); }

.nav-avatar {
  display: flex; align-items: center; gap: 0.5rem;
}
.nav-avatar img {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--gold);
  color: #0d0d0f;
}
.btn-primary:hover { background: var(--gold2); color: #0d0d0f; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }
label {
  display: block;
  font-size: 0.82rem; font-weight: 600; letter-spacing: .04em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 0.4rem;
}
input[type=text], input[type=email], input[type=password],
textarea, select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem 1rem;
  outline: none;
  transition: border .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--gold);
}
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--bg3); }

.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 460px;
  margin: 4rem auto;
  box-shadow: var(--shadow);
}
.form-card h1 {
  font-family: var(--font-head);
  font-size: 1.8rem; font-weight: 800;
  margin-bottom: 0.3rem;
}
.form-card .subtitle {
  color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem;
}

.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
}
.alert-error { background: rgba(224,92,92,0.15); border: 1px solid var(--danger); color: #f0a0a0; }
.alert-success { background: rgba(78,203,141,0.12); border: 1px solid var(--success); color: #7ee8b4; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.container { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; }
main { flex: 1; }

.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}
.page-header h1 {
  font-family: var(--font-head);
  font-size: 2rem; font-weight: 800;
}
.page-header p { color: var(--muted); margin-top: 0.3rem; }

/* ── HERO ───────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(232,160,32,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(232,160,32,0.1);
  border: 1px solid rgba(232,160,32,0.3);
  color: var(--gold);
  font-size: 0.78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 0.35rem 1rem; border-radius: 999px;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800; line-height: 1.1;
  margin-bottom: 1.2rem;
  letter-spacing: -0.03em;
}
.hero h1 em {
  font-style: normal;
  color: var(--gold);
  position: relative;
}
.hero p {
  color: var(--muted);
  max-width: 540px; margin: 0 auto 2.5rem;
  font-size: 1.05rem;
}
.hero-cta { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* ── USER GRID ──────────────────────────────────────────── */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
  padding-bottom: 4rem;
}

.user-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.2rem;
  text-align: center;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  position: relative;
}
.user-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.user-card .avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  margin: 0 auto 1rem;
}
.user-card h3 {
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 700;
  margin-bottom: 0.2rem;
}
.user-card .handle { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.6rem; }
.user-card .bio-preview {
  color: var(--muted); font-size: 0.83rem;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 1rem; min-height: 2.5em;
}
.online-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 4px;
  box-shadow: 0 0 6px var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.badge-private {
  font-size: 0.72rem; background: rgba(122,122,140,0.2);
  border: 1px solid var(--border); color: var(--muted);
  padding: 0.15rem 0.55rem; border-radius: 999px;
}

/* ── PROFILE PAGE ───────────────────────────────────────── */
.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding-bottom: 4rem;
  align-items: start;
}
.profile-sidebar {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  position: sticky; top: 80px;
}
.profile-sidebar .avatar-lg {
  width: 110px; height: 110px;
  border-radius: 50%; object-fit: cover;
  border: 3px solid var(--gold);
  margin: 0 auto 1rem;
}
.profile-sidebar h2 {
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 800;
}
.profile-sidebar .username { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.8rem; }
.profile-sidebar .bio { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.4rem; text-align: left; }
.profile-meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.8rem; }

/* ── CHAT ───────────────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 62px);
  overflow: hidden;
}
.chat-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header {
  padding: 1.2rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-head);
  font-weight: 700; font-size: 1.1rem;
}
.conversation-list { overflow-y: auto; flex: 1; }
.conv-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
  text-decoration: none; color: var(--text);
}
.conv-item:hover, .conv-item.active { background: var(--bg3); }
.conv-item img {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.conv-item-info { flex: 1; min-width: 0; }
.conv-item-name { font-weight: 600; font-size: 0.9rem; }
.conv-item-preview {
  font-size: 0.8rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-item-time { font-size: 0.72rem; color: var(--muted); flex-shrink: 0; }
.unread-badge {
  background: var(--gold); color: #0d0d0f;
  font-size: 0.7rem; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* Chat Window */
.chat-window {
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.9rem 1.4rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-topbar img {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
}
.chat-topbar-info h3 { font-size: 0.95rem; font-weight: 700; }
.chat-topbar-info span { font-size: 0.78rem; color: var(--muted); }

.messages-area {
  flex: 1; overflow-y: auto;
  padding: 1.5rem 1.4rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.msg-row {
  display: flex; align-items: flex-end; gap: 0.6rem;
}
.msg-row.mine { flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.msg-bubble {
  max-width: 65%;
  padding: 0.65rem 1rem;
  border-radius: 16px;
  font-size: 0.9rem; line-height: 1.5;
  word-break: break-word;
}
.msg-row.mine .msg-bubble {
  background: var(--gold);
  color: #0d0d0f;
  border-bottom-right-radius: 4px;
}
.msg-row:not(.mine) .msg-bubble {
  background: var(--bg3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-bubble img.msg-img {
  max-width: 260px; border-radius: 10px;
  margin-top: 0.4rem; cursor: pointer;
}
.msg-time {
  font-size: 0.68rem; color: var(--muted);
  text-align: right; margin-top: 0.2rem;
}
.msg-date-divider {
  text-align: center;
  font-size: 0.75rem; color: var(--muted);
  padding: 0.5rem 0;
}

/* Chat Input */
.chat-input-area {
  padding: 1rem 1.4rem;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-form-row {
  display: flex; align-items: flex-end; gap: 0.7rem;
}
.chat-form textarea {
  flex: 1; min-height: 44px; max-height: 120px;
  resize: none; line-height: 1.4;
  padding: 0.6rem 1rem;
  border-radius: 22px;
}
.attach-btn, .send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  transition: all .2s;
}
.attach-btn { background: var(--bg3); color: var(--muted); border: 1px solid var(--border); }
.attach-btn:hover { color: var(--gold); border-color: var(--gold); background: rgba(232,160,32,0.08); }
.send-btn { background: var(--gold); color: #0d0d0f; }
.send-btn:hover { background: var(--gold2); transform: scale(1.06); }
.send-btn:disabled { opacity: .5; transform: none; cursor: not-allowed; }

/* Image preview strip above input */
.img-preview-wrap {
  display: none; align-items: center; gap: 0.75rem;
  margin-bottom: 0.65rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}
.img-preview-wrap img {
  height: 52px; width: 52px;
  object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border);
}
.preview-label { font-size: 0.82rem; color: var(--muted); flex: 1; }
.img-preview-wrap.show { display: flex; }
#remove-preview {
  background: none; border: none; cursor: pointer;
  color: var(--danger); font-size: 1rem; padding: 0 0.2rem;
  line-height: 1; transition: opacity .15s;
}
#remove-preview:hover { opacity: .7; }

.chat-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--muted); gap: 0.5rem;
}
.chat-empty .big-icon { font-size: 3rem; opacity: .3; }

/* ── SETTINGS / EDIT PROFILE ────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding-bottom: 4rem;
  align-items: start;
}
.settings-nav {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky; top: 80px;
}
.settings-nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.2rem;
  color: var(--muted); font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.settings-nav a:hover, .settings-nav a.active {
  background: var(--bg3); color: var(--text);
}
.settings-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.settings-card h2 {
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 800;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.avatar-upload-wrap {
  display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem;
}
.avatar-upload-wrap img {
  width: 80px; height: 80px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--gold);
}

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 1.2rem 2rem;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1180px; margin: 0 auto;
  font-size: 0.82rem; color: var(--muted);
}

/* ── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
.modal-overlay.open { display: flex; }
.modal {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-width: 90vw; max-height: 90vh;
  overflow: auto;
  cursor: default;
}
.modal .modal-img { max-width: 100%; max-height: 80vh; border-radius: var(--radius); display: block; }
.modal-close {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: rgba(0,0,0,0.5); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 0.9rem; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--danger); }

/* ── TOASTS ─────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.88rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(12px);
  transition: opacity .3s, transform .3s;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error   { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #0d0d0f; }
.toast-info    { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .profile-layout, .settings-layout { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .chat-sidebar.show { display: flex; position: fixed; inset: 62px 0 0; z-index: 50; }
  .topnav { padding: 0 1rem; }
}

/* ── SEARCH BAR ─────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 0.6rem; margin-bottom: 2rem;
}
.search-bar input { border-radius: 999px; }
.search-bar .btn { border-radius: 999px; white-space: nowrap; }

/* ── UTILITIES ──────────────────────────────────────────── */
.text-muted { color: var(--muted); }
.text-gold { color: var(--gold); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
