/* ==========================================================================
   MultiChat Studio — Modern Dark Glassmorphism CSS Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Core Dark Theme */
  --bg-dark: #09090b;
  --bg-surface-1: #121217;
  --bg-surface-2: #181820;
  --bg-surface-3: #22222e;
  --bg-glass: rgba(18, 18, 23, 0.75);
  --bg-glass-card: rgba(25, 25, 35, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.18);

  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Brand Accents */
  --twitch-color: #9146FF;
  --twitch-color-hover: #772CE8;
  --twitch-glow: rgba(145, 70, 255, 0.35);

  --youtube-color: #FF0000;
  --youtube-color-hover: #CC0000;
  --youtube-glow: rgba(255, 0, 0, 0.35);

  --kick-color: #53FC18;
  --kick-color-hover: #00E701;
  --kick-glow: rgba(83, 252, 24, 0.35);

  --accent-primary: #6366F1;
  --accent-primary-hover: #4F46E5;
  --accent-glow: rgba(99, 102, 241, 0.35);

  /* Status Colors */
  --status-success: #10B981;
  --status-warning: #F59E0B;
  --status-danger: #EF4444;
  --status-info: #3B82F6;

  /* Text Colors */
  --text-main: #F4F4F5;
  --text-muted: #A1A1AA;
  --text-dim: #71717A;

  /* Layout & Sizing */
  --header-height: 64px;
  --toolbar-height: 52px;
  --footer-height: 60px;
  --border-radius-sm: 6px;
  --border-radius-md: 10px;
  --border-radius-lg: 16px;
  --border-radius-full: 9999px;

  /* Shadow & Blur */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(16px);

  /* Custom Dynamic Values (Manipulated via JS settings) */
  --chat-font-size: 14px;
  --chat-bg-opacity: 0.85;
}

/* --------------------------------------------------------------------------
   2. Reset & Global Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  font-size: 16px;
  color: var(--text-main);
  background-color: var(--bg-dark);
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* --------------------------------------------------------------------------
   3. Main App Layout Structure
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  position: relative;
  background: radial-gradient(circle at 10% 20%, rgba(145, 70, 255, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(255, 0, 0, 0.05) 0%, transparent 40%),
              var(--bg-dark);
}

/* --------------------------------------------------------------------------
   4. App Header
   -------------------------------------------------------------------------- */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
  flex-shrink: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, var(--twitch-color), var(--youtube-color));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(145, 70, 255, 0.3);
}

.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
  background: linear-gradient(90deg, var(--twitch-color), var(--accent-primary));
  color: #fff;
  letter-spacing: 0.05em;
}

.brand-subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Status Bar & Connection Indicators */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--border-color);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.platform-icon {
  width: 14px;
  height: 14px;
}

.status-twitch .platform-icon { color: var(--twitch-color); }
.status-youtube .platform-icon { color: var(--youtube-color); }
.status-kick .platform-icon { color: var(--kick-color); }

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--text-dim);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.status-indicator.active {
  background-color: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

.status-indicator.connecting {
  background-color: var(--status-warning);
  animation: pulseWarning 1.2s infinite;
}

.status-indicator.error {
  background-color: var(--status-danger);
}

@keyframes pulseWarning {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* --------------------------------------------------------------------------
   5. Toolbar Strip (Filters, Search & Analytics)
   -------------------------------------------------------------------------- */
.toolbar-strip {
  height: var(--toolbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(18, 18, 23, 0.4);
  border-bottom: 1px solid var(--border-color);
  z-index: 9;
  flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Search Input Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 240px;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 32px;
  padding: 0 28px 0 32px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  font-size: 0.82rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(0, 0, 0, 0.5);
}

.search-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--border-radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn i {
  width: 13px;
  height: 13px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--bg-surface-3);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.tab-btn.tab-twitch.active {
  background: rgba(145, 70, 255, 0.2);
  color: #c084fc;
}

.tab-btn.tab-youtube.active {
  background: rgba(255, 0, 0, 0.2);
  color: #fca5a5;
}

.tab-btn.tab-kick.active {
  background: rgba(83, 252, 24, 0.2);
  color: #53FC18;
}

.tab-count {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

/* Metrics & Ratio Bar */
.metric-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-value {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.metric-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
}

.ratio-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ratio-bar {
  width: 80px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  overflow: hidden;
}

.ratio-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.ratio-twitch { background-color: var(--twitch-color); }
.ratio-youtube { background-color: var(--youtube-color); }
.ratio-kick { background-color: var(--kick-color); }

.ratio-text {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. Main Chat Viewport & Messages Feed
   -------------------------------------------------------------------------- */
.chat-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

/* Empty State Styling */
.empty-state {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
  padding: 40px 20px;
  background: var(--bg-glass-card);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-icon i {
  width: 28px;
  height: 28px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Single Message Card Styling */
.msg-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  background: rgba(18, 18, 23, var(--chat-bg-opacity));
  border: 1px solid var(--border-color);
  font-size: var(--chat-font-size);
  line-height: 1.45;
  position: relative;
  animation: slideInMessage 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: background 0.2s, border-color 0.2s;
  word-break: break-word;
}

.msg-card:hover {
  border-color: var(--border-color-hover);
  background: rgba(28, 28, 36, 0.9);
}

@keyframes slideInMessage {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Platform specific border indicators */
.msg-card.platform-twitch {
  border-left: 3px solid var(--twitch-color);
}

.msg-card.platform-youtube {
  border-left: 3px solid var(--youtube-color);
}

/* Highlighted / Mentioned / SuperChat Messages */
.msg-card.msg-superchat {
  background: linear-gradient(135deg, rgba(255, 179, 0, 0.15), rgba(255, 0, 0, 0.15));
  border: 1px solid rgba(255, 179, 0, 0.4);
  box-shadow: 0 4px 16px rgba(255, 179, 0, 0.15);
}

.msg-card.msg-highlight {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

/* Message Parts */
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-color);
}

.msg-main {
  flex: 1;
  min-width: 0;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
}

.platform-badge.twitch {
  background: var(--twitch-color);
  color: #fff;
}

.platform-badge.youtube {
  background: var(--youtube-color);
  color: #fff;
}

.platform-badge i {
  width: 11px;
  height: 11px;
}

.msg-author {
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
}

.msg-author:hover {
  text-decoration: underline;
}

/* Role Badges */
.badge-role {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-broadcaster {
  background: #E0E7FF;
  color: #3730A3;
}

.badge-mod {
  background: #D1FAE5;
  color: #065F46;
}

.badge-sub {
  background: #FCE7F3;
  color: #9D174D;
}

.badge-verified {
  background: #E0F2FE;
  color: #075985;
}

.msg-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-left: auto;
}

.msg-content {
  color: var(--text-main);
  font-weight: 400;
}

.msg-emote {
  display: inline-block;
  vertical-align: middle;
  height: 24px;
  margin: -4px 2px;
}

.superchat-amount {
  display: inline-block;
  font-weight: 800;
  font-size: 0.9rem;
  color: #FBBF24;
  margin-left: 6px;
}

/* Jump to bottom float button */
.jump-bottom-btn {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius-full);
  background: var(--accent-primary);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  z-index: 15;
  transition: transform 0.2s, background 0.2s;
}

.jump-bottom-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateX(-50%) scale(1.04);
}

.unread-badge {
  background: #fff;
  color: var(--accent-primary);
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   7. Footer Input Bar & Dedicated Legal Bottom Bar
   -------------------------------------------------------------------------- */
.chat-footer {
  height: var(--footer-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 10;
}

.legal-disclaimer-footer {
  padding: 10px 20px;
  background: var(--bg-surface-1);
  border-top: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  flex-shrink: 0;
  z-index: 10;
}

.legal-disclaimer-footer .footer-container {
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.legal-disclaimer-footer .footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legal-disclaimer-footer .footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legal-disclaimer-footer .footer-brand-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.legal-disclaimer-footer .footer-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--border-radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-color);
}

.legal-disclaimer-footer .footer-tag svg {
  width: 12px;
  height: 12px;
}

.legal-disclaimer-footer .twitch-tag {
  background: rgba(145, 70, 255, 0.12);
  color: #a76bcf;
  border-color: rgba(145, 70, 255, 0.25);
}

.legal-disclaimer-footer .youtube-tag {
  background: rgba(255, 0, 0, 0.12);
  color: #ff6b6b;
  border-color: rgba(255, 0, 0, 0.25);
}

.legal-disclaimer-footer .footer-purpose {
  font-size: 0.78rem;
  color: var(--text-muted);
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
}

.legal-disclaimer-footer .footer-right {
  display: flex;
  align-items: center;
}

.legal-disclaimer-footer .footer-privacy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-surface-2);
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.legal-disclaimer-footer .footer-privacy-btn svg {
  width: 14px;
  height: 14px;
  color: var(--accent-primary);
  transition: color 0.2s ease;
}

.legal-disclaimer-footer .footer-privacy-btn:hover {
  background: var(--bg-surface-3);
  border-color: var(--accent-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.legal-disclaimer-footer .footer-privacy-btn:hover svg {
  color: #818cf8;
}

@media (max-width: 768px) {
  .legal-disclaimer-footer .footer-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .legal-disclaimer-footer .footer-left {
    justify-content: center;
  }
  .legal-disclaimer-footer .footer-purpose {
    border-left: none;
    padding-left: 0;
    width: 100%;
  }
}

.chat-input-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-platform-selector select {
  height: 38px;
  padding: 0 10px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-2);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.chat-input-wrapper input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.btn-send {
  height: 38px;
}

/* --------------------------------------------------------------------------
   8. Buttons & Controls Design System
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--border-radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn i {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4338CA);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4F46E5, #3730A3);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-surface-3);
  border-color: var(--border-color-hover);
}

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

.btn-twitch:hover {
  background: var(--twitch-color-hover);
}

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

.btn-youtube:hover {
  background: var(--youtube-color-hover);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--border-radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-icon:hover {
  background: var(--bg-surface-3);
  border-color: var(--border-color-hover);
}

.btn-tool {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-tool i {
  width: 14px;
  height: 14px;
}

.btn-tool:hover {
  background: var(--bg-surface-3);
  color: var(--text-main);
}

.btn-tool.active {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

#btnOpenErrorLog {
  position: relative;
  width: auto;
  min-width: 34px;
  padding: 0 8px;
  gap: 4px;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-danger);
  border-color: var(--status-danger);
}

/* --------------------------------------------------------------------------
   9. Modals & Drawers Styling
   -------------------------------------------------------------------------- */
.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 620px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.modal-header, .drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title, .drawer-title {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-accent {
  color: var(--accent-primary);
}

.modal-close, .drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: var(--border-radius-sm);
}

.modal-close:hover, .drawer-close:hover {
  color: var(--text-main);
  background: var(--bg-surface-3);
}

.modal-body, .drawer-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-footer, .drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface-2);
}

/* Auth Provider Cards */
.auth-provider-card {
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  background: var(--bg-surface-2);
}

.provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.provider-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-icon {
  width: 24px;
  height: 24px;
}

.provider-twitch .provider-icon { color: var(--twitch-color); }
.provider-youtube .provider-icon { color: var(--youtube-color); }

.provider-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.provider-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.provider-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.link-helper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.link-helper:hover {
  color: #818cf8;
  text-decoration: underline;
}

.link-helper i {
  width: 12px;
  height: 12px;
}

.link-helper-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.link-helper-inline {
  color: #818cf8;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.link-helper-inline:hover {
  text-decoration: underline;
}

/* 1-Click SSO Grid & User Profiles */
.sso-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 10px 0;
}

.btn-lg {
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
}

.btn-lg i {
  width: 20px;
  height: 20px;
}

@media (max-width: 580px) {
  .sso-buttons-grid {
    grid-template-columns: 1fr;
  }
}

.connected-profiles-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color-hover);
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.profile-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-platform {
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.profile-platform.twitch { color: var(--twitch-color); }
.profile-platform.youtube { color: var(--youtube-color); }

.profile-details h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.76rem;
}

.advanced-config-accordion {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  margin-top: 10px;
}

.accordion-header {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.accordion-header:hover {
  color: var(--text-main);
}

.mt-3 {
  margin-top: 12px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
}

.form-hint {
  font-size: 0.74rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.switch-group {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.switch-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* OBS URL Box & Instructions */
.url-copy-box {
  display: flex;
  gap: 8px;
}

.url-copy-box input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-primary);
}

.obs-instructions {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--border-radius-md);
  padding: 14px;
  border: 1px solid var(--border-color);
}

.obs-instructions h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.obs-instructions ol {
  padding-left: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Drawer Panel (Slide from Right) */
.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface-1);
  border-left: 1px solid var(--border-color-hover);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.setting-section {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--border-radius-md);
  background: var(--bg-surface-3);
  border: 1px solid var(--border-color-hover);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   10. OBS Overlay Mode (Transparent Background Stream Mode)
   -------------------------------------------------------------------------- */
body.mode-overlay,
body.mode-overlay .app-container {
  background: transparent !important;
}

body.mode-overlay .app-header,
body.mode-overlay .toolbar-strip,
body.mode-overlay .chat-footer,
body.mode-overlay .legal-disclaimer-footer,
body.mode-overlay .jump-bottom-btn {
  display: none !important;
}

body.mode-overlay .chat-viewport {
  height: 100vh;
}

body.mode-overlay .msg-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Fade Out Animation for OBS Overlay */
.msg-card.fade-out {
  animation: fadeOutMessage 0.8s ease forwards;
}

@keyframes fadeOutMessage {
  to {
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
  }
}

/* --------------------------------------------------------------------------
   11. Diagnostic Error Log Modal & Console Box
   -------------------------------------------------------------------------- */
.log-badge-count {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--status-danger);
  color: #fff;
  padding: 1px 5px;
  border-radius: 9999px;
  margin-left: 4px;
}

.modal-card.modal-lg {
  max-width: 820px;
  width: 90%;
}

.log-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.log-console-box {
  background: #050608;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 380px;
  overflow-y: auto;
  color: #d1d5db;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-empty-msg {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.log-entry {
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-primary);
  word-break: break-word;
}

.log-entry.level-error {
  border-left-color: var(--status-danger);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

.log-entry.level-warn {
  border-left-color: var(--status-warning);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
}

.log-entry.level-info {
  border-left-color: var(--status-info);
}

.log-timestamp {
  color: var(--text-dim);
  font-size: 0.72rem;
  margin-right: 6px;
}

.log-tag {
  font-weight: 700;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 6px;
  text-transform: uppercase;
}

.log-tag.platform-twitch { background: rgba(145, 70, 255, 0.2); color: #c084fc; }
.log-tag.platform-youtube { background: rgba(255, 0, 0, 0.2); color: #fca5a5; }
.log-tag.platform-kick { background: rgba(83, 252, 24, 0.2); color: #53FC18; }
.log-tag.platform-oauth { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.log-tag.platform-system { background: rgba(255, 255, 255, 0.1); color: #d1d5db; }

.log-details {
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.85;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: 4px;
}
