/* ════════════════════════════════════
   CHATRAUM — Layout & Styling
   ════════════════════════════════════ */

/* ── Login ── */
#Inhaltbox { margin: 4px; }

#chat-login {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    height: 524px;
}
.chat-login-box {
    background: #3a3a3a;
    border: 2px solid #FF9900;
    border-radius: 14px;
    padding: 28px 36px;
    text-align: center;
    color: #fff;
    width: 420px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
    box-sizing: border-box;
}
/* Registrierung: volle Höhe der rechten Spalte */
.chat-register-box {
    display: flex;
    flex-direction: column;
}
.chat-register-box form {
    flex: 1;
    display: flex;
    flex-direction: column;
}
/* Login-Box wächst um den verbleibenden Platz */
#chat-login > div > .chat-login-box:first-child {
    flex: 1;
}
/* Passwort vergessen direkt angedockt mit oranger Trennlinie */
.chat-forgot-box {
    padding: 10px 36px 16px;
    border-top: 1px solid #555555;
    border-radius: 0 0 14px 14px;
    margin-top: -2px;
    display: flex;
    flex-direction: column;
}
.chat-forgot-box form {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.chat-forgot-box form button { margin-top: auto; }

/* Login-Box oben rund, unten eckig wenn Forgot andockt */
#chat-login > div > .chat-login-box:first-child {
    flex: 1;
    border-radius: 14px 14px 0 0;
}

/* Registrieren-Button ans Ende der Box drücken */
.chat-register-box form button[type="submit"] { margin-top: auto; }
.chat-login-box input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #555;
    border-radius: 8px;
    background: #4a4a4a;
    color: #fff;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 12pt;
    margin-bottom: 14px;
    box-sizing: border-box;
}
.chat-login-box input[type="email"]:focus { border-color: #FF9900; outline: none; }

/* Gleiche Kopfzeilen-Höhe in allen Login-Boxen */
.chat-login-box .box-header {
    min-height: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 18px;
}
.chat-login-box .box-header h2 { margin: 0 0 6px; }
.chat-login-box .box-header p  { margin: 0; color: #aaa; font-size: 10pt; }

/* Passwort-Sichtbarkeit Toggle */
.pw-wrap {
    position: relative;
    margin-bottom: 14px;
}
.pw-wrap input {
    margin-bottom: 0 !important;
    padding-right: 40px !important;
    width: 100%;
    box-sizing: border-box;
}
.pw-eye {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: #888;
    font-size: 10pt;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: auto !important;
    opacity: 0.7;
    transition: opacity 0.2s;
    overflow: visible;
}
.pw-eye:hover { opacity: 1; background: none !important; }

/* Durchgestrichenes Auge wenn Passwort sichtbar */
.pw-eye.is-showing::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 30%;
    width: 40%;
    height: 1.5px;
    background: #aaa;
    transform: translateY(-50%) rotate(-40deg);
    pointer-events: none;
    border-radius: 1px;
}

.reg-check {
    text-align: left;
    font-size: 9pt;
    color: #ccc;
    margin-bottom: 10px;
    line-height: 1.4;
}
.reg-check input[type="checkbox"] {
    margin-right: 6px;
    vertical-align: middle;
    width: auto;
    accent-color: #4a9eff;
}
.chat-login-box h2 {
    color: #FF9900;
    margin: 0 0 8px;
    font-size: 15pt;
}
.chat-login-box p { margin-bottom: 18px; }
.chat-login-box input[type="text"],
.chat-login-box input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #555;
    border-radius: 8px;
    background: #4a4a4a;
    color: #fff;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 12pt;
    margin-bottom: 14px;
    box-sizing: border-box;
}
.chat-login-box input[type="text"]:focus { border-color: #FF9900; outline: none; }
.chat-login-box button {
    background: #FF9900;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 32px;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 12pt;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.chat-login-box button:hover { background: #e68800; }
.chat-error { color: #ff5555; font-size: 9.5pt; margin-top: 10px; min-height: 16px; }

/* ── Haupt-Layout ── */
#chat-wrap {
    display: flex;
    flex-direction: column;
    height: 524px;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    position: relative;
    gap: 6px;
}

/* ── Oberer Bereich ── */
#chat-top {
    display: flex;
    flex: 1;
    gap: 6px;
    min-height: 0;
}

/* ── Chatfenster (links) ── */
#chat-messages {
    flex: 1;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow-y: auto;
    padding: 10px 14px;
    font-size: 10.5pt;
}
.chat-msg {
    margin-bottom: 5px;
    line-height: 1.45;
    word-break: break-word;
    display: flex;
    align-items: flex-start;
    flex-wrap: nowrap;
}
.msg-meta {
    white-space: nowrap;
    flex-shrink: 0;
}
.msg-body {
    word-break: break-word;
    overflow-wrap: anywhere;
    flex: 1;
    min-width: 0;
}
.chat-msg .msg-time {
    color: #bbb;
    font-size: 10.5pt;
    margin-right: 5px;
}
.chat-msg .msg-nick {
    font-weight: bold;
    margin-right: 4px;
}
.chat-msg img {
    max-width: 200px;
    max-height: 140px;
    border-radius: 4px;
    vertical-align: middle;
}

/* ── Privatchat Popup ── */
.pc-window {
    display: flex;
    position: fixed;
    bottom: 114px;
    right: 10px;
    width: 560px;
    height: 480px;
    background: #ffffff;
    border: 2px solid #FF9900;
    border-radius: 10px;
    z-index: 5000;
    flex-direction: column;
    box-shadow: 0 6px 28px rgba(0,0,0,0.65);
}

.pc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #FF9900;
    border-radius: 8px 8px 0 0;
    color: #fff;
    font-size: 10pt;
    font-weight: bold;
    cursor: default;
    user-select: none;
}
.pc-header:active { cursor: default; }
.pc-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 13pt;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}
.pc-close:hover { color: #000; }

.pc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 9.5pt;
    background: #ffffff;
}
.pc-messages::-webkit-scrollbar { width: 4px; }
.pc-messages::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

.pc-msg { margin-bottom: 5px; line-height: 1.4; word-break: break-word; }
.pc-msg .pc-time { color: #777; font-size: 9.5pt; margin-right: 4px; }
.pc-msg .pc-nick { font-weight: bold; margin-right: 3px; }

.pc-img-btn {
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 13pt;
    padding: 3px 7px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}
.pc-img-btn:hover { border-color: #FF9900; }

.pc-img-panel {
    display: none;
    background: #2a2a2a;
    border-top: 1px solid #FF9900;
    padding: 10px 12px;
    flex-shrink: 0;
}
.pc-img-panel.open { display: block; }
.pc-upload-preview { margin-bottom: 6px; }
.pc-upload-preview img { max-width: 100%; max-height: 80px; border-radius: 4px; display: block; }
.pc-upload-status { font-size: 8.5pt; color: #aaa; margin-bottom: 4px; min-height: 16px; }
.pc-upload-label {
    display: block; padding: 7px 8px; border: 1px dashed #555; border-radius: 5px;
    color: #aaa; font-size: 8.5pt; cursor: pointer; margin-bottom: 6px; text-align: center;
}
.pc-upload-label:hover { border-color: #FF9900; color: #FF9900; }
.pc-upload-send {
    width: 100%; background: #FF9900; color: #fff; border: none;
    border-radius: 5px; padding: 7px; cursor: pointer; font-size: 9.5pt;
}
.pc-upload-send:hover { background: #e68800; }
.pc-upload-send:disabled { background: #555; cursor: not-allowed; }

.pc-smiley-panel {
    display: none;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #1c1c1c;
    border-top: 1px solid #FF9900;
    max-height: 120px;
    overflow-y: auto;
}
.pc-smiley-panel.open { display: flex; }
.pc-smiley-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.15em;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    line-height: 28px;
    text-align: center;
    padding: 0;
}
.pc-smiley-item:hover { background: #333; }
.pc-smiley-btn-open {
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 13pt;
    padding: 3px 7px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}
.pc-smiley-btn-open:hover { border-color: #FF9900; }
.pc-inputrow {
    display: flex;
    gap: 5px;
    padding: 7px 8px;
    border-top: 1px solid #333;
}
.pc-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #4a4a4a;
    color: #fff;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 9.5pt;
}
.pc-input:focus { border-color: #FF9900; outline: none; }
.pc-send {
    background: #FF9900;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 9.5pt;
}
.pc-send:hover { background: #e68800; }

/* Admin_Carola Blinkpunkt */
@keyframes carola-blink {
    0%   { background: #000000; }
    50%  { background: var(--carola-color, #FF69B4); }
    100% { background: #000000; }
}
.carola-dot-msg,
.carola-dot-static {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.carola-dot-msg    { animation: carola-blink 4s step-end infinite; }
.carola-dot-static { /* statisch in Carolafarbe, kein blinken */ }

/* Mitglied-Name anklickbar */
.member-name { cursor: pointer; }
.member-name:hover { text-decoration: none; }

/* Ungelesen-Badge */
.pc-badge {
    display: inline-block;
    background: #cc0000;
    color: #fff;
    font-size: 7.5pt;
    font-weight: bold;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Mitglieder-Panel (rechts) ── */
#chat-members {
    width: 188px;
    background: #f4f4f4;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow-y: auto;
    padding: 10px;
    flex-shrink: 0;
}
#chat-members h4 {
    margin: 0 0 8px;
    color: #FF9900;
    font-size: 10.5pt;
    border-bottom: 1px solid rgba(255,153,0,0.4);
    padding-bottom: 5px;
}
.member-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
    font-size: 10pt;
}
.member-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9pt;
    color: #fff;
    line-height: 1;
    text-align: center;
}
.member-dot.active   { background: #00cc44; }
.member-dot.inactive { background: #d0d0d0; color: #000; }
.member-dot.kick     { background: #ff0000; color: #fff; animation: kick-blink 4.0s step-end infinite; }
@keyframes kick-blink { 0%, 100% { color: #fff; } 50% { color: #ff0000; } }

/* ── Toolbar (unten, 5 Bereiche) ── */
#chat-toolbar {
    display: flex;
    height: 108px;
    gap: 5px;
    flex-shrink: 0;
}
.toolbar-section {
    background: #1c1c1c;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    color: #fff;
    font-size: 10.5pt;
    text-align: center;
}

/* 1 — Bildmanager */
#toolbar-images { width: 100px; cursor: pointer; justify-content: center; gap: 4px; }
#toolbar-images-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}
.img-icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 38px;
    border: 2px solid #555;
    border-radius: 6px;
    font-size: 1.25em;
    color: #fff;
    box-sizing: border-box;
}
#toolbar-images:hover { background: #4a4a4a; }
#toolbar-images:hover .img-icon-box { border-color: #888; }

/* Gemeinsame Label-Klasse (Bildmanager + Textfarbe) */
.toolbar-label {
    font-size: 10.5pt;
    color: #fff;
    display: block;
    text-align: center;
}

/* Bildmanager Popup */
#img-panel {
    position: absolute;
    bottom: 116px;
    left: 0;
    width: 260px;
    background: #222;
    border: 1px solid #FF9900;
    border-radius: 10px;
    padding: 12px;
    display: none;
    z-index: 200;
    text-align: left;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#img-panel.open { display: block; }
.img-panel-title { color: #FF9900; font-size: 10pt; font-weight: bold; margin-bottom: 8px; }

/* Tabs */
.img-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.img-tab {
    flex: 1; padding: 5px 4px; border: 1px solid #555; border-radius: 5px;
    background: #4a4a4a; color: #aaa; font-size: 8.5pt; cursor: pointer;
}
.img-tab.active { background: #FF9900; color: #fff; border-color: #FF9900; }

.img-tab-content input[type="text"] {
    width: 100%; padding: 6px 8px; border: 1px solid #555; border-radius: 5px;
    background: #4a4a4a; color: #fff; font-size: 9pt; box-sizing: border-box; margin-bottom: 6px;
}
#img-url-preview, #img-upload-preview {
    margin-bottom: 6px; min-height: 0;
}
#img-url-preview img, #img-upload-preview img {
    max-width: 100%; max-height: 80px; border-radius: 4px; display: block;
}
#img-upload-status { font-size: 8.5pt; color: #aaa; margin-bottom: 4px; }

#img-upload-label {
    display: block; padding: 7px 8px; border: 1px dashed #555; border-radius: 5px;
    color: #aaa; font-size: 8.5pt; cursor: pointer; margin-bottom: 6px; text-align: center;
}
#img-upload-label:hover { border-color: #FF9900; color: #FF9900; }

#img-url-send, #img-upload-send {
    width: 100%; background: #FF9900; color: #fff; border: none;
    border-radius: 5px; padding: 7px; cursor: pointer; font-size: 9.5pt;
}
#img-url-send:hover, #img-upload-send:hover { background: #e68800; }
#img-upload-send:disabled { background: #555; cursor: not-allowed; }

/* 2 — Schriftfarbe */
#toolbar-color { width: 82px; justify-content: center; gap: 4px; }
#chat-color-input {
    width: 54px;
    height: 38px;
    padding: 0;
    border: 2px solid #555;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}
#chat-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
#chat-color-input::-webkit-color-swatch { border: none; border-radius: 3px; }

/* 3 — Eingabe */
#toolbar-input {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 55px;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
}
#chat-text-input {
    padding: 8px 12px;
    border: 1px solid #444;
    border-radius: 8px;
    background: #4a4a4a;
    color: #fff;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 11pt;
    resize: none;
    overflow-y: auto;
    line-height: 1.4;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
}
#chat-text-input::placeholder { color: #777; }
#chat-text-input:focus { border-color: #FF9900; outline: none; }
#chat-send-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#chat-char-counter {
    flex: 1;
    background: #2a2a2a;
    color: #FF9900;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 10pt;
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    letter-spacing: 0.03em;
    border-radius: 8px;
    border: 1px solid #444;
}
#chat-char-counter.warn { color: #FF0000; }
#chat-send-btn {
    flex: 1;
    background: #FF9900;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 10.5pt;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
#chat-send-btn:hover { background: #e68800; }

/* 4 — Smileys */
#toolbar-smileys { width: 275px; padding: 4px 6px; overflow: hidden; }

#smiley-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    gap: 1px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 92px;
    align-content: start;
    padding: 1px 0;
}
#smiley-grid::-webkit-scrollbar { width: 4px; }
#smiley-grid::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

.smiley-btn {
    font-size: 1.35em;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    height: 28px;
    border-radius: 4px;
    line-height: 28px;
    text-align: center;
    padding: 0;
}
.smiley-btn:hover { background: #333; }

/* 5 — Verlassen */
#toolbar-leave { width: 118px; }
#chat-leave-btn {
    width: 100%;
    height: 100%;
    background: #FF0000 !important;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-family: 'FetteMitD W03 Regular', sans-serif;
    font-size: 10.5pt;
    cursor: pointer;
    line-height: 1.5;
    transition: none;
}
#chat-leave-btn:hover,
#chat-leave-btn:active,
#chat-leave-btn:focus { background: #FF0000 !important; outline: none; }

/* ── Bild-Lightbox ── */
#chat-messages img, .pc-messages img { cursor: zoom-in; }

/* Twemoji */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em;
    display: inline-block;
    cursor: default;
}
.smiley-btn img.emoji {
    height: 20px;
    width: 20px;
    vertical-align: middle;
    margin: 0;
}

#chat-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
#chat-lightbox.open { display: flex; }
#chat-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
    cursor: default;
}
