:root {
  --bg-base: #080f0a;
  --bg-sidebar: #060d08;
  --bg-card: #0d1710;
  --bg-card-hover: #111f14;
  --bg-input: #121c14;
  --border: #1a2e1d;
  --border-light: #1f3823;
  --text-primary: #e2ede4;
  --text-secondary: #6b8f6e;
  --text-muted: #3d5c40;
  --accent: #22c55e;
  --accent-glow: rgba(34,197,94,0.15);
  --accent-soft: rgba(34,197,94,0.08);
  --green: #4ade80;
  --red: #ef4444;
  --yellow: #f59e0b;
  --sidebar-width: 210px;
}

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

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 90px; height: 90px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.logo-icon img { width: 100%; height: 100%; object-fit: contain; }

.nav-section { padding: 16px 12px 4px; }

.nav-label {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 6px; margin-bottom: 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 7px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s; margin-bottom: 1px;
}

.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(34,197,94,0.15); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}

.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── MAIN ── */
#main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.page {
  display: none; flex: 1; overflow-y: auto;
  padding: 28px 30px;
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }

@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

/* page header */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title-wrap { display: flex; align-items: center; gap: 14px; }
.page-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.page-icon svg { width: 20px; height: 20px; color: #fff; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.page-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

/* ── BUTTONS ── */
.btn-primary {
  display: flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.btn-primary:hover { background: #16a34a; box-shadow: 0 0 20px rgba(34,197,94,0.3); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--border-light); color: var(--text-primary); }

/* ── SEARCH CARD ── */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 24px;
}

.search-card-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.search-row {
  display: flex; gap: 10px; align-items: center;
}

.search-input {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px; color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,0.1); }
.search-input::placeholder { color: var(--text-muted); }

.qty-wrap {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

.form-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary); letter-spacing: 0.4px;
}

.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px; color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  outline: none; cursor: pointer;
}

.search-hint {
  font-size: 11px; color: var(--text-muted);
  margin-top: 10px;
}

/* ── PROFILE CARD ── */
.profile-card {
  display: flex; align-items: flex-start; gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
  border: 2px solid var(--border-light);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-meta { flex: 1; }
.profile-handle { font-size: 16px; font-weight: 700; }
.profile-name { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.profile-stats-row {
  display: flex; gap: 20px; margin-top: 12px;
}

.profile-stat { text-align: center; }
.profile-stat-num {
  font-size: 16px; font-weight: 700;
  font-family: 'Space Mono', monospace;
  color: var(--accent);
}
.profile-stat-lbl { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.profile-bio { font-size: 12px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }

.profile-actions {
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}

/* ── GRID HEADER ── */
.grid-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.chip-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.chip-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── POSTS GRID ── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px;
  margin-bottom: 40px;
}

.post-thumb {
  aspect-ratio: 1;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.post-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.25s;
}
.post-thumb:hover img { transform: scale(1.05); }

.post-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.72);
  opacity: 0; transition: opacity 0.2s;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  padding: 10px;
  gap: 6px;
}
.post-thumb:hover .post-overlay { opacity: 1; }

.overlay-stats {
  display: flex; gap: 10px;
  font-size: 11px; font-weight: 700; color: #fff;
}
.overlay-stat { display: flex; align-items: center; gap: 3px; }
.overlay-stat svg { width: 11px; height: 11px; }

.overlay-btns { display: flex; gap: 4px; width: 100%; }

.overlay-btn {
  flex: 1;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  padding: 5px 2px;
  font-size: 10px; font-weight: 600; color: #fff;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  transition: background 0.15s; backdrop-filter: blur(4px);
}
.overlay-btn:hover { background: rgba(255,255,255,0.28); }
.overlay-btn svg { width: 10px; height: 10px; }

.post-badge {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,0.65);
  border-radius: 4px; padding: 2px 5px;
  font-size: 9px; font-weight: 700; color: #fff;
}

/* ── RESULTADOS ── */
.result-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.result-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.result-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.result-avatar img { width: 100%; height: 100%; object-fit: cover; }

.result-handle { font-size: 13px; font-weight: 600; }
.result-info { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: 'Space Mono', monospace; }

.result-actions { margin-left: auto; display: flex; gap: 8px; }

.btn-sm {
  display: flex; align-items: center; gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.danger:hover { border-color: var(--red); color: var(--red); }
.btn-sm svg { width: 12px; height: 12px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 2px;
}

.result-thumb {
  aspect-ratio: 1; background: var(--bg-input);
  overflow: hidden; cursor: pointer;
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.result-thumb:hover img { transform: scale(1.06); }

/* ── LOADING / EMPTY ── */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; gap: 12px;
  color: var(--text-muted); font-size: 13px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; color: var(--text-muted); gap: 12px;
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.25; }
.empty-state p { font-size: 13px; text-align: center; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 10px; padding: 12px 18px;
  font-size: 13px; display: none; align-items: center; gap: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); z-index: 9999;
  animation: slideUp 0.25s ease; max-width: 320px;
}
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
#toast.show { display: flex; }
#toast.success { border-color: rgba(34,197,94,0.3); }
#toast.error { border-color: rgba(239,68,68,0.3); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
#toast.success .toast-dot { background: var(--green); }
#toast.error .toast-dot { background: var(--red); }

/* scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
