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

:root {
  --bg: #0b0b14;
  --surface: #13131f;
  --card: #18182a;
  --card-hover: #1e1e30;
  --accent: #e94560;
  --accent-dim: rgba(233,69,96,0.12);
  --accent2: #0f3460;
  --teal: #00c9a7;
  --teal-dim: rgba(0,201,167,0.1);
  --purple: #6c63ff;
  --purple-hover: #8b83ff;
  --text: #e4e4f0;
  --text-muted: #8888aa;
  --border: #22223a;
  --sidebar-width: 270px;
  --header-height: 62px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.35);
}

body {
  font-family: 'Segoe UI', 'Hind Siliguri', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-ai { font-size: 1.5rem; font-weight: 900; color: var(--accent); letter-spacing: -1px; }
.logo-reels { font-size: 1.5rem; font-weight: 900; color: var(--text); letter-spacing: -1px; }
.logo-sub { font-size: 0.5rem; font-weight: 700; color: var(--text-muted); display: block; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 1px; }

.header-center {
  flex: 1;
  max-width: 420px;
}

#searchInput {
  width: 100%;
  padding: 10px 18px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput::placeholder { color: var(--text-muted); }
#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.header-right { margin-left: auto; flex-shrink: 0; }

.prompt-count-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid var(--accent);
  white-space: nowrap;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0 40px;
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent2) transparent;
}

.sidebar-header { padding: 0 16px 12px; border-bottom: 1px solid var(--border); }

.sidebar-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 700;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.sidebar-close-btn:hover { background: var(--border); }

.category-list { list-style: none; padding: 8px 0; }

.category-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
  transition: all 0.18s;
  gap: 8px;
  color: var(--text-muted);
}

.category-list li:hover {
  background: var(--card);
  border-left-color: var(--border);
  color: var(--text);
}

.category-list li.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.cat-label { flex: 1; }

.cat-count {
  background: var(--accent2);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  min-width: 24px;
  text-align: center;
}

.category-list li.active .cat-count {
  background: var(--accent);
  color: #fff;
}

/* ===== OVERLAY (mobile) ===== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  padding: 24px 24px 48px;
  min-width: 0;
}

/* Mobile top bar */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.menu-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  flex-shrink: 0;
  transition: background 0.2s;
}
.menu-btn:hover { background: var(--card); }

.active-category-label {
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Category hero */
.category-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.category-hero h1 {
  font-size: 1.45rem;
  color: #fff;
  font-weight: 700;
}

.category-hero p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

#sortSelect {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
}
#sortSelect:focus { border-color: var(--accent); }

/* ===== PROMPT GRID ===== */
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

/* ===== PROMPT CARD ===== */
.prompt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  box-shadow: var(--shadow-card);
}

.prompt-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(233,69,96,0.14);
  border-color: rgba(233,69,96,0.35);
  background: var(--card-hover);
}

.card-number {
  position: absolute;
  top: -1px;
  left: -1px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius) 0 var(--radius-sm) 0;
  letter-spacing: 0.3px;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 50px;
  letter-spacing: 0.3px;
}

.badge-cat {
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid rgba(0,201,167,0.25);
}

.badge-copy {
  background: rgba(108,99,255,0.12);
  color: var(--purple);
  border: 1px solid rgba(108,99,255,0.2);
  margin-left: auto;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

/* Visual prompt box */
.visual-prompt-box {
  background: #0c1929;
  border: 1px solid #1a3a5c;
  border-radius: var(--radius-sm);
  padding: 13px;
}

.box-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-family: monospace;
}

.visual-prompt-box .box-label { color: #5ba3d9; }

.visual-prompt-box p {
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.8rem;
  color: #9dc4e8;
  line-height: 1.7;
}

/* Dialogue box */
.dialogue-box {
  background: #130d25;
  border: 1px solid #2d1560;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 13px;
}

.dialogue-box .box-label { color: #c77dff; }

.dialogue-box p {
  font-size: 0.9rem;
  color: #ddb8ff;
  line-height: 1.75;
  font-style: italic;
}

/* Hook video box */
.hook-box {
  background: #0d1f15;
  border: 1px solid #1a4d2e;
  border-left: 4px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 13px;
}

.hook-box .box-label { color: var(--teal); }

.hook-box p {
  font-size: 0.88rem;
  color: #7de8ca;
  line-height: 1.75;
}

/* Copy button */
.copy-btn {
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  width: 100%;
  margin-top: auto;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.copy-btn:hover {
  background: var(--purple-hover);
  box-shadow: 0 4px 16px rgba(108,99,255,0.35);
}
.copy-btn:active { transform: scale(0.97); }
.copy-btn.copied {
  background: #1a9e5c;
  box-shadow: 0 4px 16px rgba(26,158,92,0.35);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a9e5c;
  color: #fff;
  padding: 13px 30px;
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 700;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== NO RESULTS ===== */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.no-results-icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.no-results p { font-size: 1.1rem; margin-bottom: 6px; }
.no-results small { font-size: 0.85rem; }

.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 3px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .prompt-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100%;
    width: 80%;
    max-width: 290px;
    z-index: 200;
    padding-top: 56px;
    transition: left 0.28s ease;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }

  .sidebar.open { left: 0; }
  .overlay.show { display: block; }
  .sidebar-close-btn { display: block; }
  .mobile-topbar { display: flex; }

  .main-content { padding: 14px 12px 40px; }

  .category-hero {
    flex-direction: column;
    gap: 10px;
  }

  .category-hero h1 { font-size: 1.15rem; }

  .prompt-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .sort-wrap { align-self: flex-end; }
  .header-right { display: none; }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 12px; gap: 10px; }
  .logo-text { font-size: 1rem; }
  .logo-sub { display: none; }
  #searchInput { font-size: 0.85rem; padding: 9px 14px; }
  .prompt-card { padding: 15px; }
  .visual-prompt-box p { font-size: 0.76rem; }
}
