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

/* ====== Base ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; }
body.noscroll { overflow: hidden; }

/* ====== Gradient Utilities ====== */
.gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ====== Loader ====== */
.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ====== Scrollbar ====== */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

/* Sidebar scrollbar */
#sidebar::-webkit-scrollbar {
  width: 4px;
}
#sidebar::-webkit-scrollbar-track {
  background: transparent;
}
#sidebar::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
}
.dark #sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
}

/* ====== Sidebar Navigation ====== */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.15s ease;
  cursor: pointer;
}
.sidebar-link:hover {
  background: #f3f4f6;
  color: #374151;
}
.dark .sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: #e5e7eb;
}
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
  color: #667eea;
  font-weight: 600;
}
.dark .sidebar-link.active {
  background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.15));
  color: #a5b4fc;
}
.sidebar-link .count-badge {
  margin-left: auto;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #6b7280;
}
.dark .sidebar-link .count-badge {
  background: rgba(255,255,255,0.08);
  color: #9ca3af;
}

/* ====== API Cards ====== */
.api-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.api-card:hover {
  border-color: #c4b5fd;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.08);
  transform: translateY(-2px);
}
.dark .api-card {
  background: rgba(30, 30, 50, 0.5);
  border-color: rgba(255,255,255,0.08);
}
.dark .api-card:hover {
  border-color: rgba(102, 126, 234, 0.4);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
}

/* ====== Snippet Tabs ====== */
.snippet-tab {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.5rem;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.snippet-tab:hover {
  color: #374151;
}
.snippet-tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
}
.dark .snippet-tab {
  background: rgba(255,255,255,0.05);
  color: #9ca3af;
}
.dark .snippet-tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

/* ====== Toast Notifications ====== */
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  font-size: 0.8125rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease-out;
  min-width: 250px;
}
.dark .toast {
  background: #1e1e3a;
  border-color: rgba(255,255,255,0.1);
  color: #e5e7eb;
}
.toast.toast-success { border-left: 3px solid #10b981; }
.toast.toast-error { border-left: 3px solid #ef4444; }
.toast.toast-info { border-left: 3px solid #667eea; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(20px); }
}

/* ====== Animations ====== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
  animation: fadeUp 0.5s ease-out forwards;
  opacity: 0;
}

/* ====== Category Header ====== */
.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}
.dark .category-header {
  border-bottom-color: rgba(255,255,255,0.08);
}
.category-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
}
.dark .category-icon {
  background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(118,75,162,0.2));
}

/* ====== Input Fields ====== */
.param-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.625rem;
  outline: none;
  transition: all 0.15s ease;
}
.param-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
  background: white;
}
.dark .param-input {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.1);
  color: #e5e7eb;
}
.dark .param-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
  background: rgba(255,255,255,0.05);
}
.param-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

/* ====== Status Dot ====== */
.status-ready {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  position: relative;
}
.status-ready::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(16,185,129,0.3);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

/* ====== Responsive ====== */
@media (max-width: 1024px) {
  main { margin-left: 0 !important; }
}
