@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --bg: #09090f;
  --surface: #111118;
  --card: #161622;
  --card-hover: #1c1c2c;
  --border: rgba(255,255,255,0.07);
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --available: #10b981;
  --bored: #f59e0b;
  --unavailable: #4b5563;
  --text: #f1f5f9;
  --text-muted: #64748b;
  --text-secondary: #94a3b8;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Status dots ─────────────────────────────────────────── */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  flex-shrink: 0;
}
.status-dot.available { background: var(--available); animation: pulse-green 2.5s ease-in-out infinite; }
.status-dot.bored     { background: var(--bored);     animation: pulse-amber 1.8s ease-in-out infinite; }
.status-dot.unavailable { background: var(--unavailable); }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.6); }
  50%       { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

/* ── Cards / Glass ──────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.card-hover:hover { background: var(--card-hover); transition: background 0.2s; }

/* ── Status buttons ─────────────────────────────────────── */
.status-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  text-align: center;
  color: var(--text-secondary);
  font-weight: 500;
}
.status-btn:hover { transform: translateY(-2px); background: var(--card-hover); }

.status-btn.active-available {
  border-color: var(--available);
  background: rgba(16,185,129,0.08);
  color: var(--available);
  box-shadow: 0 0 20px rgba(16,185,129,0.15), inset 0 1px 0 rgba(16,185,129,0.1);
}
.status-btn.active-bored {
  border-color: var(--bored);
  background: rgba(245,158,11,0.08);
  color: var(--bored);
  box-shadow: 0 0 20px rgba(245,158,11,0.15), inset 0 1px 0 rgba(245,158,11,0.1);
}
.status-btn.active-unavailable {
  border-color: #374151;
  background: rgba(75,85,99,0.12);
  color: #9ca3af;
}

.status-btn .icon { font-size: 28px; line-height: 1; }
.status-btn .label { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #6d28d9; box-shadow: 0 4px 14px rgba(124,58,237,0.4); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--card-hover); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── Forms ───────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(167,139,250,0.1); }
.input::placeholder { color: var(--text-muted); }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-error { font-size: 12px; color: #f87171; margin-top: 4px; }

/* ── Nav ─────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(9,9,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active { background: var(--card); color: var(--text); }
.nav-link.active { color: var(--accent-light); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--bg);
}

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  pointer-events: all;
  animation: slideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 340px;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.fade-out { animation: fadeOut 0.3s ease forwards; }
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* ── Chat bubbles ────────────────────────────────────────── */
.bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.bubble-sent {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}
.bubble-received {
  background: var(--card-hover);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* ── Avatars ─────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.avatar-sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar-md  { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg  { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl  { width: 80px; height: 80px; font-size: 24px; }

/* ── Friend card status strip ──────────────────────────────── */
.friend-status-strip {
  width: 3px; border-radius: 2px; align-self: stretch;
}
.strip-available { background: var(--available); }
.strip-bored     { background: var(--bored); }
.strip-unavailable { background: transparent; }

/* ── Utility ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px; }
a { color: inherit; text-decoration: none; }
select.input { appearance: none; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Mobile bottom nav ──────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(9,9,15,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.mobile-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 16px;
  font-size: 10px; font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  flex: 1;
  transition: color 0.15s;
}
.mobile-nav-btn.active, .mobile-nav-btn:hover { color: var(--accent-light); }

@media (max-width: 768px) {
  .mobile-nav { display: flex; }
  body { padding-bottom: 70px; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — mobiltilpasninger
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* Skjul desktop-nav lenker */
  .desktop-nav { display: none !important; }

  /* Django-meldinger (serverfeedback): full bredde */
  #django-messages { right: 12px; left: 12px; top: 70px; }

  /* Toast: løft over mobil-nav */
  #toast-container {
    bottom: 84px;
    right: 12px;
    left: 12px;
    align-items: stretch;
  }
  .toast { max-width: 100%; }

  /* Kortere kortradius */
  .card { border-radius: 12px; }

  /* Dashboard: én kolonne */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    padding: 12px !important;
    gap: 12px !important;
  }
  .dashboard-grid aside { order: 2; }
  .dashboard-grid aside + div { order: 1; }

  /* Venneliste: større berøringsflate for ikoner */
  .friend-action-icon {
    width: 36px !important;
    height: 36px !important;
  }

  /* Chat-bobler: bredere på smal skjerm */
  .bubble { max-width: 88%; }

  /* Meldingsinput: trygg avstand fra mobilnav */
  .chat-input-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }

  /* Skjemaer: navn-grid stabler */
  .name-grid { grid-template-columns: 1fr !important; }

  /* Innstillinger: tokolonns-grids stabler */
  .settings-2col { grid-template-columns: 1fr !important; }

  /* Profil: reduser avatar-størrelse */
  .avatar-xl { width: 64px; height: 64px; font-size: 18px; }

  /* Søkeresultater: bedre padding */
  .search-result-card { padding: 12px !important; }
}

/* Ekstra kompakt for telefoner < 480px */
@media (max-width: 480px) {

  /* Statusknapper: skjul beskrivelsestekst */
  .status-btn-desc { display: none; }
  .status-btn { padding: 14px 8px; gap: 6px; }
  .status-btn .icon { font-size: 22px; }
  .status-btn .label { font-size: 11px; }

  /* Vennelisteoppføring: kompakt */
  .friend-row-name { font-size: 12px !important; }

  /* Knappepar i profil: stabel vertikalt */
  .profile-actions { flex-direction: column; }
  .profile-actions .btn { justify-content: center; }

  /* Aktive venner: skjul melding-knapp-tekst (vis kun ikon) */
  .active-friend-btn-text { display: none; }
}
