/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --surface: #16161f;
  --surface2: #1e1e2e;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #f0f0f8;
  --text2: #a0a0b8;
  --text3: #60607a;
  --accent: #6c63ff;
  --accent2: #8b5cf6;
  --accent-glow: rgba(108,99,255,0.3);
  --cyan: #22d3ee;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f97316;
  --pink: #ec4899;
  --amber: #f59e0b;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.6);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* ========== LOADER ========== */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-logo {
  font-family: var(--font-head);
  font-size: 2.5rem; font-weight: 800;
  color: var(--text); margin-bottom: 2rem;
}
.loader-logo span { color: var(--accent); }
.loader-bar {
  width: 200px; height: 3px;
  background: var(--surface2);
  border-radius: 99px; overflow: hidden;
  margin: 0 auto 1rem;
}
.loader-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 99px;
  animation: loadFill 1.5s ease forwards;
}
@keyframes loadFill { to { width: 100%; } }
.loader-text { font-size: 13px; color: var(--text3); letter-spacing: 0.05em; }

/* ========== NAVBAR ========== */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
#navbar.scrolled { background: rgba(10,10,15,0.97); }

.nav-brand {
  font-family: var(--font-head);
  font-size: 1.4rem; font-weight: 800; color: var(--text);
}
.nav-brand span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  padding: 6px 14px; border-radius: 8px;
  font-size: 14px; color: var(--text2);
  transition: var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links .nav-admin {
  background: var(--accent); color: #fff;
  font-weight: 500;
}
.nav-links .nav-admin:hover { background: var(--accent2); color: #fff; }

.hamburger { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text2); border-radius: 2px;
  transition: var(--transition);
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
  display: none;
  position: fixed; top: 64px; left: 0; right: 0; z-index: 99;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  animation: slideDown 0.2s ease;
}
.mobile-menu.open { display: flex; flex-direction: column; }
.mobile-menu a {
  padding: 12px 24px; font-size: 15px;
  color: var(--text2); transition: var(--transition);
}
.mobile-menu a:hover { color: var(--text); background: var(--surface2); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ========== HERO ========== */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 100px 20px 60px;
  position: relative; overflow: hidden;
}

.hero-bg-grid {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(108,99,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,99,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
}

.hero-glow {
  position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(108,99,255,0.12), transparent 70%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 800px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 99px;
  background: rgba(108,99,255,0.12);
  border: 1px solid rgba(108,99,255,0.3);
  font-size: 13px; color: var(--accent); font-weight: 500;
  margin-bottom: 24px;
  animation: fadeUp 0.6s ease 0.2s both;
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800; line-height: 1.1;
  color: var(--text); margin-bottom: 20px;
  animation: fadeUp 0.6s ease 0.3s both;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--cyan) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.1rem; color: var(--text2); max-width: 580px; margin: 0 auto 36px;
  line-height: 1.7;
  animation: fadeUp 0.6s ease 0.4s both;
}

.hero-search-wrap {
  display: flex; gap: 10px; max-width: 520px; margin: 0 auto 40px;
  animation: fadeUp 0.6s ease 0.5s both;
}
.hero-search {
  flex: 1; padding: 14px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); font-size: 15px; outline: none;
  transition: var(--transition);
}
.hero-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.hero-search-btn {
  padding: 14px 24px; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.hero-search-btn:hover { background: var(--accent2); transform: translateY(-1px); }

.hero-stats {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  animation: fadeUp 0.6s ease 0.6s both;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num {
  font-family: var(--font-head); font-size: 1.8rem; font-weight: 700;
  color: var(--text);
}
.stat-label { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-divider { width: 1px; height: 32px; background: var(--border2); }

.hero-scroll-hint {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  animation: pulse 2s infinite;
}
.scroll-arrow {
  width: 20px; height: 20px; border-right: 2px solid var(--text3); border-bottom: 2px solid var(--text3);
  transform: rotate(45deg); margin-top: -4px;
}
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ========== CATEGORIES ========== */
.categories-section { padding: 60px 0 20px; }
.section-header { text-align: center; margin-bottom: 32px; }
.section-header h2 {
  font-family: var(--font-head); font-size: 2rem; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
}
.section-header p { color: var(--text2); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cat-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); font-size: 14px; font-weight: 500;
  transition: var(--transition); cursor: pointer;
}
.cat-chip:hover { border-color: var(--accent); color: var(--text); }
.cat-chip.active {
  background: rgba(108,99,255,0.15);
  border-color: var(--accent); color: var(--accent);
}
.chip-icon { font-size: 14px; }

/* ========== API GRID ========== */
.apis-section { padding: 32px 0 80px; }
.apis-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-left h3 {
  font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; color: var(--text);
}
.api-count {
  padding: 4px 10px; border-radius: 99px;
  background: var(--surface2); color: var(--text3);
  font-size: 12px; font-weight: 500;
}
.search-inline {
  padding: 9px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; outline: none;
  transition: var(--transition); width: 200px;
}
.search-inline:focus { border-color: var(--accent); width: 260px; }

.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* API CARD */
.api-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: var(--transition);
  display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden;
  animation: fadeUp 0.4s ease both;
}
.api-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  opacity: 0; transition: var(--transition);
}
.api-card:hover { border-color: var(--border2); transform: translateY(-3px); box-shadow: var(--shadow); }
.api-card:hover::before { opacity: 1; }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title {
  font-family: var(--font-head); font-size: 1rem; font-weight: 700;
  color: var(--text); line-height: 1.3;
}
.card-category {
  padding: 3px 10px; border-radius: 99px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap; flex-shrink: 0;
}

.card-desc { font-size: 13px; color: var(--text2); line-height: 1.6; flex: 1; }

.card-url {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 12px; color: var(--text3);
  font-family: monospace; overflow: hidden;
}
.card-url span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-actions { display: flex; gap: 8px; }
.card-btn {
  flex: 1; padding: 9px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-copy {
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border);
}
.btn-copy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-copy.copied { background: var(--green) !important; color: #fff !important; border-color: var(--green) !important; }
.btn-test {
  background: rgba(34,211,238,0.1); color: var(--cyan);
  border: 1px solid rgba(34,211,238,0.2);
}
.btn-test:hover { background: var(--cyan); color: var(--bg); }

/* EMPTY / LOADING */
.empty-state {
  grid-column: 1/-1; text-align: center; padding: 80px 20px;
  color: var(--text3);
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.no-results {
  grid-column: 1/-1; text-align: center; padding: 80px 20px; color: var(--text3);
}
.no-results-icon { font-size: 3rem; margin-bottom: 16px; }
.no-results h3 { font-family: var(--font-head); color: var(--text2); margin-bottom: 8px; }

/* ========== ABOUT ========== */
.about-section { padding: 80px 0; background: var(--bg2); border-top: 1px solid var(--border); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.section-badge {
  display: inline-block; padding: 4px 12px; border-radius: 99px;
  background: rgba(108,99,255,0.1); border: 1px solid rgba(108,99,255,0.2);
  color: var(--accent); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 16px;
}
.about-text h2 {
  font-family: var(--font-head); font-size: 2rem; font-weight: 700;
  color: var(--text); margin-bottom: 16px;
}
.about-text p { color: var(--text2); margin-bottom: 14px; line-height: 1.7; }
.about-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.about-feat {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text2);
}
.feat-icon { font-size: 18px; }

.about-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 28px;
}
.about-card-header {
  font-family: var(--font-head); font-size: 1.1rem; font-weight: 700;
  color: var(--text); margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.usage-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.usage-list li { font-size: 14px; color: var(--text2); display: flex; align-items: center; gap: 10px; }

/* ========== FOOTER ========== */
.footer { background: var(--bg); border-top: 1px solid var(--border); padding: 60px 0 24px; }
.footer-top { display: grid; grid-template-columns: 1.5fr 2fr; gap: 60px; margin-bottom: 48px; }
.footer-logo {
  font-family: var(--font-head); font-size: 1.6rem; font-weight: 800;
  color: var(--text); margin-bottom: 12px;
}
.footer-logo span { color: var(--accent); }
.footer-brand p { font-size: 13px; color: var(--text3); line-height: 1.7; max-width: 280px; margin-bottom: 16px; }
.footer-socials { display: flex; gap: 10px; }
.footer-socials a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); transition: var(--transition);
}
.footer-socials a:hover { color: var(--text); border-color: var(--accent); }

.footer-links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.footer-col h4 {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  color: var(--text); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.footer-col a {
  display: block; font-size: 13px; color: var(--text3);
  margin-bottom: 10px; transition: var(--transition);
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 24px;
  display: flex; flex-direction: column; gap: 6px;
}
.footer-bottom p { font-size: 12px; color: var(--text3); }
.footer-disclaimer { color: var(--text3); opacity: 0.7; }

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: var(--radius);
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ========== ANIMATIONS ========== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== CATEGORY COLORS ========== */
.cat-ai { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.25); }
.cat-download { background: rgba(34,211,238,0.1); color: var(--cyan); border: 1px solid rgba(34,211,238,0.2); }
.cat-utility { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.cat-weather { background: rgba(245,158,11,0.1); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.cat-finance { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.cat-social { background: rgba(236,72,153,0.1); color: var(--pink); border: 1px solid rgba(236,72,153,0.2); }
.cat-data { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.cat-fun { background: rgba(249,115,22,0.1); color: var(--orange); border: 1px solid rgba(249,115,22,0.2); }
.cat-others { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.25); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .hero-search-wrap { flex-direction: column; }
  .hero-stats { gap: 16px; }
  .stat-num { font-size: 1.4rem; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-top { grid-template-columns: 1fr; gap: 40px; }
  .footer-links-grid { grid-template-columns: 1fr 1fr; }
  .api-grid { grid-template-columns: 1fr; }
  .search-inline { width: 140px; }
  .search-inline:focus { width: 180px; }
}

@media (max-width: 480px) {
  .footer-links-grid { grid-template-columns: 1fr; }
  .about-features { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.2rem; }
}
