/* ========== CSS Variables for Theming ========== */
:root {
  --bg: #09090b;
  --bg-card: #18181b;
  --bg-code: #0c0c0e;
  --border: #27272a;
  --muted: #a1a1aa;
  --text: #fafafa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99,102,241,0.15);
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-card: #f4f4f5;
  --bg-code: #f8f8fa;
  --border: #e4e4e7;
  --muted: #71717a;
  --text: #18181b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99,102,241,0.1);
}

body {
  background-color: var(--bg);
  color: var(--text);
}

/* ========== Animations ========== */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
  animation: fade-up 0.6s ease-out forwards;
  opacity: 0;
}

.animation-delay-100 { animation-delay: 0.1s; }
.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-300 { animation-delay: 0.3s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-500 { animation-delay: 0.5s; }

.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Theme-aware components ========== */
.nav-scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.api-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.25s ease;
  cursor: pointer;
}

.api-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 8px 24px rgba(0,0,0,0.15);
}

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-fun { background: rgba(168,85,247,0.15); color: #a855f7; }
.badge-tool { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-life { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-ai { background: rgba(244,63,94,0.15); color: #f43f5e; }
.badge-data { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-media { background: rgba(6,182,212,0.15); color: #06b6d4; }

[data-theme="light"] .badge-fun { background: rgba(168,85,247,0.1); color: #7c3aed; }
[data-theme="light"] .badge-tool { background: rgba(59,130,246,0.1); color: #2563eb; }
[data-theme="light"] .badge-life { background: rgba(34,197,94,0.1); color: #16a34a; }
[data-theme="light"] .badge-ai { background: rgba(244,63,94,0.1); color: #e11d48; }
[data-theme="light"] .badge-data { background: rgba(245,158,11,0.1); color: #d97706; }
[data-theme="light"] .badge-media { background: rgba(6,182,212,0.1); color: #0891b2; }

.method-get { color: #4ade80; }
.method-post { color: #60a5fa; }
.method-put { color: #fbbf24; }
.method-delete { color: #f87171; }

[data-theme="light"] .method-get { color: #16a34a; }
[data-theme="light"] .method-post { color: #2563eb; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

::selection { background: rgba(99,102,241,0.3); }
html { scroll-behavior: smooth; }

/* ========== Skeleton ========== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--border) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

body { animation: page-in 0.3s ease-out; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ========== Form ========== */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

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

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: scale(1.02); }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--accent); color: var(--text); }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  animation: toast-in 0.3s ease-out;
}

.toast-success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #22c55e; }
.toast-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========== Theme Toggle ========== */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Theme transition */
body, .api-card, .input, .btn-outline, nav, .toast, .theme-toggle {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
