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

/* ── Variables ── */
:root {
  --primary:       #9146FF;
  --primary-hover: #772CE8;
  --primary-glow:  rgba(145, 70, 255, 0.25);
  --primary-faint: rgba(145, 70, 255, 0.12);
  --danger:        #E84040;
  --danger-hover:  #C62828;
  --success:       #00C853;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --font:          'Inter', system-ui, Arial, sans-serif;
  --ease:          0.18s ease;
}

/* ── Dark theme ── */
:root, [data-theme="dark"] {
  --bg:       #0E0E10;
  --bg2:      #18181B;
  --surface:  #1F1F23;
  --surface2: #27272C;
  --card:     #18181B;
  --border:   #2D2D33;
  --text:     #EFEFF1;
  --muted:    #ADADB8;
  --input-bg: #0E0E10;
  --nav-bg:   rgba(14, 14, 16, 0.92);
  --shadow:   0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg:0 8px 40px rgba(0,0,0,0.50);
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg:       #F2EEFF;
  --bg2:      #FFFFFF;
  --surface:  #FFFFFF;
  --surface2: #EDE8FF;
  --card:     #FFFFFF;
  --border:   #DDD5FF;
  --text:     #18181B;
  --muted:    #5A5470;
  --input-bg: #F2EEFF;
  --nav-bg:   rgba(242, 238, 255, 0.92);
  --shadow:   0 4px 24px rgba(145, 70, 255, 0.10);
  --shadow-lg:0 8px 40px rgba(145, 70, 255, 0.16);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  transition: background var(--ease), color var(--ease);
}

code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--primary);
}

/* ── Navbar ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: 60px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background var(--ease), border-color var(--ease);
}
.nav-left  { display: flex; align-items: center; gap: 14px; min-width: 0; }
.nav-logo  { font-size: 17px; font-weight: 800; color: var(--primary); text-decoration: none; letter-spacing: -0.5px; flex-shrink: 0; }
.nav-sep   { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.nav-page  { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-user  {
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 12px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Layout ── */
.container { max-width: 860px; margin: 0 auto; padding: 32px 24px 64px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.page-header p  { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: background var(--ease), border-color var(--ease);
}

/* ── Section ── */
.section { padding: 20px 0 0; margin-top: 20px; border-top: 1px solid var(--border); }
.section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Status de conexão ── */
.conn-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 3px rgba(0,200,83,0.2); }
.status-dot.offline { background: var(--danger);  box-shadow: 0 0 0 3px rgba(232,64,64,0.2); }

/* ── Buttons ── */
button {
  font-family: var(--font); font-size: 14px; font-weight: 600;
  border: none; border-radius: var(--radius); cursor: pointer;
  padding: 10px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease),
              opacity var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}
button:active   { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 18px var(--primary-glow); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); }

.btn-danger  { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

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

.btn-icon {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 0; width: 36px; height: 36px; border-radius: var(--radius-sm); font-size: 16px;
}
.btn-icon:hover { background: var(--surface2); }

.btn-full { width: 100%; }

.btn-twitch { background: var(--primary); color: #fff; padding: 14px 24px; font-size: 16px; font-weight: 700; width: 100%; border-radius: var(--radius); }
.btn-twitch:hover { background: var(--primary-hover); box-shadow: 0 6px 28px var(--primary-glow); }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 18px;
  transition: color var(--ease);
}
.back-btn:hover  { color: var(--text); }
.back-btn:active { transform: none; }

/* ── Inputs ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

input {
  width: 100%; padding: 10px 14px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-family: var(--font); font-size: 14px; outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-faint); }
input::placeholder { color: var(--muted); opacity: 0.7; }

.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row input { flex: 1; }

/* ── Tags (moderadores) ── */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 36px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-faint); color: var(--primary);
  border: 1px solid rgba(145, 70, 255, 0.4); border-radius: 20px;
  padding: 5px 10px 5px 13px; font-size: 13px; font-weight: 600;
}
.tag-remove {
  background: none; border: none; color: var(--primary); opacity: 0.7;
  padding: 0; width: 18px; height: 18px; font-size: 16px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: opacity var(--ease), background var(--ease), color var(--ease);
}
.tag-remove:hover  { opacity: 1; color: var(--danger); background: rgba(232,64,64,0.12); }
.tag-remove:active { transform: none; }

/* ── Lista de botões (config) ── */
.btn-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.btn-list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: background var(--ease);
}
.btn-list-item:hover { background: var(--surface2); }
.btn-list-info  { flex: 1; min-width: 0; }
.btn-list-label { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-list-action { font-size: 12px; color: var(--muted); font-family: 'Courier New', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* ── Grid de controles (mod) ── */
.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-top: 8px;
}
.control-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 20px 12px; font-size: 14px; font-weight: 600; border-radius: var(--radius);
  width: 100%; text-align: center;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.control-btn:hover:not(:disabled) {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 4px 20px var(--primary-glow);
}
.control-btn:active:not(:disabled) { transform: scale(0.95); }
.control-btn.firing { opacity: 0.6; transform: scale(0.95); }

/* ── Cards de stream (dashboard) ── */
.stream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 10px; }
.stream-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; text-align: center; font-weight: 600; font-size: 14px;
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.stream-card:hover {
  background: var(--primary-faint); border-color: var(--primary);
  box-shadow: 0 4px 20px var(--primary-glow); transform: translateY(-2px);
}
.stream-card:active { transform: scale(0.97) translateY(0); }
.stream-avatar {
  width: 48px; height: 48px;
  background: var(--primary-faint); border: 2px solid var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--primary);
}

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: 320px;
}
.toast {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.22s ease forwards;
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Empty state ── */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px; line-height: 1.8; }
.empty-icon { font-size: 36px; display: block; margin-bottom: 8px; }

/* ── Spinner ── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.65s linear infinite;
  margin: 28px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 40px 32px; }
.login-logo { font-size: 30px; font-weight: 800; color: var(--primary); letter-spacing: -1px; margin-bottom: 6px; }
.login-sub  { color: var(--muted); font-size: 14px; margin-bottom: 36px; line-height: 1.6; }

hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .navbar   { padding: 0 14px; }
  .nav-page { display: none; }
  .nav-user { max-width: 90px; }
  .container { padding: 20px 12px 48px; }
  .card      { padding: 18px; }
  .input-row { flex-direction: column; }
  .input-row button { width: 100%; }
  #toast { right: 12px; left: 12px; max-width: none; }
  .login-card { padding: 28px 20px; }
}
