/* ============================================
   PRISMA 2 — Design System
   Aesthetic: Dark editorial / code culture
   ============================================ */

:root {
  --bg: #0d0d10;
  --bg2: #13131a;
  --bg3: #1a1a24;
  --border: #2a2a38;
  --accent: #7c6af7;
  --accent2: #a78bfa;
  --accent3: #34d399;
  --text: #e2e2ef;
  --text2: #9494b0;
  --text3: #5a5a72;
  --danger: #f87171;
  --warn: #fbbf24;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --nav-h: 58px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; border-radius: var(--radius-sm); }

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

.nav-logo {
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700;
  color: var(--accent2); letter-spacing: -0.5px; white-space: nowrap;
}

.nav-search-wrapper { flex: 1; max-width: 480px; }

.search-bar {
  position: relative;
  display: flex; align-items: center;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 24px; overflow: visible;
  transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--accent); }

.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-sans); font-size: .9rem;
  padding: .5rem 1rem; width: 100%;
}
.search-bar button {
  background: none; border: none; color: var(--text2); cursor: pointer;
  padding: .5rem 1rem; font-size: 1.2rem; transition: color .2s;
}
.search-bar button:hover { color: var(--accent); }

.autocomplete-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; z-index: 200;
  box-shadow: var(--shadow);
}
.autocomplete-dropdown.hidden { display: none; }
.ac-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; color: var(--text); font-size: .9rem;
  transition: background .15s;
}
.ac-item:hover { background: var(--bg2); }
.ac-icon { font-size: 1rem; }

.nav-links {
  display: flex; align-items: center; gap: .25rem; margin-left: auto;
}
.nav-link {
  color: var(--text2); font-size: .9rem; font-weight: 500;
  padding: .4rem .75rem; border-radius: var(--radius-sm);
  transition: background .15s, color .15s; white-space: nowrap;
}
.nav-link:hover, .nav-link.active { background: var(--bg3); color: var(--text); }
.nav-link.logout { color: var(--text3); }

.nav-avatar {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); transition: background .15s;
}
.nav-avatar:hover { background: var(--bg3); color: var(--text); }
.nav-avatar img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: white; font-size: .7rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 2px;
}
.badge.hidden { display: none; }

/* ====== PAGE ====== */
.page-container {
  max-width: 1100px; margin: 0 auto;
  padding: calc(var(--nav-h) + 2rem) 1.5rem 3rem;
}

/* ====== BUTTONS ====== */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--accent); color: white; font-weight: 600;
  padding: .6rem 1.25rem; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-size: .9rem;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: var(--accent2); color: white; transform: translateY(-1px); }

.btn-sm {
  display: inline-flex; align-items: center;
  background: var(--bg3); color: var(--text2); font-size: .8rem;
  padding: .3rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
  width: 32px; height: 32px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text2); font-size: 1.2rem;
  cursor: pointer; transition: background .2s, color .2s;
}
.btn-icon:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ====== CARDS ====== */
.repo-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: border-color .2s, transform .2s;
}
.repo-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.repo-card-header { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .5rem; }
.repo-card h4 { color: var(--text); font-size: 1rem; }
.repo-card h4:hover { color: var(--accent2); }
.repo-card p { color: var(--text2); font-size: .875rem; margin-bottom: .75rem; }
.repo-card-footer {
  display: flex; align-items: center; gap: 1rem;
  font-size: .8rem; color: var(--text3);
}
.repo-author {
  display: flex; align-items: center; gap: .4rem; color: var(--text2);
}
.repo-author img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.repo-author:hover { color: var(--accent2); }
.repo-tag {
  background: var(--bg3); color: var(--accent2); font-size: .75rem;
  padding: .2rem .6rem; border-radius: 99px; border: 1px solid var(--border);
  white-space: nowrap;
}
.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.repo-list { display: flex; flex-direction: column; gap: .75rem; }

/* ====== TEMAS ====== */
.temas-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem;
  margin-bottom: 3rem;
}
.tema-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: border-color .2s, transform .2s;
  color: var(--text);
}
.tema-card:hover { border-color: var(--cor); transform: translateY(-3px); color: var(--text); }
.tema-icon { font-size: 1.5rem; margin-bottom: .5rem; }
.tema-card h3 { font-size: .95rem; margin-bottom: .25rem; }
.tema-card p { font-size: .8rem; color: var(--text2); margin-bottom: .75rem; }
.tema-count { font-size: .75rem; color: var(--cor, var(--accent)); font-weight: 600; }

.tema-grid-sm { display: flex; flex-wrap: wrap; gap: .5rem; }
.tema-chip {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 99px; padding: .3rem .8rem;
  font-size: .8rem; color: var(--text2);
  display: flex; align-items: center; gap: .4rem;
  transition: border-color .2s;
}
.tema-chip:hover, .tema-chip.active {
  border-color: var(--cor, var(--accent)); color: var(--cor, var(--accent));
}
.tema-chip small { font-size: .7rem; opacity: .7; }

/* ====== MESSAGES LAYOUT ====== */
.msgs-layout {
  display: grid; grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--nav-h));
  margin-top: calc(-2rem); /* override page-container padding */
  border-top: 1px solid var(--border);
}

.msgs-sidebar {
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.msgs-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.msgs-header h2 { font-size: 1rem; font-family: var(--font-mono); }

.conversa-list { flex: 1; overflow-y: auto; }
.conversa-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem; border-bottom: 1px solid var(--border);
  color: var(--text2); transition: background .15s;
  cursor: pointer;
}
.conversa-item:hover, .conversa-item.active { background: var(--bg3); color: var(--text); }
.conversa-item.unread { color: var(--text); }
.conversa-avatar { position: relative; flex-shrink: 0; }
.conversa-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.unread-dot {
  width: 10px; height: 10px; background: var(--accent);
  border-radius: 50%; border: 2px solid var(--bg2);
  position: absolute; bottom: 0; right: 0;
}
.conversa-info { flex: 1; min-width: 0; }
.conversa-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.conversa-top strong { font-size: .9rem; }
.conversa-top small { font-size: .72rem; color: var(--text3); white-space: nowrap; }
.conversa-preview { font-size: .82rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.msgs-main { background: var(--bg); }
.msgs-placeholder {
  display: flex; align-items: center; justify-content: center;
}
.placeholder-content { text-align: center; color: var(--text3); }
.placeholder-icon { font-size: 3rem; margin-bottom: 1rem; }

.msgs-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3rem; text-align: center; color: var(--text3);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* ====== SEARCH PAGE ====== */
.search-page { padding-top: calc(var(--nav-h) + 1.5rem); }
.search-hero { margin-bottom: 2rem; }
.search-big {
  display: flex; gap: .5rem; margin-bottom: 1rem;
}
.search-big input {
  flex: 1; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); outline: none;
  padding: .75rem 1.25rem; font-size: 1rem; font-family: var(--font-sans);
  transition: border-color .2s;
}
.search-big input:focus { border-color: var(--accent); }
.search-big button { @extend .btn-primary; padding: .75rem 1.5rem; }

.search-filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-btn {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 99px; padding: .35rem 1rem;
  color: var(--text2); font-size: .85rem; transition: all .15s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent); border-color: var(--accent); color: white;
}

.search-results-layout {
  display: grid; grid-template-columns: 200px 1fr; gap: 2rem;
}
.search-sidebar h3 { font-size: .85rem; color: var(--text3); margin-bottom: .75rem;
  text-transform: uppercase; letter-spacing: .08em; }

.result-section { margin-bottom: 2.5rem; }
.result-section h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text2); }

.user-cards { display: flex; flex-direction: column; gap: .75rem; }
.user-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; align-items: flex-start; gap: 1rem;
}
.user-card img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-card-info { flex: 1; min-width: 0; }
.user-card-info strong { font-size: .95rem; }
.user-card-info small { display: block; color: var(--text3); font-size: .8rem; }
.user-card-info p { font-size: .82rem; color: var(--text2); margin-top: .25rem; }
.user-card-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; font-size: .78rem; color: var(--text3); }

.no-results { text-align: center; padding: 3rem; color: var(--text3); }
.search-hint { color: var(--text3); font-size: .9rem; text-align: center; padding: 2rem; }

/* ====== EXPLORAR ====== */
.explorar-hero { margin-bottom: 2rem; }
.explorar-hero h1 { font-family: var(--font-mono); font-size: 2rem; color: var(--text); }
.explorar-hero p { color: var(--text2); }
.temas-section, .recentes-section { margin-bottom: 3rem; }
.temas-section h2, .recentes-section h2 {
  font-size: 1.1rem; margin-bottom: 1.25rem;
  color: var(--text2); font-family: var(--font-mono);
}

/* ====== FLASH MESSAGES ====== */
.flash-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; }
.flash {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem 1.25rem;
  color: var(--text); font-size: .9rem; box-shadow: var(--shadow);
  animation: slideIn .3s ease;
}
.flash.sucesso { border-left: 3px solid var(--accent3); }
.flash.erro { border-left: 3px solid var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====== FORMS ====== */
.form-container {
  max-width: 480px; margin: 0 auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
}
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; color: var(--text2); margin-bottom: .4rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); outline: none;
  padding: .65rem .9rem; font-family: var(--font-sans); font-size: .9rem;
  transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent);
}

/* ====== DATE SEPARATOR ====== */
.date-separator {
  text-align: center; margin: 1rem 0; position: relative;
}
.date-separator::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border);
}
.date-separator span {
  background: var(--bg); padding: 0 .75rem;
  position: relative; font-size: .75rem; color: var(--text3);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; gap: .75rem; }
  .nav-search-wrapper { display: none; }
  .msgs-layout { grid-template-columns: 1fr; }
  .msgs-sidebar { display: none; }
  .search-results-layout { grid-template-columns: 1fr; }
  .search-sidebar { display: none; }
}
