/* ═══════════════════════════════════════════════════════════════════════════
   TWITCH MOD TOOL — Premium Dark UI
   Aesthetic: Refined dark with purple depth, glass surfaces, crisp type
═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --bg:          #08080f;
  --bg-2:        #0d0d17;
  --surface:     #11111e;
  --surface-2:   #181828;
  --surface-3:   #1e1e30;
  --surface-4:   #252538;
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);
  --purple:      #9147ff;
  --purple-2:    #a855f7;
  --purple-3:    #c084fc;
  --purple-glow: rgba(145, 71, 255, 0.25);
  --purple-dim:  rgba(145, 71, 255, 0.1);
  --text:        #f0f0f8;
  --text-2:      #a0a0c0;
  --text-3:      #60607a;
  --text-4:      #383852;
  --green:       #10b981;
  --green-dim:   rgba(16, 185, 129, 0.12);
  --red:         #f43f5e;
  --red-dim:     rgba(244, 63, 94, 0.12);
  --amber:       #f59e0b;
  --amber-dim:   rgba(245, 158, 11, 0.1);
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --font:        'Sora', sans-serif;
  --font-mono:   'DM Mono', monospace;
  --shadow:      0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.6);
  --shadow-purple: 0 0 40px rgba(145,71,255,0.12);
  --ease:        cubic-bezier(0.16, 1, 0.3, 1);
  --t:           200ms;
  --t-slow:      350ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(rgba(145,71,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145,71,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; }
a { color: var(--purple-3); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
.hidden { display: none !important; }

/* ── Page Loader ─────────────────────────────────────────────────────────── */
.page-loader { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 999; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8, 8, 15, 0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; max-width: 1080px; margin: 0 auto;
  padding: 0 1.5rem; height: 60px;
}
.header-brand { display: flex; align-items: center; gap: 0.625rem; }
.twitch-logo { width: 20px; height: 24px; fill: var(--purple); filter: drop-shadow(0 0 8px var(--purple-glow)); flex-shrink: 0; }
.brand-name {
  font-size: 1rem; font-weight: 800; letter-spacing: -0.04em;
  background: linear-gradient(135deg, #fff 20%, var(--purple-3));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header-user { display: flex; align-items: center; gap: 0.625rem; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--purple); box-shadow: 0 0 10px var(--purple-glow); }
.user-name { font-size: 0.875rem; font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: inherit; font-size: 0.875rem; font-weight: 600;
  line-height: 1; white-space: nowrap;
  transition: all var(--t) var(--ease);
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-2); box-shadow: 0 0 20px var(--purple-glow); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; border-radius: var(--radius-lg); }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content { max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem; min-height: calc(100vh - 60px); }

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-prompt { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 120px); }
.login-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg), var(--shadow-purple);
  animation: fadeUp 0.5s var(--ease);
  position: relative;
}
.login-card::after {
  content: '';
  position: absolute; top: -1px; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--purple), transparent);
}
.login-icon { width: 44px; height: 52px; fill: var(--purple); margin: 0 auto 1.5rem; filter: drop-shadow(0 0 20px var(--purple-glow)); }
.login-card h2 {
  font-size: 1.625rem; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 0.625rem;
  background: linear-gradient(135deg, var(--text), var(--purple-3));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-card > p { color: var(--text-2); font-size: 0.9rem; line-height: 1.7; margin-bottom: 2rem; }
.scope-info { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: left; }
.scope-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 0.75rem; }
.scope-info ul { display: flex; flex-direction: column; gap: 0.5rem; }
.scope-info li { font-size: 0.82rem; color: var(--text-2); display: flex; align-items: flex-start; gap: 0.5rem; }
.scope-info li::before { content: '→'; color: var(--purple-3); font-size: 0.75rem; flex-shrink: 0; margin-top: 2px; }
.scope-info code { background: var(--purple-dim); border: 1px solid rgba(145,71,255,0.2); padding: 1px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--purple-3); }

/* ── App Shell ───────────────────────────────────────────────────────────── */
.app { animation: fadeUp 0.4s var(--ease); }

/* ── Tab Navigation ──────────────────────────────────────────────────────── */
.tab-nav {
  display: flex; gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.375rem;
  margin-bottom: 2rem;
  width: fit-content;
}
.tab-btn {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border-radius: calc(var(--radius-lg) - 4px);
  color: var(--text-3); font-size: 0.85rem; font-weight: 600;
  transition: all var(--t) var(--ease);
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: var(--text-2); background: var(--surface-2); }
.tab-btn.active { background: var(--purple); color: #fff; box-shadow: 0 0 16px var(--purple-glow); }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.tab-panel { animation: fadeIn var(--t-slow) var(--ease); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.panel-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.3rem; }
.panel-desc { font-size: 0.85rem; color: var(--text-2); line-height: 1.6; }
.panel-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── State Area ──────────────────────────────────────────────────────────── */
.state-area { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 1rem; gap: 1rem; text-align: center; }
.state-message { color: var(--text-3); font-size: 0.875rem; }
.state-error { color: var(--red); font-size: 0.875rem; max-width: 400px; line-height: 1.6; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner { width: 28px; height: 28px; border: 2.5px solid var(--surface-3); border-top-color: var(--purple); border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner--lg { width: 40px; height: 40px; border-width: 3px; }

/* ── User Grid ───────────────────────────────────────────────────────────── */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.875rem; margin-bottom: 1.5rem; }

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  transition: all var(--t) var(--ease);
  animation: fadeUp 0.3s var(--ease) both;
}
.user-card:hover { border-color: rgba(145,71,255,0.3); background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(145,71,255,0.12); }
.user-card-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); flex-shrink: 0; border: 1.5px solid var(--border-2); }
.user-card-name { font-size: 0.875rem; font-weight: 600; line-height: 1.3; }
.user-card-login { font-size: 0.75rem; color: var(--text-3); margin-top: 1px; }

.user-card:nth-child(1)  { animation-delay: 0ms; }
.user-card:nth-child(2)  { animation-delay: 25ms; }
.user-card:nth-child(3)  { animation-delay: 50ms; }
.user-card:nth-child(4)  { animation-delay: 75ms; }
.user-card:nth-child(5)  { animation-delay: 100ms; }
.user-card:nth-child(6)  { animation-delay: 125ms; }
.user-card:nth-child(7)  { animation-delay: 150ms; }
.user-card:nth-child(8)  { animation-delay: 175ms; }
.user-card:nth-child(9)  { animation-delay: 200ms; }
.user-card:nth-child(10) { animation-delay: 225ms; }

/* ── List Footer ─────────────────────────────────────────────────────────── */
.list-footer { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; border-top: 1px solid var(--border); gap: 1rem; }
.count-badge { font-size: 0.8rem; color: var(--text-3); }

/* ── Info Boxes ──────────────────────────────────────────────────────────── */
.info-box { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.25rem; border-radius: var(--radius-lg); margin-bottom: 1.75rem; font-size: 0.85rem; }
.info-box svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.info-box strong { display: block; font-weight: 700; margin-bottom: 0.25rem; font-size: 0.875rem; }
.info-box p { color: var(--text-2); line-height: 1.65; }
.info-box--warning { background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.2); }
.info-box--warning svg { color: var(--amber); }
.info-box--warning strong { color: var(--amber); }
.info-box--irc { background: rgba(145,71,255,0.07); border: 1px solid rgba(145,71,255,0.2); }
.info-box--irc svg { color: var(--purple-3); }
.info-box--irc strong { color: var(--purple-3); }
.info-box--irc code { background: rgba(145,71,255,0.15); border: 1px solid rgba(145,71,255,0.2); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--purple-3); }

/* ── Search Forms ────────────────────────────────────────────────────────── */
.search-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 1.75rem; margin-bottom: 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.search-form--inline { padding: 1.25rem 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group--row { flex-direction: row; align-items: center; gap: 0.5rem; }
.form-group--row .form-input { flex: 1; }
.form-label { font-size: 0.8rem; font-weight: 700; color: var(--text-2); letter-spacing: 0.01em; }
.label-hint { font-weight: 400; color: var(--text-3); font-size: 0.78rem; }
.form-input, .form-textarea { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: inherit; font-size: 0.875rem; padding: 0.625rem 0.875rem; transition: all var(--t) var(--ease); width: 100%; resize: vertical; outline: none; }
.form-input:focus, .form-textarea:focus { border-color: rgba(145,71,255,0.5); background: var(--surface); box-shadow: 0 0 0 3px rgba(145,71,255,0.1); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-4); }
.form-input.error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(244,63,94,0.1); }
.form-hint { font-size: 0.78rem; color: var(--text-3); }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Check Results ───────────────────────────────────────────────────────── */
.check-results { margin-top: 1.5rem; }
.check-target { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 1.25rem; }
.check-target-avatar { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--purple); box-shadow: 0 0 12px var(--purple-glow); }
.check-target-name { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }
.check-target-login { color: var(--text-3); font-size: 0.82rem; margin-top: 1px; }
.check-limitation { background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.18); border-radius: var(--radius); padding: 0.875rem 1rem; font-size: 0.82rem; color: var(--text-2); margin-bottom: 1.25rem; line-height: 1.6; }
.check-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.check-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.check-table th { text-align: left; padding: 0.75rem 1.25rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.check-table td { padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.check-table tr:last-child td { border-bottom: none; }
.check-table tr:hover td { background: var(--surface-2); }
.check-table .channel-cell { display: flex; align-items: center; gap: 0.625rem; }
.channel-avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; }
.badge svg { width: 11px; height: 11px; }
.badge--mod        { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge--nomod      { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(244,63,94,0.2); }
.badge--restricted { background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border); }

/* ── History ─────────────────────────────────────────────────────────────── */
.history-panel { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.875rem; }
.history-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.history-list { display: flex; flex-direction: column; gap: 0.375rem; }
.history-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.875rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.82rem; cursor: pointer; transition: all var(--t) var(--ease); }
.history-item:hover { border-color: rgba(145,71,255,0.3); background: var(--surface-2); }
.history-type-badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-3); font-weight: 600; flex-shrink: 0; }
.history-query { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.history-time { font-size: 0.72rem; color: var(--text-4); flex-shrink: 0; font-family: var(--font-mono); }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none; }
.toast { background: var(--surface-3); border: 1px solid var(--border-2); border-radius: var(--radius-lg); padding: 0.75rem 1rem; font-size: 0.85rem; max-width: 320px; pointer-events: auto; animation: slideIn 0.3s var(--ease); display: flex; align-items: center; gap: 0.625rem; box-shadow: var(--shadow); }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast span { color: var(--text-2); }
.toast--success { border-color: rgba(16,185,129,0.3); color: var(--green); }
.toast--error   { border-color: rgba(244,63,94,0.3);  color: var(--red); }
.toast--info    { border-color: rgba(145,71,255,0.3); color: var(--purple-3); }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main-content { padding: 1rem; }
  .header-inner { padding: 0 1rem; }
  .tab-nav { width: 100%; }
  .tab-btn { flex: 1; justify-content: center; padding: 0.5rem; font-size: 0.78rem; }
  .user-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.625rem; }
  .panel-header { flex-direction: column; }
  .search-form { padding: 1.25rem; border-radius: var(--radius-lg); }
  .login-card { padding: 2rem 1.5rem; }
  .toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}
