/* ============================================================
   StreamFind — MVP Stylesheet
   Dark Twitch-inspired theme using CSS custom properties
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --color-bg:             #0e0e10;
  --color-surface:        #18181b;
  --color-surface-2:      #1f1f23;
  --color-border:         #2a2a2d;
  --color-text:           #efeff1;
  --color-text-muted:     #adadb8;
  --color-text-faint:     #53535f;
  --color-primary:        #9147ff;
  --color-primary-hover:  #772ce8;
  --color-primary-active: #5c16c5;

  --font-body:    'Inter', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  2rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);

  --content-default: 960px;
  --content-wide: 1200px;
}

/* --- Light Mode Theme --- */
html[data-theme="light"] {
  --color-bg:             #f0f0f3;
  --color-surface:        #ffffff;
  --color-surface-2:      #e4e4e8;
  --color-border:         #c8c8cf;
  --color-text:           #111111;
  --color-text-muted:     #444450;
  --color-text-faint:     #888896;
  --color-primary:        #7c3aed;
  --color-primary-hover:  #6d28d9;
  --color-primary-active: #5b21b6;
  --shadow-md:            0 4px 16px rgba(0,0,0,0.10);
}

html[data-theme="light"] input[type="date"] {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
  color-scheme: light;
}

/* --- Base Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  line-height: 1.6;
}
img { display: block; max-width: 100%; height: auto; }
input, select, textarea, button { font: inherit; color: inherit; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* --- Layout --- */
.container {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* --- Header --- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center;
  justify-content: space-between;
  padding-block: var(--space-3);
}
.logo {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}
.logo:hover { color: var(--color-text); }
.site-nav {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-sm);
}
.site-nav a { color: var(--color-text-muted); text-decoration: none; }
.site-nav a:hover { color: var(--color-text); }
.nav-btn {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.nav-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-2);
  color: var(--color-text) !important;
}
.nav-user-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-3);
}
.nav-avatar-link {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.nav-avatar-link:hover { border-color: var(--color-primary); }
.nav-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.nav-avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none; cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-8); font-size: var(--text-base); }
.btn-full { width: 100%; justify-content: center; }

/* --- Hero --- */
.hero {
  padding-block: clamp(var(--space-12), 8vw, var(--space-16));
  text-align: center;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 4vw, var(--text-2xl));
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-4);
}
.hero-sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: var(--space-8);
}
.hero-actions { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; }

/* --- Features --- */
.features { padding-block: var(--space-12); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
  align-items: stretch;
}
@media (max-width: 860px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
}
.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 260px;
}
.feature-header {
  background: var(--color-primary);
  padding: var(--space-4) var(--space-6);
  text-align: center;
}
.feature-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
}
.feature-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: center;
}
.feature-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.feature-card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  flex: 1;
}

/* --- Forms --- */
.form-page { padding-block: var(--space-12); }
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 600px;
  margin-inline: auto;
  box-shadow: var(--shadow-md);
}
.form-header {
  display: flex; align-items: center; gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.form-header h1 { font-family: var(--font-display); font-size: var(--text-xl); }
.form-header p { color: var(--color-text-muted); font-size: var(--text-sm); }

.profile-form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-group label { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }
.required { color: var(--color-primary); }
.field-hint { font-size: var(--text-xs); color: var(--color-text-faint); }

input[type="text"], input[type="number"], input[type="date"], select, textarea {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  width: 100%;
  transition: border-color 150ms ease;
}

input[type="date"] {
  color-scheme: light;
  background: #ffffff;
  color: #18181b;
  border-color: var(--color-primary);
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(145,71,255,0.2);
}
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--color-surface-2); }

/* --- Avatars --- */
.avatar { border-radius: var(--radius-full); object-fit: cover; }
.avatar-sm  { width: 32px;  height: 32px; }
.avatar-md  { width: 48px;  height: 48px; }
.avatar-lg  { width: 64px;  height: 64px; }
.avatar-xl  { width: 96px;  height: 96px; }

/* --- Directory --- */
.directory-page { padding-block: var(--space-8); }
.directory-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap; gap: var(--space-4);
}
.directory-header h1 { font-family: var(--font-display); font-size: var(--text-xl); }

.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-8);
}
.filter-group { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; min-width: 150px; }
.filter-group label { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.streamers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

.streamer-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  display: flex; flex-direction: column; gap: var(--space-4);
}
.streamer-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-md);
}

/* Card header — avatar + identity, cleanly separated from body */
.card-top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

/* Avatar wrapper — provides anchor for the LIVE overlay */
.card-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.avatar-md { border-radius: var(--radius-full); }

/* LIVE pill overlaid on the bottom-center of the avatar */
.card-live-dot {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: #e91916;
  color: #fff;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 2px solid var(--color-surface);
  line-height: 1.5;
  pointer-events: none;
}

/* Name + login group */
.card-identity {
  flex: 1;
  min-width: 0;
}
.card-name {
  font-family: var(--font-display);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-login { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: 1px; }
.card-not-onboarded {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
  margin-top: 3px;
}

/* Flex region that fills available card height so footer is always pinned to bottom */
.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
}

/* Bio: always reserves 2 lines; clamps overflow so long bios don't grow the card */
.card-bio {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.6em * 2);
  line-height: 1.6;
}

/* Meta row (viewer count, etc): consistent height even when empty */
.card-meta-row {
  min-height: 22px;
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* Tags: consistent height, excess wraps hidden */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 24px;
  max-height: 56px;
  overflow: hidden;
  align-content: flex-start;
}
/* --- Tags ---
   Each category has a distinct treatment so cards are scannable.
   `.tag` is the base; modifier classes override colour/weight/border.
*/
.tag {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: rgba(145,71,255,0.15);
  color: var(--color-primary);
  border: 1px solid rgba(145,71,255,0.3);
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.tag-goal {
  background: rgba(245, 166, 35, 0.18);
  color: #f5a623;
  border: 1px solid rgba(245, 166, 35, 0.5);
  font-weight: 700;
  border-left: 3px solid #f5a623;
  max-width: 24ch;
}

.tag-genre {
  background: rgba(145, 71, 255, 0.16);
  color: #c7a7ff;
  border-color: rgba(145, 71, 255, 0.4);
}

.tag-vibe {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  font-style: italic;
}

.tag-country {
  background: rgba(64, 178, 255, 0.12);
  color: #7fc5ff;
  border: 1px solid rgba(64, 178, 255, 0.35);
}

.tag-region {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.tag-interest {
  background: rgba(109, 170, 69, 0.12);
  color: #8fd06b;
  border: 1px solid rgba(109, 170, 69, 0.35);
}

.tag-viewers {
  background: rgba(255, 60, 60, 0.10);
  color: #ff9b9b;
  border: 1px solid rgba(255, 60, 60, 0.30);
  font-weight: 600;
}
.tag-chat-restricted {
  background: rgba(255, 165, 0, 0.12);
  color: #ffb347;
  border: 1px solid rgba(255, 165, 0, 0.35);
  font-weight: 600;
}
.tag-chat-open {
  background: rgba(72, 199, 142, 0.10);
  color: #48c78e;
  border: 1px solid rgba(72, 199, 142, 0.30);
}

.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
  grid-column: 1 / -1;
}
.empty-state-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.empty-state h3 { font-family: var(--font-display); color: var(--color-text); margin-bottom: var(--space-2); }

/* --- Profile page --- */
.profile-page { padding-block: var(--space-8); max-width: 700px; margin-inline: auto; }
.profile-header {
  display: flex; align-items: center; gap: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
}
.profile-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; }
.profile-login { color: var(--color-text-faint); font-size: var(--text-sm); margin-bottom: var(--space-3); }
.profile-actions { margin-top: var(--space-4); }

.profile-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}
.profile-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
}
.profile-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.meta-item label { font-size: var(--text-xs); color: var(--color-text-faint); display: block; margin-bottom: var(--space-1); }
.meta-item span { font-size: var(--text-sm); }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-6);
  text-align: center;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  margin-top: var(--space-16);
}

/* --- Utilities --- */
.text-muted { color: var(--color-text-muted); }
.main-content { padding-block: var(--space-4); }

/* --- Responsive --- */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-meta { grid-template-columns: 1fr; }
  .header-inner { gap: var(--space-3); }
  .site-nav { gap: var(--space-3); }
  .hero-actions { flex-direction: column; align-items: center; }
}

/* Search page additions */
.search-bar { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); }
.search-bar input[type="text"] { flex: 1; font-size: var(--text-base); padding: var(--space-3) var(--space-4); }
.results-count { margin-bottom: var(--space-4); font-size: var(--text-sm); }
.results-count strong { color: var(--color-text); }
.badge-live { margin-left: auto; background: rgba(255,60,60,0.15); color: #ff6b6b; border: 1px solid rgba(255,60,60,0.3); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 700; padding: 2px var(--space-2); white-space: nowrap; }
/* Footer: status badge on its own row, then two equal action buttons below */
.card-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.card-status { font-size: var(--text-xs); }
.card-actions-zone {
  display: flex;
  gap: var(--space-2);
}
/* Both action buttons share the row equally so they are always the same width */
.card-view-btn,
.card-dir-btn {
  flex: 1;
  justify-content: center;
  min-width: 0;
}
/* Favourite button lives in card-top right corner */
.card-top-fav { margin-left: auto; flex-shrink: 0; }
.status-badge { font-size: var(--text-xs); font-weight: 500; }
.status-registered { color: #6daa45; }
.status-unclaimed  { color: var(--color-text-muted); }
.status-new        { color: var(--color-primary); }
.avatar-placeholder { background: var(--color-surface-2); border: 1px solid var(--color-border); display: flex; align-items: center; justify-content: center; font-size: var(--text-lg); color: var(--color-text-faint); }
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); margin-bottom: var(--space-6); }
.alert-error   { background: rgba(161,44,123,0.15);  border: 1px solid rgba(161,44,123,0.3);  color: #d163a7; }
.alert-success { background: rgba(109,170,69,0.15);  border: 1px solid rgba(109,170,69,0.35); color: #8fd06b; }
.alert-warning { background: rgba(245,166,35,0.15);  border: 1px solid rgba(245,166,35,0.4);  color: #f5a623; }
.alert a { text-decoration: underline; }

.badge-unclaimed {
  margin-left: auto;
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  white-space: nowrap;
}


/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.pagination-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Raid + Favorites + CyberGen additions */
.btn-raid { background: rgba(255,60,60,0.15); color: #ff6b6b; border: 1px solid rgba(255,60,60,0.4); }
.btn-raid:hover { background: rgba(255,60,60,0.3); color: #ff6b6b; }
.raid-status-msg { font-size: var(--text-xs); padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); margin-left: var(--space-2); }
.raid-success { background: rgba(109,170,69,0.15); color: #6daa45; }
.raid-error { background: rgba(161,44,123,0.15); color: #d163a7; }

.raid-permission-box { display:flex; gap: var(--space-4); align-items:flex-start; padding: var(--space-4); border-radius: var(--radius-lg); margin-bottom: var(--space-6); border: 1px solid var(--color-border); }
.raid-prompt { background: rgba(145,71,255,0.08); border-color: rgba(145,71,255,0.3); }
.raid-granted { background: rgba(109,170,69,0.08); border-color: rgba(109,170,69,0.3); }
.raid-denied { background: rgba(255,60,60,0.08); border-color: rgba(255,60,60,0.3); }
.raid-icon { font-size: 1.5rem; flex-shrink: 0; }
.raid-permission-box p { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-1); }
.raid-permission-box code { background: var(--color-surface-2); padding: 1px 6px; border-radius: var(--radius-sm); font-size: var(--text-xs); }

.sort-bar { display:flex; align-items:center; gap: var(--space-2); margin-bottom: var(--space-6); flex-wrap: wrap; }
.sort-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight:600; text-transform:uppercase; letter-spacing:.05em; }
.sort-btn { font-size: var(--text-xs); padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); border: 1px solid var(--color-border); color: var(--color-text-muted); background: transparent; }
.sort-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.sort-btn-active { background: rgba(145,71,255,0.15); border-color: var(--color-primary); color: var(--color-primary); }

.form-section-label { font-size: var(--text-xs); font-weight:700; text-transform:uppercase; letter-spacing:.08em; color: var(--color-text-faint); padding-bottom: var(--space-2); border-bottom: 1px solid var(--color-border); }

.glitch-text { color: var(--color-primary); font-weight: 700; letter-spacing: .03em; }
.hero-tag { margin-top: var(--space-6); font-size: var(--text-sm); color: var(--color-text-muted); }
.footer-inner { display:flex; flex-direction:column; align-items:center; gap: var(--space-1); }
.footer-credit { font-size: var(--text-xs); }

/* --- Theme switch --- */
.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 80px;
  height: 26px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  padding: 3px;
  flex-shrink: 0;
  overflow: hidden;
  transition: border-color 150ms ease;
}
.theme-switch:hover { border-color: var(--color-primary); }

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: left 220ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
html[data-theme="light"] .theme-switch-thumb {
  left: calc(50%);
}

.theme-switch-labels {
  display: flex;
  width: 100%;
  pointer-events: none;
  position: relative;
  z-index: 1;
}
.theme-switch-label {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 20px;
  user-select: none;
  transition: color 150ms ease;
}
.theme-switch-label-dark  { color: #fff; }
.theme-switch-label-light { color: var(--color-text-muted); }

html[data-theme="light"] .theme-switch-label-dark  { color: var(--color-text-muted); }
html[data-theme="light"] .theme-switch-label-light { color: #fff; }

/* Search tabs */
.search-tabs { display:flex; gap: var(--space-2); margin-bottom: var(--space-4); }

.search-tab {
  background: #6441a5;
  border: 1px solid #7d5bbe;
  color: #ffffff !important;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.search-tab:hover {
  background: #7d5bbe;
  color: #ffffff !important;
}

.search-tab-active {
  background: #9147ff;
  border-color: #9147ff;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(145, 71, 255, 0.3);
}

.search-panel { margin-bottom: var(--space-6); }

.adv-search-note { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-3); margin-bottom: var(--space-1); }
.adv-search-actions { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); flex-wrap: wrap; }

.per-page-group { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.per-page-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; white-space: nowrap; }
.per-page-select { width: auto; padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }

.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  width: 100%;
  margin-top: var(--space-16);
  margin-bottom: var(--space-4);
  padding-top: var(--space-6);
}

.fav-btn { font-size: 1.1rem; padding: var(--space-1) var(--space-2); }
.fav-active { color: #f5a623; }
.fav-btn:hover { color: #f5a623; }

/* ============================================================
   Directory Filter Panel (Twitch Advanced Search style)
   ============================================================ */

.dir-filter-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.dir-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
}

.dir-filter-row-multiselect {
  align-items: flex-start;
}

.dir-filter-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  margin-block: var(--space-1);
}
.dir-filter-divider::before,
.dir-filter-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.dir-filter-divider-label {
  white-space: nowrap;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.dir-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-height: 0;
}
.dir-active-filters:empty { display: none; }

.dir-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(145,71,255,0.15);
  border: 1px solid rgba(145,71,255,0.35);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
}
.dir-chip-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.65rem;
  padding: 0 2px;
  opacity: 0.7;
  line-height: 1;
}
.dir-chip-remove:hover { opacity: 1; }

.dir-filter-actions {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-1);
}

/* ============================================================
   Multi-select dropdown component
   ============================================================ */

.multi-select {
  position: relative;
  width: 100%;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  width: 100%;
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color 150ms ease;
  text-align: left;
}
.multi-select-trigger:hover,
.multi-select-trigger[aria-expanded="true"] {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(145,71,255,0.15);
}

.multi-select-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.multi-select-badge {
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.multi-select-arrow {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex-shrink: 0;
  transition: transform 150ms ease;
}
.multi-select-trigger[aria-expanded="true"] .multi-select-arrow {
  transform: rotate(180deg);
}

.multi-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 220px;
  max-height: 260px;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 300;
  flex-direction: column;
}
.multi-select-dropdown.ms-open {
  display: flex;
}

.multi-select-search {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.multi-select-search-input {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text);
}
.multi-select-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.multi-select-list {
  overflow-y: auto;
  padding: var(--space-1);
  flex: 1;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: background 100ms ease;
  user-select: none;
}
.multi-select-option:hover { background: var(--color-surface-2); }
.multi-select-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.multi-select-option span { flex: 1; }

/* ============================================================
   How it works — Guide Section
   ============================================================ */
.guide-section {
  padding-block: var(--space-12);
  border-top: 1px solid var(--color-border);
}

.guide-header {
  text-align: center;
  margin-bottom: var(--space-8);
}
.guide-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.guide-header p { color: var(--color-text-muted); }

.guide-steps {
  max-width: 740px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.guide-step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.guide-step.is-open {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(145,71,255,0.15);
}

.guide-step-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  transition: background 120ms ease;
}
.guide-step-trigger:hover { background: var(--color-surface-2); }

.guide-step-num {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  min-width: 24px;
  flex-shrink: 0;
}
.guide-step-label { flex: 1; }
.guide-step-title { display: block; font-weight: 600; font-size: var(--text-base); }
.guide-step-sub   { display: block; font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

.guide-step-arrow {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  flex-shrink: 0;
  transition: transform 220ms ease;
}
.guide-step.is-open .guide-step-arrow { transform: rotate(180deg); }

.guide-step-body { overflow: hidden; }

.guide-step-content {
  padding: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}
.guide-step-content strong { color: var(--color-text); }

.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: var(--space-2);
}
.guide-list li { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.guide-list-spaced { gap: var(--space-4); }
.guide-list-spaced li { flex-direction: column; gap: var(--space-1); }

.guide-note {
  background: rgba(145,71,255,0.07);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Access table inside step 3 */
.guide-access-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: var(--text-xs);
}
.guide-access-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}
.guide-access-row:last-child { border-bottom: none; }
.guide-access-header {
  background: var(--color-surface-2);
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
}
.guide-access-row span:nth-child(2),
.guide-access-row span:nth-child(3) { text-align: center; min-width: 80px; }
.guide-check { color: #6daa45; font-size: var(--text-sm); }
.guide-lock  { color: var(--color-text-faint); font-size: var(--text-sm); }

/* Profile filters section in advanced search */
.profile-filters-section {
  width: 100%;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--color-border);
}
.profile-filters-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  background: rgba(145,71,255,0.08);
  border: 1px solid rgba(145,71,255,0.25);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}
.profile-filters-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
