/* =========================================================================
   GroomChat Stream Overlay CSS
   - Nimmt exakt 1/3 der linken Bildschirmseite im Canvas ein (33.3333vw, 100px vom linken Rand)
   - Kein Schlagschatten im Hintergrund
   - Größere, gut lesbare Texte für den Stream
   - 2 Visuelle Themen:
     1) Clash of Clans Clan-Chat (.theme-coc) -> Originalgetreu nach Screenshot ("WW-Clan")
     2) WhatsApp Dark-Mode Chat (.theme-whatsapp)
   ========================================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

.hidden {
    display: none !important;
}

/* =========================================================================
   LINKES DRITTEL CONTAINER (1/3 des Bildschirms, 100px vom linken Rand)
   ========================================================================= */
.overlay-left-third,
.overlay-right-third {
    position: fixed;
    top: 0;
    left: 100px;
    width: 33.3333vw;
    min-width: 420px;
    max-width: 780px;
    height: 100vh;
    padding: 16px 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    z-index: 50;
    box-shadow: none;
    filter: none;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.45s ease;
}

/* Wenn im Panel auf "Off Air / Ausgeblendet" geschaltet wird: nach links rausfahren */
.overlay-left-third.is-off-air,
.overlay-right-third.is-off-air {
    transform: translateX(calc(-100% - 140px));
    opacity: 0;
    pointer-events: none;
}

.chat-shell {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: none;
    transition: background 0.35s ease, border-color 0.35s ease;
}

/* =========================================================================
   THEME 1: CLASH OF CLANS STYLE (.theme-coc) – WIE IM SCREENSHOT
   ========================================================================= */
.theme-coc .chat-shell {
    background-color: #3c3632;
    border: 3px solid #57504a;
    border-right: 4px solid #6b635b;
    box-shadow: none;
    font-family: 'Nunito', 'Inter', sans-serif;
}

/* CoC Top Header Bar (Metallisch-Olivgrüne Plakette + Blauer Pin-Button) */
.coc-header {
    background: #35302c;
    padding: 10px 12px 8px;
    border-bottom: 2px solid #26221f;
    z-index: 5;
}

.coc-top-bar {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.coc-clan-banner {
    flex: 1;
    background: linear-gradient(180deg, #b8b89f 0%, #87886f 52%, #686952 100%);
    border: 3px solid #1e1b18;
    border-radius: 12px;
    padding: 5px 12px 5px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}

.coc-shield-badge {
    width: 42px;
    height: 46px;
    background: linear-gradient(180deg, #7e3af2 0%, #4c1d95 100%);
    border: 2.5px solid #f59e0b;
    border-radius: 8px 8px 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.coc-shield-lvl {
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 0.95rem;
    color: #ffffff;
    text-shadow: 0 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000;
}

.coc-clan-title {
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 1.45rem;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: 0 2px 0 #000, -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000;
    text-align: center;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coc-online-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
}

.coc-online-label,
.coc-online-count {
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 1.02rem;
    color: #74f23a;
    text-shadow: 0 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000;
}

.coc-pin-btn {
    width: 68px;
    background: linear-gradient(180deg, #b8b89f 0%, #87886f 52%, #686952 100%);
    border: 3px solid #1e1b18;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    flex-shrink: 0;
}

/* Rechte CoC Seiten-Tabs (außerhalb rechts an der Chat-Box wie im Screenshot) */
.coc-side-tabs {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    margin-left: -3px;
    z-index: 6;
}

.coc-side-tab {
    width: 52px;
    border: 3px solid #1e1b18;
    border-left: none;
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.coc-side-tab.tab-clan {
    height: 82px;
    background: linear-gradient(180deg, #8b857e 0%, #635d57 100%);
    font-size: 1.55rem;
}

.coc-side-tab.tab-collapse {
    height: 112px;
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.side-tab-arrow {
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 2.3rem;
    color: #ffffff;
    text-shadow: 0 2px 0 #000, -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000;
    line-height: 1;
}

.coc-side-tab.tab-global {
    height: 82px;
    background: linear-gradient(180deg, #75706a 0%, #4f4a45 100%);
    font-size: 1.55rem;
}

.side-tab-dot {
    position: absolute;
    top: 10px;
    right: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #ffffff;
}

/* Clash of Clans Footer (Input links, Grüner Challenge-Button + Grauer Burg-Button rechts) */
.coc-footer {
    background: #35302c;
    border-top: 2px solid #26221f;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 5;
}

.coc-input-box {
    flex: 1;
    background: #6f6a64;
    border: 3px solid #221e1b;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coc-input-placeholder {
    color: #e7e3de;
    font-size: 1.15rem;
    font-weight: 800;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.coc-input-send-arrow {
    color: #d6d1cb;
    font-size: 1.35rem;
    line-height: 1;
}

.coc-action-btn {
    width: 64px;
    height: 52px;
    border: 3px solid #1e1b18;
    border-radius: 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.coc-btn-challenge {
    background: linear-gradient(180deg, #8ce93a 0%, #52a710 100%);
}

.coc-btn-troops {
    background: linear-gradient(180deg, #b8b5b0 0%, #7d7974 100%);
}

.coc-btn-main-icon {
    font-size: 1.55rem;
}

.coc-btn-sub-badge {
    position: absolute;
    top: 3px;
    right: 4px;
    background: #ffffff;
    color: #1e1b18;
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1.5px solid #1e1b18;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================================
   CLASH OF CLANS MESSAGE ITEMS (WIE IM SCREENSHOT)
   ========================================================================= */
.coc-chat-entry {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 4px;
}

/* Eigener Spieler (racer12) leicht nach rechts versetzt wie "Kuba" im Screenshot */
.coc-chat-entry.is-self {
    padding-left: 12%;
}

/* Clan-Mitglied (queenOFWAR2014) linksbündig wie "Warmener" / "zweite Welt ;)" */
.coc-chat-entry.is-clanmate {
    padding-right: 10%;
}

/* Zeile über der Sprechblase: Liga-Wappen + Name */
.coc-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    padding-left: 2px;
}

.coc-league-crest {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1a1715;
    flex-shrink: 0;
}

.coc-league-crest.crest-purple {
    background: linear-gradient(180deg, #9333ea 0%, #581c87 100%);
}

.coc-league-crest.crest-silver {
    background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
}

.crest-symbol {
    font-size: 1.05rem;
    line-height: 1;
}

.crest-number {
    position: absolute;
    bottom: -4px;
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 0.76rem;
    color: #ffffff;
    text-shadow: 0 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000;
    line-height: 1;
}

.coc-author-name {
    font-family: 'Nunito', 'Inter', sans-serif;
    font-size: 1.32rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}

/* Im Screenshot: Eigener Name grün (#8ce93a), andere Spieler warmes Beige/Pfirsich (#d9a773) */
.coc-chat-entry.is-self .coc-author-name {
    color: #8ce93a;
}

.coc-chat-entry.is-clanmate .coc-author-name {
    color: #d8a676;
}

/* Die dunkle abgerundete Nachrichten-Box */
.coc-bubble-box {
    background: #2f2a27;
    border-radius: 10px;
    padding: 8px 14px 10px;
    position: relative;
}

.coc-chat-entry.is-self .coc-bubble-box {
    background: #524c48;
}

.coc-chat-entry.is-latest .coc-bubble-box {
    outline: 2px solid rgba(255, 255, 255, 0.22);
}

/* Rolle ("Ältester" / "Mitglied") oben rechts in der Box */
.coc-bubble-role {
    text-align: right;
    font-size: 0.94rem;
    font-weight: 800;
    color: #9e968f;
    line-height: 1.1;
    margin-bottom: 2px;
}

/* Nachrichtentext (Groß & kräftig weiß) */
.coc-bubble-text {
    color: #ffffff;
    font-size: 1.32rem;
    font-weight: 800;
    line-height: 1.36;
    text-shadow: 0 1.5px 0 rgba(0, 0, 0, 0.85);
    word-wrap: break-word;
    padding-right: 4px;
}

/* Zeitangabe unten rechts ("14m") */
.coc-bubble-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.coc-bubble-time {
    font-size: 0.94rem;
    font-weight: 800;
    color: #9e968f;
}

/* Kleines Daumen/Herz-Badge unten links auf der Kante der Bubble */
.coc-reaction-pill {
    position: absolute;
    bottom: -10px;
    left: 12px;
    background: rgba(75, 70, 65, 0.96);
    border: 1.5px solid #221e1b;
    border-radius: 8px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.98rem;
}

.coc-reaction-count {
    color: #ffffff;
    font-weight: 800;
    font-size: 0.92rem;
}

/* Grünes Clash of Clans Event-Banner (wie "WW-Clan Befördert auf Meister II" im Screenshot) */
.coc-green-event-banner {
    background: linear-gradient(180deg, #8ce93a 0%, #64b816 55%, #529c0e 100%);
    border: 3px solid #1e1b18;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0;
}

.coc-event-emblem {
    width: 58px;
    height: 58px;
    background: linear-gradient(180deg, #4b453f 0%, #26221e 100%);
    border: 2.5px solid #fbbf24;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.coc-event-trophy {
    font-size: 1.85rem;
}

.coc-event-arrow-badge {
    position: absolute;
    bottom: -6px;
    left: -6px;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #64b816;
    border: 2px solid #1e1b18;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coc-event-body {
    flex: 1;
    min-width: 0;
}

.coc-event-clan-label {
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 1.22rem;
    color: #ffffff;
    text-shadow: 0 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000;
    line-height: 1.1;
}

.coc-event-sub-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 2px 0;
}

.coc-event-up-icon {
    color: #164e06;
    font-size: 0.9rem;
}

.coc-event-sub-text {
    font-family: 'Lilita One', 'Nunito', sans-serif;
    font-size: 1.05rem;
    color: #133b04;
}

.coc-event-main-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 1.5px 0 #000;
    line-height: 1.3;
}

/* =========================================================================
   THEME 2: WHATSAPP DARK STYLE (.theme-whatsapp)
   ========================================================================= */
.theme-whatsapp .chat-shell {
    background-color: #0b141a;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0),
        radial-gradient(rgba(0, 168, 132, 0.035) 1px, transparent 0);
    background-size: 28px 28px;
    background-position: 0 0, 14px 14px;
    border: 2px solid rgba(255, 255, 255, 0.14);
    box-shadow: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.wa-header {
    background: #202c33;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 5;
}

.wa-back-arrow {
    color: #aebac1;
    font-size: 1.85rem;
    line-height: 1;
    font-weight: 500;
    margin-right: -2px;
}

.wa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.wa-avatar-initials {
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
}

.wa-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00a884;
    border: 2px solid #202c33;
}

.wa-contact-info {
    flex: 1;
    min-width: 0;
}

.wa-contact-name {
    color: #e9edef;
    font-size: 1.18rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-contact-status {
    color: #00a884;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 2px;
}

.wa-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #aebac1;
    font-size: 1.18rem;
}

/* WhatsApp Footer */
.wa-footer {
    background: #111b21;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 5;
}

.wa-input-pill {
    flex: 1;
    background: #2a3942;
    border-radius: 24px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8696a0;
    font-size: 1.02rem;
}

.wa-input-placeholder {
    flex: 1;
}

.wa-mic-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #00a884;
    color: #111b21;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* =========================================================================
   CHAT VIEWPORT & SCROLLING
   ========================================================================= */
.chat-viewport {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px 24px;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    position: relative;
}

.chat-viewport::-webkit-scrollbar {
    width: 5px;
}

.chat-viewport::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 3px;
}

.chat-messages-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: auto;
}

/* Empty State (Neutral im Chat-Look: "Hier ist es noch ruhig …") */
.chat-empty-state {
    margin: auto;
    text-align: center;
    padding: 28px 20px;
    max-width: 320px;
    opacity: 0.55;
}

.empty-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
}

/* =========================================================================
   ANIMATIONS FOR INCOMING MESSAGES
   ========================================================================= */
@keyframes msgPopIn {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.95);
    }
    70% {
        opacity: 1;
        transform: translateY(-2px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-animate-in {
    animation: msgPopIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* =========================================================================
   WHATSAPP MESSAGE BUBBLES (GRÖSSERE TEXTE)
   ========================================================================= */
.wa-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.wa-row.is-incoming {
    align-items: flex-start;
}

.wa-row.is-outgoing {
    align-items: flex-end;
}

.wa-bubble {
    max-width: 88%;
    min-width: 110px;
    padding: 11px 16px 9px;
    border-radius: 14px;
    position: relative;
    word-wrap: break-word;
}

.wa-row.is-incoming .wa-bubble {
    background: #202c33;
    color: #e9edef;
    border-top-left-radius: 3px;
}

.wa-row.is-outgoing .wa-bubble {
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 3px;
}

.wa-bubble.is-latest {
    outline: 2px solid rgba(0, 212, 166, 0.6);
}

.wa-sender-label {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #f472b6;
}

.wa-row.is-outgoing .wa-sender-label {
    color: #6ee7b7;
}

.wa-msg-text {
    font-size: 1.26rem;
    line-height: 1.42;
    color: #f1f5f9;
    font-weight: 400;
}

.wa-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 4px;
}

.wa-time {
    font-size: 0.82rem;
    color: rgba(233, 237, 239, 0.68);
}

.wa-ticks {
    font-size: 0.9rem;
    color: #53bdeb;
    line-height: 1;
    letter-spacing: -2px;
    margin-right: 2px;
}

/* WhatsApp System / Time Chip */
.wa-system-chip {
    align-self: center;
    background: #182229;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffd279;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 1.02rem;
    font-weight: 600;
    text-align: center;
    max-width: 94%;
    margin: 4px auto;
}

/* =========================================================================
   NARRATION / CONTEXT BANNER (Für Erzähltexte aus Chatverlauf.docx)
   ========================================================================= */
.narration-card {
    align-self: center;
    width: 97%;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 165, 50, 0.5);
    border-left: 5px solid #ff7a00;
    border-radius: 12px;
    padding: 13px 16px;
    margin: 4px auto;
}

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

.narration-title {
    font-size: 0.92rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #ffb454;
}

.narration-time {
    font-size: 0.84rem;
    color: #94a3b8;
    font-weight: 600;
}

.narration-body {
    font-size: 1.08rem;
    line-height: 1.44;
    color: #e2e8f0;
    font-weight: 500;
}
