/* ═══════════════════════════════════════════════════════════════════════════
   Noftera — Design System v3 (X/Bluesky Inspired, Soft Dark)
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Brand — Noftera Purple/Violet */
  --primary:        #7C3AED;
  --primary-dark:   #6D28D9;
  --primary-light:  #A78BFA;
  --primary-alpha:  rgba(124,58,237,0.12);

  /* Spacing & Shape */
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --radius-full:    9999px;

  /* Transitions */
  --ease:           cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition:     all 0.18s var(--ease);

  /* Status */
  --success:        #10B981;
  --error:          #EF4444;
  --warning:        #F59E0B;

  /* Shadows */
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.5);
  --shadow:         0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg:      0 12px 40px rgba(0,0,0,0.7);
}

/* Light Theme */
:root {
  --bg:             #F9FAFB;
  --surface:        #FFFFFF;
  --surface-2:      #F3F4F6;
  --surface-3:      #E5E7EB;
  --border:         #E5E7EB;
  --border-light:   #D1D5DB;
  --text:           #111827;
  --text-secondary: #374151;
  --text-muted:     #6B7280;
  --text-disabled:  #9CA3AF;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg:             #000000;
  --surface:        #0F0F0F;
  --surface-2:      #1A1A1A;
  --surface-3:      #252525;
  --border:         #2F2F2F;
  --border-light:   #3A3A3A;
  --text:           #FFFFFF;
  --text-secondary: #E5E5E5;
  --text-muted:     #71717A;
  --text-disabled:  #52525B;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.8);
  --shadow:         0 4px 20px rgba(0,0,0,0.9);
  --shadow-lg:      0 12px 40px rgba(0,0,0,0.95);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button, input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Typography ──────────────────────────────────────────────────────────── */
.text-xs    { font-size: 0.75rem; }
.text-sm    { font-size: 0.875rem; }
.text-base  { font-size: 1rem; }
.text-lg    { font-size: 1.125rem; }
.text-xl    { font-size: 1.25rem; }
.text-2xl   { font-size: 1.5rem; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-primary   { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-center    { text-align: center; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border-light);
}
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-full   { width: 100%; }
.btn-sm     { padding: 7px 16px; font-size: 0.875rem; }
.btn-icon {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

/* ── Form Elements ───────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); }
.input-wrapper { position: relative; }
.input-icon-left {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-disabled);
  display: flex; align-items: center;
  pointer-events: none; z-index: 1;
}
.input-icon-right {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-disabled);
  display: flex; align-items: center;
  cursor: pointer; background: none; border: none;
  padding: 0; z-index: 1; transition: var(--transition);
}
.input-icon-right:hover { color: var(--text-muted); }
.form-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 14px 44px;
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
  transition: var(--transition);
}
.form-input.no-icon { padding-left: 14px; }
.form-input.icon-right { padding-right: 44px; }
.form-input::placeholder { color: var(--text-disabled); }
.form-input:focus { border-color: var(--primary); background: var(--surface); }

/* ── Alert ───────────────────────────────────────────────────────────────── */
.alert { display: none; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; }
.alert.show { display: flex; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #FCA5A5; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: #6EE7B7; }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; letter-spacing: -0.5px;
}
.avatar-xs  { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-sm  { width: 36px; height: 36px; font-size: 0.85rem; }
.avatar-md  { width: 44px; height: 44px; font-size: 1rem; }
.avatar-lg  { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-xl  { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-2xl { width: 80px; height: 80px; font-size: 1.5rem; }
.avatar-ring { box-shadow: 0 0 0 3px var(--primary); }

/* ── Badge ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge-primary { background: var(--primary-alpha); color: var(--primary-light); }
.badge-creator { background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(167,139,250,0.2)); color: var(--primary-light); }

/* Verified checkmark */
.verified-icon { width: 16px; height: 16px; display: inline-flex; flex-shrink: 0; }
.verified-icon svg { width: 100%; height: 100%; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}
.modal-overlay.hidden { display: none; }
.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: scaleUp 0.2s ease-out;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--border);
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; font-size: 0.8125rem; color: var(--text-disabled); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.spinner-primary { border-color: var(--primary-alpha); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toastContainer {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  font-size: 0.875rem; font-weight: 500;
  min-width: 240px; max-width: 340px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s var(--ease), toastOut 0.25s var(--ease) 2.75s forwards;
  pointer-events: auto;
}
.toast-icon { display: flex; align-items: center; flex-shrink: 0; }
.toast.success { border-color: rgba(16,185,129,0.35); }
.toast.success .toast-icon { color: #6EE7B7; }
.toast.error   { border-color: rgba(239,68,68,0.35); }
.toast.error   .toast-icon { color: #FCA5A5; }
.toast.info    { border-color: rgba(124,58,237,0.35); }
.toast.info    .toast-icon { color: var(--primary-light); }
@keyframes toastIn  { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateX(20px); } }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.flex    { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.p-4  { padding: 16px; }
.p-6  { padding: 24px; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
