/* =====================================================
   ENLAÇA — design tokens
   Canvas escuro "dusk", acento âmbar + periwinkle,
   Space Grotesk (display) + Inter (corpo)
===================================================== */
:root {
  --bg: #161320;
  --surface: #1F1B2E;
  --surface-2: #262138;
  --border: #322C46;
  --text: #F2EFEA;
  --text-muted: #9992AC;
  --accent: #FFB84D;
  --accent-ink: #1A1508;
  --accent-2: #8EA7FF;
  --danger: #FF6B6B;
  --success: #6BCB77;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }

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

button { font-family: inherit; cursor: pointer; }
input, textarea {
  font-family: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
input:focus, textarea:focus { border-color: var(--accent-2); }
textarea { resize: vertical; font-family: inherit; }

/* ---------- Botões ---------- */
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  transition: transform .12s ease, filter .12s ease;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  transition: border-color .15s ease, background .15s ease;
}
.btn-secondary:hover { border-color: var(--accent-2); background: var(--surface-2); }

.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon {
  background: none; border: none; font-size: 20px; color: var(--text-muted);
  display: inline-flex; align-items: center; padding: 6px; border-radius: 8px;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-remove-img {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%; width: 26px; height: 26px; font-size: 16px; line-height: 1;
}

/* ---------- Avatares ---------- */
.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 2px solid var(--border); }
.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 46px; height: 46px; }
.avatar-lg { width: 96px; height: 96px; border-width: 3px; border-color: var(--bg); }

/* =====================================================
   TELA DE AUTENTICAÇÃO
===================================================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,184,77,0.10), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(142,167,255,0.12), transparent 40%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand-mark { color: var(--accent); font-size: 28px; }
.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 4px 0 2px;
  letter-spacing: -0.5px;
}
.auth-brand p { color: var(--text-muted); margin: 0; font-size: 13px; }

.auth-tabs { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; border: none; background: none; color: var(--text-muted);
  padding: 9px; border-radius: 999px; font-weight: 600; font-size: 13px;
  transition: background .15s ease, color .15s ease;
}
.auth-tab.active { background: var(--accent); color: var(--accent-ink); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.form-error { color: var(--danger); font-size: 13px; margin: -6px 0 0; min-height: 16px; }

/* =====================================================
   APP PRINCIPAL
===================================================== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: rgba(22,19,32,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  white-space: nowrap;
}
.topbar-search { position: relative; flex: 1; max-width: 360px; }
.topbar-search input { width: 100%; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 320px; overflow-y: auto; box-shadow: var(--shadow); z-index: 30;
}
.search-result-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
}
.search-result-item:hover { background: var(--surface-2); }
.search-result-item .name { font-weight: 600; font-size: 13px; }
.search-result-item .username { color: var(--text-muted); font-size: 12px; }

.topbar-nav { display: flex; gap: 6px; margin-left: auto; }
.nav-link {
  background: none; border: none; color: var(--text-muted); font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 999px; transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { color: var(--accent); }
.nav-logout { color: var(--danger); }

.main { max-width: 640px; margin: 0 auto; padding: 24px 16px 80px; }
.view { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Composer ---------- */
.composer {
  display: flex; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 20px;
}
.composer-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.composer-body textarea {
  width: 100%; min-height: 60px; border: none; background: none; padding: 6px 0; font-size: 15px;
}
.composer-body textarea:focus { border: none; }
.composer-preview-wrap { position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.composer-preview { width: 100%; max-height: 280px; object-fit: cover; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Feed / Posts ---------- */
.feed-list { display: flex; flex-direction: column; gap: 14px; }
.post-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; animation: fadeIn .3s ease;
}
.post-header { display: flex; gap: 10px; align-items: center; }
.post-header-meta { display: flex; flex-direction: column; }
.post-author { font-weight: 700; font-size: 14px; cursor: pointer; }
.post-author:hover { color: var(--accent-2); }
.post-time { color: var(--text-muted); font-size: 12px; }
.post-delete { margin-left: auto; background: none; border: none; color: var(--text-muted); font-size: 16px; }
.post-delete:hover { color: var(--danger); }
.post-content { margin: 12px 0; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.post-image { border-radius: var(--radius-sm); margin-bottom: 6px; width: 100%; max-height: 460px; object-fit: cover; }
.post-actions { display: flex; gap: 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.post-action {
  display: flex; align-items: center; gap: 6px; background: none; border: none;
  color: var(--text-muted); font-size: 13px; font-weight: 600; padding: 4px;
  transition: color .15s ease;
}
.post-action:hover { color: var(--text); }
.post-action.liked { color: var(--accent); }
.post-action .icon { font-size: 16px; transition: transform .15s ease; }
.post-action.liked .icon { animation: pop .28s ease; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ---------- Perfil ---------- */
.profile-cover {
  height: 140px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(120deg, rgba(255,184,77,0.35), rgba(142,167,255,0.35));
}
.profile-header { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.profile-info { display: flex; gap: 16px; padding: 0 20px 18px; margin-top: -40px; align-items: flex-end; flex-wrap: wrap; }
.profile-meta { flex: 1; min-width: 200px; }
.profile-meta h2 { font-family: var(--font-display); margin: 8px 0 0; }
.profile-meta p { margin: 4px 0; font-size: 14px; }
.profile-stats { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.profile-stats strong { color: var(--text); }
.profile-actions { display: flex; gap: 8px; padding-top: 12px; }

/* ---------- Modais ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(10,8,16,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 440px; max-height: 85vh; overflow-y: auto; position: relative;
  box-shadow: var(--shadow);
}
.modal-content h3 { font-family: var(--font-display); margin-top: 0; }
.modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--text-muted); font-size: 22px; line-height: 1;
}
.modal-close:hover { color: var(--text); }

#edit-profile-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
#edit-profile-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-muted); font-weight: 600; }

.comments-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; max-height: 320px; overflow-y: auto; }
.comment-item { display: flex; gap: 10px; }
.comment-bubble { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13.5px; }
.comment-author { font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 200; animation: toastIn .25s ease;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Responsivo ---------- */
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 10px 14px; }
  .topbar-brand { display: none; }
  .topbar-nav { gap: 2px; }
  .nav-link { padding: 8px 10px; font-size: 13px; }
  .main { padding: 16px 10px 70px; }
  .profile-info { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
