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

:root {
  --jm-app-css-loaded: "bot-platform";
  --bot-bg: #0b0f16;
  --bot-surface: #141821;
  --bot-surface-2: #10141d;
  --bot-cyan: #00E5FF;
  --bot-purple: #7A3CFF;
  --bot-pink: #FF2EDB;
  --bot-white: #FFFFFF;
  --bot-muted: #A6AD88;
  --bot-border: rgba(0, 229, 255, 0.32);
  --bot-border-muted: rgba(166, 173, 136, 0.28);
  --bot-shadow-cyan: 0 0 22px rgba(0, 229, 255, 0.14);
  --bot-shadow-purple: 0 0 24px rgba(122, 60, 255, 0.16);
  --bot-font-heading: "Rajdhani", "Inter", Arial, sans-serif;
  --bot-font-body: "Inter", Arial, sans-serif;
}

html, body {
  margin: 0;
  font-family: var(--bot-font-body);
  background: var(--bot-bg);
  color: var(--bot-white);
}

.jm-auth-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--bot-white);
  font-family: var(--bot-font-body);
  font-size: clamp(1rem, 1.2vw, 1.35rem);
  background: rgba(11, 15, 22, 0.82);
}

.jm-auth-spinner {
  width: clamp(2.75rem, 4vw, 4.25rem);
  height: clamp(2.75rem, 4vw, 4.25rem);
  border: 0.28rem solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--bot-cyan);
  border-radius: 50%;
  animation: jm-auth-spin 0.8s linear infinite;
}

@keyframes jm-auth-spin {
  to {
    transform: rotate(360deg);
  }
}

a {
  color: var(--bot-cyan);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--bot-border);
  background: linear-gradient(90deg, var(--bot-surface), rgba(122, 60, 255, 0.16));
  box-shadow: var(--bot-shadow-cyan);
}

.brand {
  font-size: 1.2rem;
  font-family: var(--bot-font-heading);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--bot-muted);
}

.nav {
  display: flex;
  gap: 1rem;
}

.content {
  padding: 1.5rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card, .index-card, .commands-card, .integrations-card, .overlays-card {
  padding: 1rem;
  border: 1px solid var(--bot-border) !important;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--bot-surface), var(--bot-surface-2));
  box-shadow: var(--bot-shadow-purple);
}

.status-pill {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill--ok {
  background: rgba(0, 229, 255, 0.12);
  color: var(--bot-cyan);
  border: 1px solid rgba(0, 229, 255, 0.35);
}

.status-pill--error {
  background: rgba(255, 46, 219, 0.12);
  color: var(--bot-pink);
  border: 1px solid rgba(255, 46, 219, 0.35);
}

.status-pill--warn {
  background: rgba(166, 173, 136, 0.14);
  color: var(--bot-muted);
  border: 1px solid var(--bot-border-muted);
}

.status-info {
  color: var(--bot-muted);
}

.status-error {
  color: var(--bot-pink);
}

.status-refresh-btn {
  margin-top: 0.5rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--bot-border);
  border-radius: 8px;
  background: rgba(122, 60, 255, 0.14);
  color: var(--bot-white);
  cursor: pointer;
}

.status-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.status-input {
  min-width: 260px;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--bot-border);
  background: var(--bot-bg);
  color: var(--bot-white);
}

.broadcaster-live-inline-label {
  margin-left: 0.6rem;
}

.card-divider {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid var(--bot-border-muted);
}

.chat-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.chat-toggle-label {
  font-weight: 600;
}

.chat-switch-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.chat-switch-label {
  color: var(--bot-muted);
  font-weight: 600;
}

.chat-switch-label-selected {
  color: var(--bot-white);
}

.chat-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}

.chat-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.chat-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bot-surface);
  border: 1px solid var(--bot-border-muted);
  border-radius: 999px;
  transition: 0.2s ease;
}

.chat-switch-slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: var(--bot-white);
  border-radius: 50%;
  transition: 0.2s ease;
}

.chat-switch input:checked + .chat-switch-slider {
  background: linear-gradient(90deg, var(--bot-cyan), var(--bot-purple));
}

.chat-switch input:checked + .chat-switch-slider::before {
  transform: translateX(22px);
}

.chat-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.chat-account-card {
  border: 1px solid var(--bot-border-muted);
  border-radius: 10px;
  padding: 0.8rem;
  background: var(--bot-bg);
}

.twitch-chat-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(420px, 1.25fr);
  gap: 1rem;
  align-items: start;
}

.twitch-chat-right {
  min-width: 0;
}

.chat-panel {
  margin-top: 0;
}

.chat-log {
  min-height: 320px;
  max-height: 420px;
  overflow-y: auto;
  margin: 0.6rem 0;
  padding: 0.6rem;
  border: 1px solid var(--bot-border);
  border-radius: 8px;
  background: var(--bot-bg);
}

@media (max-width: 1100px) {
  .twitch-chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    margin-top: 0.8rem;
  }
}

.chat-log-empty {
  margin: 0;
  color: var(--bot-muted);
}

.chat-line {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
}

.chat-line-system {
  color: var(--bot-cyan);
}

.chat-time {
  color: var(--bot-muted);
  margin-right: 0.4rem;
}

.chat-sender {
  color: var(--bot-cyan);
  margin-right: 0.35rem;
}

.oauth-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 22, 0.86);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.oauth-dialog {
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: var(--bot-surface);
  border: 1px solid var(--bot-border);
  border-radius: 12px;
  padding: 1rem;
}

.oauth-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.oauth-close-btn {
  margin-top: 0;
}

.oauth-dialog-frame-wrap {
  border: 1px solid var(--bot-border-muted);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.6rem;
}

.oauth-dialog-frame {
  width: 100%;
  min-height: 600px;
  border: 0;
  background: var(--bot-bg);
}
