/*
 * TopCodeTools — "Cold Forge" Design System
 *
 * A dark steel workshop. Cool-toned but not lifeless.
 * Cards have material weight. Borders are visible. Shadows are tight.
 * Premium through restraint and physical believability.
 *
 * ─── Palette ───
 * --void:       #0c0e16   page bg, the deepest dark
 * --steel-1:    #13161f   sidebar, footer bg
 * --steel-2:    #181c27   card bg (gradient start)
 * --steel-3:    #1e2231   card bg (gradient end), inputs
 * --steel-4:    #252a3a   hover surfaces
 * --wire:       #2e3446   borders (VISIBLE, not invisible)
 * --wire-light: #3a4158   hover borders, dividers
 * --text-1:     #d1d5e0   primary text
 * --text-2:     #8b91a3   secondary text
 * --text-3:     #555c70   muted text, placeholders
 * --text-4:     #3a3f50   very muted, counts
 * --accent:     #3ec9b4   teal, muted (not neon)
 * --accent-dim: #2a8f7e   teal on dark surfaces
 * --amber:      #d4a244   stars, warm highlight
 * --ember:      #c25650   cons, errors
 * --sage:       #5aac72   pros, success
 * --indigo:     #7c6ed4   featured badge
 *
 * ─── Tokens ───
 * radius-sm:  6px   (badges, tags)
 * radius-md:  10px  (buttons, inputs)
 * radius-lg:  14px  (cards)
 * shadow:     0 1px 3px 0 rgba(0,0,0,0.35), 0 0 0 1px rgba(46,52,70,0.5)
 * gap:        20px  (grid gap, consistent everywhere)
 * transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1)
 */

:root {
  --void: #0c0e16;
  --steel-1: #13161f;
  --steel-2: #181c27;
  --steel-3: #1e2231;
  --steel-4: #252a3a;
  --wire: #2e3446;
  --wire-light: #3a4158;
  --text-1: #d1d5e0;
  --text-2: #8b91a3;
  --text-3: #555c70;
  --text-4: #3a3f50;
  --accent: #3ec9b4;
  --accent-dim: #2a8f7e;
  --amber: #d4a244;
  --ember: #c25650;
  --sage: #5aac72;
  --indigo: #7c6ed4;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Base ─── */
html { scroll-behavior: smooth; }
body { background: var(--void); color: var(--text-1); }
::selection { background: rgba(62, 201, 180, 0.18); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--wire); border-radius: 3px; }

/* ─── Typography ─── */
.t-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.t-gradient {
  background: linear-gradient(135deg, var(--accent), #5ab4d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Header ─── */
.hdr {
  background: rgba(12, 14, 22, 0.92);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--wire);
  box-shadow: 0 1px 0 0 rgba(0,0,0,0.4);
}
.hdr-search {
  background: var(--steel-2);
  border: 1px solid var(--wire);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 13px;
  padding: 5px 10px 5px 30px;
  outline: none;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  width: 170px;
}
.hdr-search:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(62, 201, 180, 0.08);
}
.hdr-search::placeholder { color: var(--text-4); }
.hdr-link {
  font-size: 13px;
  color: var(--text-2);
  transition: color 0.3s var(--ease);
  text-decoration: none;
}
.hdr-link:hover { color: var(--text-1); }

/* ─── Sidebar ─── */
#app-sidebar {
  background: var(--steel-1);
  border-right: 1px solid var(--wire);
  transition: width 0.3s var(--ease);
  scrollbar-width: none;
}
#app-sidebar::-webkit-scrollbar { width: 0; }
#app-sidebar .nav-wrap::-webkit-scrollbar { width: 0; }

.sb-link {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin: 1px 6px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  transition: all 0.3s var(--ease);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.sb-link:hover {
  color: var(--text-1);
  background: var(--steel-3);
}
.sb-link.active {
  color: var(--accent);
  background: rgba(62, 201, 180, 0.06);
}
.sb-link .ic { width: 24px; text-align: center; flex-shrink: 0; font-size: 16px; line-height: 1; }
.sb-link .lb { margin-left: 10px; flex: 1; transition: opacity 0.2s var(--ease); }
.sb-link .ct {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-4);
  min-width: 16px;
  text-align: right;
  transition: opacity 0.2s var(--ease);
}

#app-sidebar.collapsed .lb,
#app-sidebar.collapsed .ct,
#app-sidebar.collapsed .sb-hdr-text {
  opacity: 0; pointer-events: none;
  width: 0; overflow: hidden;
  margin-left: 0; margin-right: 0;
  padding-left: 0; padding-right: 0;
}
#app-sidebar.collapsed .sb-link {
  justify-content: center;
  padding: 8px 0;
  margin: 1px 4px;
}
#app-sidebar.collapsed .sb-hdr-row {
  justify-content: center;
  padding: 0;
}

/* ─── Hero ─── */
.hero {
  background: var(--void);
  border-bottom: 1px solid var(--wire);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 70% at 0% 100%, rgba(62,201,180,0.03), transparent 70%),
    radial-gradient(ellipse 40% 50% at 100% 0%, rgba(90,180,212,0.02), transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--wire) 0.4px, transparent 0.4px);
  background-size: 24px 24px;
  opacity: 0.18;
  pointer-events: none;
}

/* ─── Search bar ─── */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--steel-2);
  border: 1px solid var(--wire);
  border-radius: var(--radius-md);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.search-bar:focus-within {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(62, 201, 180, 0.06);
}
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text-1);
  font-size: 14px;
  padding: 11px 12px;
  flex: 1;
}
.search-bar input::placeholder { color: var(--text-4); }
.search-bar button {
  background: var(--accent-dim);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 8px;
  margin: 3px;
  border: none;
  cursor: pointer;
  transition: background 0.3s var(--ease);
}
.search-bar button:hover { background: var(--accent); }

/* ─── Tool Cards ─── */
.card {
  display: block;
  background: linear-gradient(165deg, var(--steel-2) 0%, var(--steel-3) 100%);
  border: 1px solid var(--wire);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.card:hover {
  border-color: var(--wire-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35), 0 0 0 1px var(--wire);
  transform: translateY(-1px);
}

/* Thumbnail */
.card .thumb {
  position: relative;
  overflow: hidden;
  background: var(--steel-1);
}
.card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  transition: transform 0.5s var(--ease), filter 0.5s var(--ease);
  filter: brightness(0.88) contrast(1.05);
}
.card:hover .thumb img {
  transform: scale(1.02);
  filter: brightness(0.95) contrast(1.02);
}
.card .thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(12,14,22,0.3) 0%, transparent 40%, transparent 50%, rgba(12,14,22,0.75) 100%);
  pointer-events: none;
}

/* Badges */
.card .badges {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
}
.pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 50px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
}
.pill-featured { background: rgba(124,110,212,0.7); color: #e0dbff; }
.pill-free     { background: rgba(90,172,114,0.55); color: #c8ecd2; }
.pill-freemium { background: rgba(70,130,200,0.5);  color: #c4dbf4; }
.pill-paid     { background: rgba(212,162,68,0.5);   color: #f0deb4; }

/* Card body */
.card .body { padding: 14px 16px 16px; }
.card .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.35;
}
.card .desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}
.card .tag {
  font-size: 10px;
  color: var(--text-3);
  background: var(--steel-1);
  padding: 3px 9px;
  border-radius: 50px;
  border: 1px solid var(--wire);
  white-space: nowrap;
}
.card .price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent-dim);
  font-weight: 500;
}
.card .stars {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-2);
}
.card .stars .s { color: var(--amber); font-size: 11px; }

/* ─── Surfaces (detail page cards) ─── */
.surface {
  background: linear-gradient(165deg, var(--steel-2) 0%, var(--steel-3) 100%);
  border: 1px solid var(--wire);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ─── Category pill ─── */
.cpill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--steel-2);
  border: 1px solid var(--wire);
  padding: 6px 14px;
  border-radius: 50px;
  transition: all 0.3s var(--ease);
  text-decoration: none;
}
.cpill:hover {
  color: var(--text-1);
  border-color: var(--wire-light);
  background: var(--steel-3);
}

/* ─── Section header ─── */
.sec-hdr {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.sec-hdr::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--wire), transparent);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  transition: all 0.3s var(--ease);
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent-dim), #2a9b8a);
  color: #fff;
  box-shadow: 0 1px 3px rgba(42,143,126,0.3);
}
.btn-accent:hover {
  box-shadow: 0 2px 8px rgba(42,143,126,0.4);
  filter: brightness(1.08);
}
.btn-ghost {
  background: var(--steel-3);
  color: var(--text-2);
  border: 1px solid var(--wire);
}
.btn-ghost:hover {
  color: var(--text-1);
  border-color: var(--wire-light);
  background: var(--steel-4);
}

/* ─── Prose ─── */
.prose-dark { color: var(--text-2); font-size: 14px; line-height: 1.8; }

/* ─── Star rating ─── */
.star-on { color: var(--amber); }
.star-off { color: var(--text-4); }

/* ─── Footer ─── */
.ftr {
  background: var(--steel-1);
  border-top: 1px solid var(--wire);
}
.ftr a { color: var(--text-2); text-decoration: none; transition: color 0.3s var(--ease); }
.ftr a:hover { color: var(--accent); }
