/* assets/css/app.css */

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

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #080b14;
  --bg2:       #0e1220;
  --bg3:       #141929;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --text:      #e8eaf2;
  --text2:     #8b90a8;
  --text3:     #555c7a;
  --accent:    #00d4ff;
  --accent2:   #ff6b6b;
  --accent3:   #ffd166;
  --glow:      0 0 40px rgba(0,212,255,0.15);
  --radius:    14px;
  --radius-sm: 8px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'Lato', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0; opacity: .5;
}

/* ── Layout ───────────────────────────────────────────────── */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ── Header ───────────────────────────────────────────────── */
#header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(8,11,20,0.9);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  height: 64px;
}
#header .wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; }

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #00d4ff 0%, #0080ff 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; box-shadow: 0 4px 20px rgba(0,212,255,0.35);
}
.logo-name {
  font-family: var(--font-head); font-weight: 800; font-size: 20px;
  color: var(--text); letter-spacing: -0.5px;
}
.logo-tag { font-size: 10px; color: var(--text3); margin-top: -4px; letter-spacing: 0.5px; }

.nav { display: flex; gap: 4px; }
.nav-btn {
  padding: 8px 20px; border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text2);
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  cursor: pointer; transition: all .2s; letter-spacing: 0.3px;
}
.nav-btn:hover { border-color: var(--border2); color: var(--text); }
.nav-btn.active {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.35);
  color: var(--accent);
}

.header-stats { display: flex; gap: 20px; }
.hstat { text-align: right; }
.hstat-val { font-family: var(--font-mono); font-size: 16px; font-weight: 500; color: var(--accent); }
.hstat-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab { display: none; animation: fadeUp .35s ease both; }
.tab.active { display: block; }

/* ── Page title block ────────────────────────────────────── */
.page-head { padding: 36px 0 28px; }
.page-head h1 {
  font-family: var(--font-head); font-size: 32px; font-weight: 800;
  letter-spacing: -1px; line-height: 1.1; margin-bottom: 8px;
}
.page-head h1 span { color: var(--accent); }
.page-head p { color: var(--text2); font-size: 15px; }

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; align-items: center; }
.filter-btn {
  padding: 7px 16px; border-radius: 100px; font-size: 13px; font-weight: 700;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text2);
  cursor: pointer; transition: all .2s; font-family: var(--font-body);
}
.filter-btn:hover { border-color: var(--border2); color: var(--text); }
.filter-btn.active {
  background: rgba(0,212,255,0.12); border-color: rgba(0,212,255,0.4); color: var(--accent);
}
.filter-btn.refresh {
  background: transparent; margin-left: auto;
  border-color: var(--border2); color: var(--text3);
}
.filter-btn.refresh:hover { color: var(--accent); border-color: rgba(0,212,255,0.4); }

/* ── Trend Grid ──────────────────────────────────────────── */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.trend-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: all .25s; cursor: default;
  animation: fadeUp .4s ease both;
}
.trend-card:hover {
  border-color: rgba(0,212,255,0.25);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,212,255,0.08);
}

.trend-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.trend-meta { display: flex; align-items: center; gap: 10px; }
.trend-emoji { font-size: 26px; flex-shrink: 0; }
.trend-title { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--text); }
.trend-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.trend-likes { text-align: right; }
.trend-likes-val { font-family: var(--font-mono); font-size: 20px; font-weight: 500; color: var(--accent3); display: block; }
.trend-likes-lbl { font-size: 10px; color: var(--text3); }

.trend-desc { font-size: 13px; color: var(--text2); line-height: 1.55; margin-bottom: 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700;
  background: rgba(0,212,255,0.08); color: rgba(0,212,255,0.7);
  border: 1px solid rgba(0,212,255,0.18); letter-spacing: 0.2px;
}

.trend-idea {
  font-size: 12px; color: var(--text3); font-style: italic;
  border-left: 2px solid var(--border2); padding-left: 10px; margin-bottom: 16px;
  line-height: 1.5;
}

.btn-generate {
  width: 100%; padding: 11px 0; border-radius: var(--radius-sm);
  background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.25);
  color: var(--accent); font-family: var(--font-body); font-weight: 700; font-size: 13px;
  cursor: pointer; transition: all .2s; letter-spacing: 0.3px;
}
.btn-generate:hover {
  background: rgba(0,212,255,0.18); box-shadow: 0 4px 20px rgba(0,212,255,0.15);
}

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(330px,1fr)); gap:16px; }
.skeleton-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; height: 240px;
}
.skel { background: linear-gradient(90deg, var(--bg3) 25%, #1a2035 50%, var(--bg3) 75%);
        background-size: 400% 100%; animation: shimmer 1.6s infinite;
        border-radius: 6px; margin-bottom: 10px; }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* ── Generator layout ────────────────────────────────────── */
.gen-layout { display: grid; grid-template-columns: 1fr 380px; gap: 28px; align-items: start; }

/* Selected trend pill */
.selected-trend-pill {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius);
  background: rgba(0,212,255,0.06); border: 1px solid rgba(0,212,255,0.2);
  margin-bottom: 20px; animation: fadeUp .3s ease;
}
.stp-emoji { font-size: 24px; }
.stp-name { font-family: var(--font-head); font-weight: 700; font-size: 14px; }
.stp-cat { font-size: 12px; color: var(--text3); }
.stp-close {
  margin-left: auto; background: none; border: none; color: var(--text3);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 4px;
}
.stp-close:hover { color: var(--accent2); }

/* Custom topic input */
.field-label { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; display: block; margin-bottom: 8px; }
.input-row { display: flex; gap: 10px; margin-bottom: 24px; }
.input-topic {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text);
  font-family: var(--font-body); font-size: 14px;
  transition: border-color .2s;
}
.input-topic:focus { border-color: rgba(0,212,255,0.4); outline: none; }
.input-topic::placeholder { color: var(--text3); }

.btn-primary {
  padding: 12px 22px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0080ff, #00d4ff);
  border: none; color: #fff; font-family: var(--font-body);
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,212,255,0.25);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(0,212,255,0.4); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Prompt area */
.prompt-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); min-height: 150px; margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.prompt-textarea {
  width: 100%; min-height: 150px; padding: 18px;
  background: transparent; border: none; color: var(--text);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  resize: vertical;
}
.prompt-textarea:focus { outline: none; }
.prompt-textarea::placeholder { color: var(--text3); }
.prompt-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 150px; gap: 14px;
}
.prompt-loading-text { font-size: 13px; color: var(--text3); }

.prompt-actions { display: flex; gap: 8px; margin-bottom: 24px; }
.btn-ghost {
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700;
  background: var(--bg2); border: 1px solid var(--border2); color: var(--text2);
  cursor: pointer; transition: all .2s; font-family: var(--font-body);
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); }
.btn-ghost.success { border-color: rgba(0,212,255,0.4); color: var(--accent); }

/* Launch button */
.btn-launch {
  display: block; width: 100%; padding: 16px; border-radius: var(--radius);
  text-align: center; text-decoration: none; font-family: var(--font-head);
  font-weight: 700; font-size: 16px; color: #fff;
  transition: all .25s; letter-spacing: 0.3px;
}
.btn-launch:hover { transform: translateY(-2px); filter: brightness(1.1); }
.launch-hint { text-align: center; font-size: 12px; color: var(--text3); margin-top: 8px; }

/* ── API Cards ────────────────────────────────────────────── */
.api-cards { display: flex; flex-direction: column; gap: 10px; }
.api-card {
  padding: 16px 18px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--bg2); cursor: pointer; transition: all .2s;
}
.api-card:hover { border-color: var(--border2); }
.api-card.selected { border-color: var(--api-color, #00d4ff); background: var(--api-bg, rgba(0,212,255,0.06)); }

.api-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.api-card-name { font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.api-card-company { font-size: 11px; color: var(--text3); margin-top: 2px; }
.api-badge {
  font-size: 10px; padding: 3px 9px; border-radius: 100px; font-weight: 700;
  white-space: nowrap;
}
.api-strengths { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.api-strength {
  font-size: 11px; padding: 2px 9px; border-radius: 100px;
  background: rgba(255,255,255,0.05); color: var(--text2);
}
.api-footer { display: flex; justify-content: space-between; font-size: 12px; color: var(--text3); }
.api-prompt-hint {
  margin-top: 12px; padding: 10px 12px;
  background: rgba(0,0,0,0.3); border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text2); line-height: 1.5; font-style: italic;
}

/* ── Saved tab ────────────────────────────────────────────── */
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(340px,1fr)); gap:16px; }
.saved-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  animation: fadeUp .35s ease both;
}
.saved-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.saved-api { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--accent); }
.saved-date { font-size: 11px; color: var(--text3); }
.saved-label { font-family: var(--font-head); font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.saved-prompt {
  font-family: var(--font-mono); font-size: 12px; color: var(--text2); line-height: 1.6;
  background: var(--bg3); border-radius: var(--radius-sm); padding: 12px;
  max-height: 100px; overflow: hidden; position: relative; margin-bottom: 12px;
}
.saved-prompt::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 30px;
  background: linear-gradient(transparent, var(--bg3));
}
.saved-actions { display: flex; gap: 8px; }

/* ── Stats tab ────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; margin-bottom: 36px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-align: center; animation: fadeUp .4s ease both;
}
.stat-val { font-family: var(--font-mono); font-size: 36px; font-weight: 500; color: var(--accent); display: block; }
.stat-lbl { font-size: 12px; color: var(--text3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.8px; }

.section-title { font-family: var(--font-head); font-size: 18px; font-weight: 700; margin-bottom: 16px; }

.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
  text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text3); border-bottom: 1px solid var(--border);
}
.history-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: top; }
.history-table tr:hover td { background: rgba(255,255,255,0.02); }
.history-prompt-cell { max-width: 360px; font-family: var(--font-mono); font-size: 12px; }
.history-api-badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700;
}

/* ── Spinner ──────────────────────────────────────────────── */
.dots { display: flex; gap: 6px; align-items: center; justify-content: center; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: bounce 1.2s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

/* ── Toast ───────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0; transform: translateY(12px);
  transition: all .25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes bounce { 0%,80%,100% { transform:scale(0); } 40% { transform:scale(1); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 860px) {
  .gen-layout { grid-template-columns: 1fr; }
  .header-stats { display: none; }
  .page-head h1 { font-size: 24px; }
}
@media (max-width: 560px) {
  .nav-btn span { display: none; }
  .wrap { padding: 0 16px; }
}
