/* =============================================
   SurfAI — style.css
   Content-first bento grid, dark UI
   ============================================= */

/* ---------- TOKENS ---------- */
:root {
  --bg:          #0d1117;
  --bg-2:        #161b22;
  --bg-3:        #f59608e7;
  --bg-card:     #161b22;
  --border:      rgba(247, 92, 3, 0.918);
  --border-hover:rgba(247, 92, 3, 0.918);

  --text-1: #f0f6fc;
  --text-2: #f0f6fc;
  --text-3: #f0f6fc;

  --accent:   #2f81f7;
  --accent-2: #3fb950;
  --pink:     #f778ba;
  --purple:   #a371f7;
  --orange:   #ffa657;
  --teal:     #39d353;
  --wa:       #25d366;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --trans: 0.2s ease;
}

[data-theme="light"] {
  --bg:       #f6f8fa;
  --bg-2:     #ffffff;
  --bg-3:     #eaeef2;
  --bg-card:
linear-gradient(
  rgba(0, 242, 254, 0.15) 0%,
  rgba(79, 172, 254, 0.1) 30%,
  rgba(0, 0, 255, 0.2) 60%,
  rgba(157, 0, 255, 0.15) 100%
);
  --border:   rgba(247, 92, 3, 0.918);
  --border-hover: rgba(247, 92, 3, 0.918);
  --text-1:   #1c2128;
  --text-2:   #1c2128;
  --text-3:   #1c2128;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; }

/* ---------- NAVBAR ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .navbar {
  background: rgba(157, 0, 255, 0.15);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 1.5rem;
  color: var(--accent);
  line-height: 1;
}
.brand-name {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Search */
.nav-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.nav-search svg { color: var(--text-3); flex-shrink: 0; }
.nav-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 0.9rem;
  height: 40px;
}
.nav-search input::placeholder { color: var(--text-3); }
.nav-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,129,247,0.15);
}

/* Nav buttons */
.nav-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: auto; }
.nav-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--trans);
}
.nav-btn:hover {
  background: var(--bg-2);
  border-color: var(--border-hover);
  color: var(--text-1);
}

/* Theme toggle icons */
.icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ---------- FILTER BAR ---------- */
.filter-bar {
  display: none;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.filter-bar.open { display: block; }

.filter-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans);
}
.filter-select:focus { border-color: var(--accent); }

.filter-clear {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 14px;
  transition: all var(--trans);
}
.filter-clear:hover { border-color: var(--border-hover); color: var(--text-1); }

/* ---------- MAIN ---------- */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ---------- BENTO GRID ---------- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: 16px;
}

@media (max-width: 1200px) { .bento-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px)  { .bento-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .bento-grid { grid-template-columns: 1fr; } }

/* ---------- AI CARD ---------- */
.ai-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--trans), border-color var(--trans), box-shadow var(--trans);
  animation: fadeUp 0.4s ease both;
}

.ai-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

/* Wide card (sponsored or featured) */
.ai-card.wide {
  grid-column: span 2;
}

/* Accent top border per card type */
.ai-card.featured  { border-top: 3px solid var(--accent); }
.ai-card.sponsored { border-top: 3px solid var(--pink);   }
.ai-card.affiliate { border-top: 3px solid var(--orange); }

/* Card header */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-logo {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
  flex-shrink: 0;
  overflow: hidden;
}
.card-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 99px;
}
.badge-sponsored { background: rgba(247,120,186,0.15); color: var(--pink); }
.badge-featured  { background: rgba(47,129,247,0.15);  color: var(--accent); }
.badge-affiliate { background: rgba(255,166,87,0.15);  color: var(--orange); }

/* Card title */
.card-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

/* Card description */
.card-desc {
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--text-2);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tags */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all var(--trans);
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

/* Card footer */
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.card-country {
  font-size: 0.75rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-explore {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-1);
  transition: all var(--trans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-explore:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- EMPTY (WhatsApp) CARD ---------- */
.empty-card {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  min-height: 180px;
  transition: border-color var(--trans);
  cursor: pointer;
}
.empty-card:hover { border-color: var(--wa); }
.empty-card-icon { font-size: 2rem; opacity: 0.5; }
.empty-card-title {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
}
.empty-card-sub { font-size: 0.78rem; color: var(--text-3); }

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--wa);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: opacity var(--trans), transform var(--trans);
}
.wa-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ---------- LOADING ---------- */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 20px;
  color: var(--text-3);
  font-size: 0.9rem;
}

.loading-more {
  display: flex;
  justify-content: center;
  padding: 32px;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.small { width: 22px; height: 22px; border-width: 2px; }

/* ---------- ANIMATIONS ---------- */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeUp  {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ---------- FOOTER ---------- */
.footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 56px 24px 24px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}
.footer-brand { display: flex; flex-direction: column; gap: 10px; }
.footer-brand .brand-row { display: flex; align-items: center; gap: 8px; }
.footer-brand p { font-size: 0.85rem; color: var(--text-3); max-width: 260px; line-height: 1.6; }

.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h5 {
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.footer-col a { font-size: 0.88rem; color: var(--text-2); transition: color var(--trans); }
.footer-col a:hover { color: var(--text-1); }

.footer-bottom {
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .nav-search { max-width: 100%; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .nav-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .nav-search { order: 3; width: 100%; max-width: 100%; }
  .main { padding: 20px 14px 60px; }
  .footer-inner { grid-template-columns: 1fr; }
  .ai-card.wide { grid-column: span 1; }
}
