/* ===== Chat Header ===== */

.chat-header {
    padding: 9px;
    background: var(--twitch-purple);
    color: white;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-dot {
    width: 9px;
    height: 9px;
    background-color: #ff0000;
    border-radius: 50%;
}

/* ===== Animations ===== */

@keyframes onlinePulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

@keyframes offlinePulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 5px #ff0000;
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 14px #ff0000;
        opacity: 0.6;
    }
    100% {
        box-shadow: 0 0 5px #ff0000;
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-40px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeSequence {
    0%   { opacity: 1; }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== Chat Container ===== */

.chat-container {
    position: relative;
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    font-size: 14px;
    display: flex;
    flex-direction: column;
}

/* ===== Scrollbar ===== */

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--twitch-purple);
    border-radius: 6px;
}

/* ===== Chat Messages ===== */

.chat-message {
    display: block;
    margin-bottom: 4px;
    line-height: 1.4;
    font-weight: 600;
}

.chat-message:last-child {
    margin-bottom: 0 !important;
}

.chat-message.live {
    animation: slideInLeft 0.35s ease-out;
}

.chat-text {
    word-break: break-word;
}

.chat-user {
    font-weight: 600;
    margin-right: 2px;
    border-radius: 4px;
    margin-right: 0;
    transition: background 0.2s ease, opacity 0.2s ease;
}

body.dark .chat-user:hover {
    background: rgba(255, 255, 255, 0.12);
}

.chat-time {
    font-size: 12px;
    opacity: 0.6;
}

/* ===== Emotes ===== */

.emote {
    height: 18px;
    vertical-align: middle;
}

/* ===== Badges ===== */

.badge {
    margin-right: 5px;
    font-size: 14px;
}

.badge.broadcaster { color: #ff4d4d; }
.badge.mod { color: #00c853; }
.badge.vip { color: #ff00ff; }
.badge.sub { color: gold; }

.badge-img {
    height: 18px;
    vertical-align: middle;
    margin-right: 3px;
}

/* ===== Auto Scroll ===== */

.scroll-btn {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: #9146FF;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.scroll-btn:hover {
    background: #451093;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== Footer ===== */

.footer {
    width: 100%;
    padding: 14px 0;
    background: linear-gradient(90deg, #9146FF, #772ce8);
    text-align: center;
    font-size: 14px;
    color: white;
    margin-top: 0px;
    border-top: 2px solid #9146FF;
}

.footer .heart {
    display: inline-block;
    color: #ff4d6d;
    animation: pulse 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* ===== Chat Reply ===== */

.chat-reply {
    font-size: 12px;
    opacity: 0.75;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-left: 3px solid var(--twitch-purple);
    background: rgba(145, 70, 255, 0.08);
    border-radius: 4px;
}

.reply-box {
    border: 1px solid var(--twitch-purple);
    background: rgba(145, 70, 255, 0.08);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
    width: fit-content;
}

.reply-header {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 4px;
}

.reply-content {
    display: inline;
    flex-wrap: wrap;
    align-items: center;
}

.chat-time,
.chat-user,
.chat-text {
    display: inline;
}

/* ===== Streamer Message ===== */

.streamer-message {
    background: rgba(145, 70, 255, 0.12);
    border: 1px solid var(--twitch-purple);
    border-left: 5px solid var(--twitch-purple);
    border-radius: 6px;
    padding: 6px 8px;
    width: fit-content;
}

/* ===== Bot Messages ===== */

.bot-streamelements {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid #3b82f6;
    border-left: 5px solid #3b82f6;
    border-radius: 6px;
    padding: 6px 8px;
    width: fit-content;
}

.bot-botrix {
    background: rgba(23, 148, 81, 0.12);
    border: 1px solid #179451;
    border-left: 5px solid #179451;
    border-radius: 6px;
    padding: 6px 8px;
    width: fit-content;
}

.bot-armin {
    background: rgba(33, 150, 243, 0.12);
    border: 1px solid #2196f3;
    border-left: 5px solid #2196f3;
    border-radius: 6px;
    padding: 6px 8px;
    width: fit-content;
}

/* ===== New Message Badge ===== */

.new-msg-badge {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    margin: 8px 0;
    padding: 6px 12px;
    border-radius: 6px;
    background-color: rgba(0,255,0,0.5);
    color: #fff;
    opacity: 1;
    animation: fadeSequence 2.5s forwards;
}