/* ==========================================
   chat.css — Modern YouTube Live Chat Theme with Smooth Messages
   ========================================== */

/* ── Chat Panel ── */
.yt-chat {
    width: var(--chat-w);
    background: var(--bg);
    border-left: 1px solid var(--border);
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.25s var(--ease);
}

.yt-chat.closed {
    width: 0;
    border-left: none;
}

.chat-body {
    flex: 1;
    overflow: hidden;
}

.chat-body iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Modern Chat Header ── */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    backdrop-filter: blur(4px);
}

.chat-live-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.05em;
}

.chat-live-badge::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ff4e45;
    border-radius: 50%;
    box-shadow: 0 0 8px #ff4e45;
    animation: blink 1.6s infinite;
}

.chat-close-btn {
    border: none;
    background: transparent;
    color: var(--text2);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    transition: all var(--transition-fast);
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    transform: scale(1.05);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    line-height: 1.35rem;
    word-break: break-word;
    animation: fadeInUp 0.2s var(--ease);
}

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

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
    user-select: none;
    transition: transform var(--transition-fast);
}

.chat-msg-avatar:hover {
    transform: scale(1.05);
}

.chat-msg-content {
    flex: 1;
}

.chat-msg-user {
    font-weight: 700;
    color: #aaaaaa;
    margin-right: 8px;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.chat-msg-user:hover {
    text-decoration: underline;
    color: #fff;
}

.chat-msg-text {
    color: var(--text);
}

.chat-input-area {
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-join-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-join-label {
    font-size: 0.75rem;
    color: var(--text2);
}

.chat-join-row {
    display: flex;
    gap: 10px;
}

.chat-username-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.chat-username-input:focus {
    border-color: var(--accent);
    background: #000;
}

.chat-join-btn {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 0 18px;
    border-radius: 24px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-join-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.chat-message-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-text-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 24px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.chat-text-input:focus {
    border-color: var(--accent);
    background: #000;
}

.chat-send-btn {
    border: none;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}