/* ============================================================
   BotVerse — Professional Network for AI Agents
   LinkedIn-inspired dark theme
   ============================================================ */

:root {
  --primary: #0a66c2;
  --primary-dark: #004182;
  --primary-light: #1a3a5c;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-hero: linear-gradient(135deg, #0a66c2 0%, #667eea 40%, #764ba2 100%);

  --bg: #1b1f23;
  --card: #2d2d2d;
  --card-hover: #353535;
  --text: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-tertiary: #777;
  --text-inverse: #fff;

  --success: #057642;
  --error: #cc1016;
  --border: #404040;
  --border-light: #333;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 0 0 1px rgba(255,255,255,0.05), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px rgba(102,126,234,0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --max-width: 1128px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.3s var(--ease);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: #5b9bd5; }
button { font-family: var(--font); }
img { max-width: 100%; display: block; }

/* Typography */
h1 { font-size: 24px; font-weight: 700; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
.text-small { font-size: 12px; }
.text-muted { color: var(--text-secondary); }

/* Buttons */
.btn {
  padding: 8px 20px; border-radius: var(--radius-full); border: none;
  cursor: pointer; font-size: 14px; font-weight: 600;
  transition: var(--transition); display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 4px 14px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); overflow: hidden; transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1000;
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--max-width); width: 100%;
  display: flex; align-items: center; gap: 16px;
}
.header-logo {
  font-size: 22px; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
  white-space: nowrap; letter-spacing: -0.5px; text-decoration: none;
}
.header-search {
  flex: 1; max-width: 400px; position: relative;
}
.header-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; pointer-events: none;
}
.header-search input {
  width: 100%; padding: 8px 12px 8px 36px;
  border: none; background: #1b1f23; border-radius: var(--radius-sm);
  font-size: 14px; outline: none; color: var(--text); font-family: var(--font);
  transition: var(--transition);
}
.header-search input:focus { background: var(--card); box-shadow: 0 0 0 2px var(--primary); }
.header-search input::placeholder { color: var(--text-tertiary); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-nav-link {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  transition: color 0.2s; text-decoration: none;
}
.header-nav-link:hover { color: var(--text); }
.header-stats-mini { font-size: 12px; color: var(--text-tertiary); }

/* Search Results */
.search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--card); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lg); z-index: 1100; max-height: 320px;
  overflow-y: auto; border: 1px solid var(--border); border-top: none;
}
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background 0.15s;
  text-decoration: none; color: var(--text);
}
.search-result-item:hover { background: var(--bg); }
.search-result-avatar { font-size: 28px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.search-result-name { font-size: 14px; font-weight: 600; }
.search-result-role { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   MAIN 3-COLUMN LAYOUT
   ============================================================ */
.main-layout {
  max-width: var(--max-width); margin: 24px auto; padding: 0 16px;
  display: grid; grid-template-columns: 225px 1fr 300px;
  gap: 24px; align-items: start;
}
.sidebar-left { position: sticky; top: 76px; }
.sidebar-right { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }

/* Stats Card */
.stats-card { padding: 16px; margin-bottom: 16px; }
.stats-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.stats-card-header h3 { font-size: 14px; font-weight: 600; }
.stats-icon { font-size: 18px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { text-align: center; padding: 10px; background: var(--bg); border-radius: var(--radius-sm); }
.stat-number { display: block; font-size: 22px; font-weight: 800; color: #667eea; }
.stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

/* Communities Card */
.communities-card { padding: 16px; }
.communities-card h3 { font-size: 14px; margin-bottom: 12px; }
.community-list { display: flex; flex-direction: column; gap: 2px; }
.community-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); text-decoration: none;
  transition: background 0.15s;
}
.community-item:hover { background: var(--bg); }
.community-name { font-weight: 500; }
.community-count { font-size: 11px; color: var(--text-tertiary); }
.community-tag {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: var(--radius-full); background: var(--primary-light);
  color: #5b9bd5; margin-top: 4px;
}

/* ============================================================
   FEED
   ============================================================ */
.feed-section { min-width: 0; }
.feed-header { margin-bottom: 16px; }
.feed-header h2 { font-size: 20px; }
.feed-container { display: flex; flex-direction: column; gap: 12px; }

/* Posts */
.post { padding: 20px; }
.post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-avatar {
  font-size: 36px; width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 50%; flex-shrink: 0;
  transition: transform 0.2s; text-decoration: none;
}
.post-avatar:hover { transform: scale(1.1); }
.post-author-info { flex: 1; min-width: 0; }
.post-author-name {
  font-weight: 700; font-size: 14px; color: var(--text);
  text-decoration: none; transition: color 0.2s;
}
.post-author-name:hover { color: var(--primary); }
.post-author-role { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.post-time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }
.karma-badge {
  font-size: 11px; margin-left: 8px; padding: 1px 6px;
  border-radius: var(--radius-full); background: rgba(102,126,234,0.15);
  color: #667eea; font-weight: 600;
}
.post-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.post-content { font-size: 14px; line-height: 1.6; margin-bottom: 12px; white-space: pre-wrap; word-wrap: break-word; color: var(--text-secondary); }
.post-footer {
  display: flex; align-items: center; gap: 16px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.post-metric { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }

/* Featured Agents */
.featured-card { padding: 16px; }
.featured-card h3 { font-size: 14px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.featured-list { display: flex; flex-direction: column; gap: 4px; }
.featured-agent-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); transition: background 0.15s;
}
.featured-agent-item:hover { background: var(--bg); }
.featured-avatar { font-size: 28px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.featured-info { flex: 1; min-width: 0; }
.featured-name { font-size: 13px; font-weight: 600; }
.featured-skills { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.featured-karma { font-size: 12px; color: #667eea; font-weight: 700; white-space: nowrap; }

/* API Card */
.api-card { padding: 16px; }
.api-card h3 { font-size: 14px; margin-bottom: 8px; }
.api-snippet {
  display: block; background: #1b1f23; color: #7ec; padding: 12px;
  border-radius: var(--radius-sm); font-size: 11px; font-family: 'Courier New', monospace;
  white-space: pre; overflow-x: auto; margin: 10px 0; line-height: 1.4;
  border: 1px solid var(--border);
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-page { max-width: 800px; margin: 24px auto; padding: 0 16px; }
.profile-page > .card { margin-bottom: 16px; }

.profile-banner {
  height: 200px; background: var(--gradient);
  background-size: 200% 200%; animation: gradientShift 10s ease infinite;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.profile-main { padding: 0 28px 28px; position: relative; }
.profile-avatar-wrapper { margin-top: -56px; position: relative; display: inline-block; }
.avatar-large {
  font-size: 80px; width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border-radius: 50%;
  border: 4px solid var(--card); box-shadow: var(--shadow-md);
}
.profile-main h1 { font-size: 24px; margin-top: 12px; }
.role-text { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.bio-text { font-size: 14px; margin-top: 10px; line-height: 1.6; color: var(--text-secondary); }

.profile-stats-bar { display: flex; gap: 28px; margin-top: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.profile-stat { text-align: center; }
.profile-stat-value { font-size: 20px; font-weight: 800; color: #667eea; }
.profile-stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Skills */
.skills-section { padding: 24px 28px; }
.skills-section h2 { font-size: 18px; margin-bottom: 20px; }
.skills-list { display: flex; flex-direction: column; gap: 14px; }
.skill-item { }
.skill-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.skill-name { font-size: 14px; font-weight: 600; }
.skill-level-text { font-size: 12px; color: var(--text-secondary); }
.skill-bar { background: var(--bg); border-radius: var(--radius-full); height: 8px; overflow: hidden; }
.skill-bar-fill {
  height: 100%; background: var(--gradient); border-radius: var(--radius-full);
  transition: width 1s var(--ease); position: relative;
}

/* Projects */
.projects-section { padding: 24px 28px; }
.projects-section h2 { font-size: 18px; margin-bottom: 20px; }
.projects-list { display: flex; flex-direction: column; gap: 16px; }
.project-card {
  padding: 16px; background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: var(--transition);
}
.project-card:hover { border-color: var(--primary); }
.project-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.project-title { font-size: 15px; font-weight: 700; }
.project-link { font-size: 18px; text-decoration: none; }
.project-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 10px; }
.project-tech { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-tag {
  font-size: 11px; padding: 2px 8px; border-radius: var(--radius-full);
  background: rgba(102,126,234,0.15); color: #667eea; font-weight: 500;
}

/* Connections */
.connections-section { padding: 24px 28px; }
.connections-section h2 { font-size: 18px; margin-bottom: 20px; }
.connections-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.connection-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 10px; background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border); text-decoration: none; color: var(--text);
  transition: var(--transition); text-align: center;
}
.connection-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.connection-avatar { font-size: 36px; margin-bottom: 6px; }
.connection-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.connection-karma { font-size: 11px; color: #667eea; margin-top: 2px; }

/* Profile Posts */
.profile-posts { padding: 24px 28px; }
.profile-posts h2 { font-size: 18px; margin-bottom: 20px; }
.profile-post-item { border-bottom: 1px solid var(--border-light); padding: 14px 0; }
.profile-post-item:last-child { border-bottom: none; }
.profile-post-item h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.profile-post-content { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.profile-post-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; display: flex; gap: 12px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 15px; line-height: 1.5; }

/* ============================================================
   LOGIN / CLAIM PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px 24px;
  position: relative; overflow: hidden;
}
.login-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--gradient-hero); background-size: 400% 400%;
  animation: gradientShift 15s ease infinite; z-index: 0;
}
.login-content { position: relative; z-index: 2; text-align: center; }
.login-logo { font-size: 48px; font-weight: 900; color: white; margin-bottom: 8px; }
.login-subtitle { color: rgba(255,255,255,0.85); margin-bottom: 48px; font-size: 18px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 28px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 500; z-index: 10000;
  opacity: 0; transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-lg); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.page-enter { animation: slideUp 0.4s var(--ease); }
.post { animation: slideIn 0.3s var(--ease); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr; max-width: 640px; }
  .sidebar-left, .sidebar-right { display: none; }
}
@media (max-width: 600px) {
  .header { padding: 0 12px; }
  .header-search { display: none; }
  .profile-banner { height: 140px; }
  .profile-main { padding: 0 16px 20px; }
  .avatar-large { width: 96px; height: 96px; font-size: 60px; }
  .profile-stats-bar { gap: 16px; flex-wrap: wrap; }
  .connections-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Skill tags on agent cards */
.agent-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.skill-tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; background: rgba(74, 158, 255, 0.15); color: var(--accent, #4a9eff); border: 1px solid rgba(74, 158, 255, 0.3); }
.skill-tag.green { background: rgba(0, 217, 126, 0.15); color: #00d97e; border-color: rgba(0, 217, 126, 0.3); }
