/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-h);
  color: #fff;
  box-shadow: var(--glow);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255,71,87,0.2);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 14px var(--space-8);
  font-size: var(--text-base);
}

.btn-icon {
  padding: 8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
}

/* ══════════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.form-input {
  width: 100%;
  padding: 10px var(--space-3);
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  outline: none;
}

.form-input::placeholder { color: var(--text-faint); }

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-dim);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-sm {
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

/* ══════════════════════════════════════════
   AVATAR
══════════════════════════════════════════ */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-sm { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-md { width: 36px; height: 36px; }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }

/* ══════════════════════════════════════════
   PRESENCE DOT
══════════════════════════════════════════ */
.presence {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--offline);
  flex-shrink: 0;
  transition: background var(--duration-md) var(--ease);
}
.presence.online  { background: var(--online); box-shadow: 0 0 6px var(--online); }
.presence.away    { background: var(--away); }

/* Larger status dot used in the sidebar header */
.presence-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--offline, #3A3A54);
  flex-shrink: 0;
  transition: background var(--duration-md);
}
.presence-dot.online  { background: var(--online); box-shadow: 0 0 6px var(--online); }
.presence-dot.offline { background: var(--offline, #3A3A54); }

/* ══════════════════════════════════════════
   BADGE
══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
}

.badge-accent { background: var(--accent); color: #000; }

/* ══════════════════════════════════════════
   TOAST / ALERT
══════════════════════════════════════════ */
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

.alert-error {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255,71,87,0.2);
}

.alert-success {
  background: rgba(0,255,148,0.1);
  color: var(--success);
  border: 1px solid rgba(0,255,148,0.2);
}

/* ══════════════════════════════════════════
   DIVIDER
══════════════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--space-6) 0 var(--space-3);
}
.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════════════════
   LOGO
══════════════════════════════════════════ */
.logo {
  display: flex;
  align-items: center;
}
.logo img, .logo svg { height: 28px; width: auto; }
.logo-sm img, .logo-sm svg { height: 22px; }
.logo-lg img, .logo-lg svg { height: 36px; }

/* ══════════════════════════════════════════
   NAV
══════════════════════════════════════════ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  height: 60px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* ══════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════ */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   MODAL BACKDROP
══════════════════════════════════════════ */
.dropdown-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.15s var(--ease);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ══════════════════════════════════════════
   DROPDOWN / CONTEXT MENU
══════════════════════════════════════════ */
.dropdown {
  position: absolute;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  animation: popIn 0.1s var(--ease);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration);
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item.danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ══════════════════════════════════════════
   INLINE HELPERS
══════════════════════════════════════════ */

/* Small muted text beside a form label (e.g. "(optional)") */
.form-label-opt {
  font-weight: 400;
  color: var(--text-faint);
  font-size: var(--text-xs);
}

/* Styled hyperlink */
.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.link:hover { text-decoration: underline; color: var(--primary-h); }

/* alert-danger alias for alert-error */
.alert-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255,71,87,0.2);
}
