/* ==========================================================
   Chatbox-Overlay-Modul
   Konfigurationsseite im selben Karten-/Akkordeon-Look wie das
   Alerts-Modul (siehe style/alerts.css) - eigenstaendiges, auf #chatPage
   skopiertes Stylesheet (cu-* statt au-* Klassenpraefix), damit beide
   Module unabhaengig voneinander bleiben.

   Vorgabe: Border-Radius in diesem Modul ist ueberall maximal 3px, analog
   zur Vorgabe im Alerts-Modul - siehe Abschnitt "Radius-Cap" unten.
   ========================================================== */

:root {
  --msg-opacity: 0.55;
  --chat-font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --header-font-size: 15px;
  --msg-font-size: 15px;
  --msg-text-transform: none;
  --msg-font-style: normal;
  --msg-font-weight: normal;
  --custom-bg-rgb: 0, 0, 0;
  --custom-text: #ffffff;
}

#chatPage { display: flex; flex-direction: column; gap: 18px; }

/* Login-Hinweis: siehe globale .login-notice (boxen.css). */

/* ---------- OBS-Link-Zeile ---------- */
#chatPage .cu-topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 3px; padding: 12px 16px;
}
#chatPage .cu-topbar label {
  color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; flex-shrink: 0;
}
#chatPage .cu-topbar .url-box { flex: 1; min-width: 220px; }

/* ---------- Layout ---------- */
#chatPage .cu-layout { display: flex; gap: 20px; align-items: flex-start; }
#chatPage .cu-panel { flex: 1.3; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#chatPage .cu-side { flex: 1; min-width: 0; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Karten & Tabs außerhalb ---------- */
#chatPage .cu-card-wrapper {
  display: flex;
  flex-direction: column;
  /* gap: 8px; Abstand zwischen den Tabs außerhalb und der Box */
}

/* Tabs auf dem Rand außerhalb platziert */
#chatPage .cu-card-wrapper .tabs {
  display: flex;
  /* gap: 6px; */
  padding-left: 10px;
}

#chatPage .cu-card-wrapper .tabs .tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  transition: all 0.2s ease;
}

#chatPage .cu-card-wrapper .tabs .tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

#chatPage .cu-card-wrapper .tabs .tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border);
  border-bottom-color: var(--bg-card);
  margin-bottom: -1px;
  z-index: 2;
}

/* ---------- Karten ----------
   Basis kommt vom globalen .card (boxen.css) - hier bleiben nur die
   Akzentfarben je Abschnitt. */
#chatPage .cu-card--appearance { border-left-color: #4a6fff; }
#chatPage .cu-card--behavior { border-left-color: var(--warning); }
#chatPage .cu-card--badges { border-left-color: var(--success); }
#chatPage .cu-cardbody { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Grids & Felder ---------- */
#chatPage .cu-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

#chatPage .cu-rangerow { display: flex; flex-direction: column; gap: 6px; }
#chatPage .cu-rangetop { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
#chatPage .cu-rangetop .cu-val { color: var(--text-primary); font-weight: 700; text-transform: none; letter-spacing: 0; }
/* .cu-colorrow: siehe globale .color-row (formulare.css). */

#customColorRow { display: none; }
#customColorRow.visible { display: grid; }

/* Toggle-Switch/.cu-switchgroup/.cu-switchitem: kommen jetzt von den
   globalen .switch/.switch-group/.switch-item (formulare.css). */

/* ---------- Vorschau-Spalte ---------- */
#chatPage .cu-side h3 { margin: 0; }
#chatPage .cu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
#chatPage .cu-status { font-size: 13px; color: var(--mono-text); font-weight: 600; }

/* ---------- Radius-Cap: max. 3px, auch fuer global geerbte Formularelemente ---------- */
#chatPage select,
#chatPage input[type="text"],
#chatPage input[type="number"],
#chatPage input[type="color"],
#chatPage textarea,
#chatPage .url-box,
#chatPage .back-btn,
#chatPage button {
  border-radius: 3px;
}

/* Buttons: kommen jetzt von den globalen .btn/.btn-secondary (buttons.css). */

/* ---------- Chat-Vorschau (tatsaechliche Overlay-Optik) ----------
   Basis-Optik (gestrichelte Box, ausgeblendeter Scrollbar) kommt jetzt
   global aus .cu-stage (style/basis.css) - hier nur noch die
   Chat-spezifischen Abweichungen. */
#chat.cu-stage {
    height: 100%;
    font-family: var(--chat-font-family);
  }
  #chat.cu-stage.start-top {
    justify-content: flex-start;
  }

.msg {
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(0, 0, 0, var(--msg-opacity));
    max-width: 100%;
    position: relative;
  }
  .msg .del-btn {
    display: inline-block;
    position: absolute;
    top: 4px;
    right: 8px;
    cursor: pointer;
    color: var(--danger);
    font-size:14px;
    font-weight: bold;
    background: rgba(0,0,0,0.6);
    border-radius: 3px;
    padding: 1px 5px;
  }

.msg .line1 {
    font-size: var(--header-font-size);
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow:
      -1px -1px 0 #111,
       1px -1px 0 #111,
      -1px  1px 0 #111,
       1px  1px 0 #111,
       0 2px 4px rgba(0,0,0,0.8);
  }
  .msg .time {
    font-weight: 400;
    color: #cfcfcf;
    font-size: 0.8em;
  }
  .msg .line2 {
    font-size: var(--msg-font-size);
    text-transform: var(--msg-text-transform);
    font-style: var(--msg-font-style);
    font-weight: var(--msg-font-weight);
    color: #fff;
    margin-top: 2px;
    word-wrap: break-word;
    word-break: break-word;
    text-shadow:
      -1px -1px 0 #111,
       1px -1px 0 #111,
      -1px  1px 0 #111,
       1px  1px 0 #111,
       0 2px 4px rgba(0,0,0,0.8);
  }

#chat.theme-light .msg {
    background: rgba(255, 255, 255, var(--msg-opacity));
  }
  #chat.theme-light .msg .line1,
  #chat.theme-light .msg .line2 {
    color: #111;
    text-shadow:
      -1px -1px 0 var(--text-tertiary),
       1px -1px 0 var(--text-tertiary),
      -1px  1px 0 var(--text-tertiary),
       1px  1px 0 var(--text-tertiary),
       0 1px 3px rgba(255,255,255,0.9);
  }
  #chat.theme-light .msg .time {
    color: #444;
  }

#chat.theme-custom .msg {
    background: rgba(var(--custom-bg-rgb), var(--msg-opacity));
  }
  #chat.theme-custom .msg .line1,
  #chat.theme-custom .msg .line2 {
    color: var(--custom-text);
    text-shadow:
      -1px -1px 0 rgba(0,0,0,0.6),
       1px -1px 0 rgba(0,0,0,0.6),
      -1px  1px 0 rgba(0,0,0,0.6),
       1px  1px 0 rgba(0,0,0,0.6);
  }
  #chat.theme-custom .msg .time {
    color: var(--custom-text);
    opacity: 0.75;
  }

  .msg .line2 img.emote {
    height: 1.6em;
    width: auto;
    vertical-align: middle;
    margin: -4px 2px;
    display: inline-block;
  }

  .msg .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-shadow: none;
  }
  .badge.broadcaster { background: var(--live-color); }
  .badge.moderator { background: #00ad03; }
  .badge.vip { background: #e005b9; }
  .badge.subscriber { background: var(--accent); }
  .badge.default { background: #555; }

  .badge-topright {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: var(--header-font-size);
  }

.real-badge {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    border-radius: 2px;
  }

@keyframes anim-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes anim-fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes anim-fadeDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes anim-slideLeft { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes anim-slideRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes anim-zoom { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
  @keyframes anim-bounce { 0% { opacity: 0; transform: translateY(-20px) scale(0.9); } 60% { opacity: 1; transform: translateY(4px) scale(1.02); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
  @keyframes anim-flip { from { opacity: 0; transform: perspective(400px) rotateX(90deg); } to { opacity: 1; transform: perspective(400px) rotateX(0deg); } }
  @keyframes anim-typewriter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes anim-none { from { opacity: 1; } to { opacity: 1; } }

  .msg.in-fade       { animation: anim-fade 0.35s ease forwards; }
  .msg.in-fadeUp     { animation: anim-fadeUp 0.35s ease forwards; }
  .msg.in-fadeDown   { animation: anim-fadeDown 0.35s ease forwards; }
  .msg.in-slideLeft  { animation: anim-slideLeft 0.4s cubic-bezier(.25,.8,.35,1) forwards; }
  .msg.in-slideRight { animation: anim-slideRight 0.4s cubic-bezier(.25,.8,.35,1) forwards; }
  .msg.in-zoom       { animation: anim-zoom 0.3s cubic-bezier(.34,1.56,.64,1) forwards; }
  .msg.in-bounce     { animation: anim-bounce 0.5s cubic-bezier(.34,1.56,.64,1) forwards; }
  .msg.in-flip       { animation: anim-flip 0.45s ease forwards; transform-origin: top; }
  .msg.in-typewriter { animation: anim-typewriter 0.25s ease forwards; }
  .msg.in-none       { animation: anim-none 0.01s linear forwards; }

@keyframes out-fade { from { opacity: 1; max-height: 100px; } to { opacity: 0; max-height: 0; padding: 0; margin: 0; } }
  @keyframes out-slideLeft { from { opacity: 1; transform: translateX(0); max-height: 100px; } to { opacity: 0; transform: translateX(-60px); max-height: 0; padding: 0; margin: 0; } }
  @keyframes out-slideRight { from { opacity: 1; transform: translateX(0); max-height: 100px; } to { opacity: 0; transform: translateX(60px); max-height: 0; padding: 0; margin: 0; } }
  @keyframes out-zoom { from { opacity: 1; transform: scale(1); max-height: 100px; } to { opacity: 0; transform: scale(0.6); max-height: 0; padding: 0; margin: 0; } }
  @keyframes out-flip { from { opacity: 1; transform: perspective(400px) rotateX(0deg); max-height: 100px; } to { opacity: 0; transform: perspective(400px) rotateX(90deg); max-height: 0; padding: 0; margin: 0; } }
  @keyframes out-none { from { opacity: 1; } to { opacity: 0; display: none; } }

  .msg.out-fade       { animation: out-fade 0.4s ease forwards; overflow: hidden; }
  .msg.out-slideLeft  { animation: out-slideLeft 0.4s ease forwards; overflow: hidden; }
  .msg.out-slideRight { animation: out-slideRight 0.4s ease forwards; overflow: hidden; }
  .msg.out-zoom       { animation: out-zoom 0.3s ease forwards; overflow: hidden; }
  .msg.out-flip       { animation: out-flip 0.4s ease forwards; overflow: hidden; }
  .msg.out-none       { animation: out-none 0.01s linear forwards; overflow: hidden; }

@media (max-width: 980px) {
  #chatPage .cu-layout { flex-direction: column; }
  #chatPage .cu-side { position: static; width: 100%; }
  #chatPage .cu-grid2 { grid-template-columns: 1fr; }
}