/* Sistema de Chat Twitch - IA Fundo */

/* ===== CONTAINER PRINCIPAL DO STREAM ===== */
.stream-demo {
    max-width: 1000px;
    margin: 0 auto 3rem;
}

.stream-card {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

/* ===== JANELA DO STREAM ===== */
.stream-window {
    position: relative;
    background: #0E0E10;
    border-radius: 12px 0 0 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

/* Demo background container */
#demo-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
    position: relative;
}

/* Background overlay removido para exibir imagens sem filtro */

.background-info {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 1rem;
}

.background-info p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Indicador de geração */
.generating-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: white;
    z-index: 2;
    position: relative;
}

.generating-indicator .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.generating-indicator p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* ===== WEBCAM DO STREAMER ===== */
.demo-streamer {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 3;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.streamer-cam {
    width: 120px;
    height: 80px;
    border-radius: 8px;
    border: 3px solid var(--primary-color);
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background: var(--bg-secondary);
}

/* ===== CHAT DA TWITCH ===== */
.stream-chat,
.demo-chat {
    background: #18181B;
    border-radius: 0 12px 12px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Header do chat */
.chat-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.chat-header h4 {
    color: #EFEFF1;
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.chat-header i {
    color: #9146FF;
    font-size: 1.1rem;
}

/* Área de mensagens */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 250px;
    max-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: #3A3A3D transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #3A3A3D;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #4A4A4D;
}

/* ===== MENSAGENS DO CHAT ===== */
.chat-message {
    animation: messageAppear 0.3s ease;
    padding: 0.5rem 0.75rem;
    margin-bottom: 2px;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
    transition: all 0.3s ease;
    border-radius: 4px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    min-height: auto;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.chat-message:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Usernames por tipo */
.chat-message .username {
    font-weight: 600;
    flex-shrink: 0;
    display: inline-block;
}

/* Viewer padrão */
.chat-message .username,
.username.viewer {
    color: #EFEFF1;
}

/* Moderador */
.chat-message.mod .username,
.username.mod {
    color: #00AD03;
}

/* Subscriber */
.chat-message.sub .username,
.username.sub {
    color: #FFD700;
}

/* Streamer */
.chat-message.streamer .username,
.username.streamer {
    color: #E91916;
}

/* Sistema/Bot */
.chat-message.system .username,
.username.system {
    color: #1F69FF;
}

/* Mensagem de texto */
.chat-message .message,
.chat-message .message-text {
    color: #EFEFF1;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
    display: inline;
    min-width: 0;
    line-height: 1.5;
    white-space: normal;
}

/* Mensagens especiais */
.chat-message.system {
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-style: italic;
    color: var(--text-secondary);
    border-left: 3px solid #1F69FF;
}

.chat-message.command {
    background: rgba(var(--primary-rgb), 0.1);
    border-left: 3px solid var(--primary-color);
}

.chat-message.bot-response {
    background: rgba(20, 255, 20, 0.1);
    border-left: 3px solid #00AD03;
}

/* ===== INPUT DO CHAT ===== */
.chat-input {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.chat-input input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    border: 1px solid #3A3A3D;
    background: #2F2F35;
    color: #EFEFF1;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: #9146FF;
    background: #3A3A3D;
}

.chat-input input::placeholder {
    color: rgba(239, 239, 241, 0.5);
}

.chat-send {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.chat-send:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.chat-send:active {
    transform: scale(0.95);
}

/* ===== BOTÕES DE COMANDO DEMO ===== */
.demo-commands {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.demo-commands h5 {
    width: 100%;
    margin: 0 0 0.5rem 0;
    color: #EFEFF1;
    font-size: 0.85rem;
    font-weight: 600;
}

.demo-cmd-btn {
    background: #9146FF;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.demo-cmd-btn:hover {
    background: #772CE8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(145, 70, 255, 0.3);
}

.demo-cmd-btn:active {
    transform: scale(0.95);
}

.demo-cmd-btn i {
    font-size: 0.9rem;
}

/* ===== ANIMAÇÕES ===== */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Efeito de digitação */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #8e9297;
    font-style: italic;
    font-size: 0.8rem;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    background: #8e9297;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== BADGES DE USUÁRIO ===== */
.user-badges {
    display: inline-flex;
    gap: 2px;
    margin-right: 4px;
    align-items: center;
}

.badge {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.badge.moderator {
    background-color: #00AD03;
}

.badge.subscriber {
    background-color: #FFD700;
}

.badge.vip {
    background-color: #E91916;
}

.badge.broadcaster {
    background-color: #E91916;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 991px) {
    .stream-card {
        grid-template-columns: 1fr;
        max-width: 600px;
    }
    
    .stream-window {
        border-radius: 12px 12px 0 0;
        min-height: 300px;
    }
    
    .stream-chat,
    .demo-chat {
        border-radius: 0 0 12px 12px;
        min-height: 350px;
    }
    
    .streamer-cam {
        width: 100px;
        height: 66px;
        bottom: 15px;
        right: 15px;
    }
    
    .chat-messages {
        max-height: 250px;
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .stream-demo {
        margin: 0 auto 2rem;
    }
    
    .stream-card {
        margin: 0 0.5rem;
    }
    
    .demo-commands {
        padding: 0.75rem;
    }
    
    .demo-cmd-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }
    
    .chat-header {
        padding: 0.75rem;
    }
    
    .chat-messages {
        padding: 0.75rem;
        gap: 0.25rem;
    }
    
    .chat-message {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    
    .streamer-cam {
        width: 80px;
        height: 53px;
        bottom: 10px;
        right: 10px;
    }
}

@media (max-width: 576px) {
    .stream-card {
        margin: 0 0.25rem;
        border-radius: 8px;
    }
    
    .stream-window {
        border-radius: 8px 8px 0 0;
        min-height: 250px;
    }
    
    .stream-chat,
    .demo-chat {
        border-radius: 0 0 8px 8px;
        min-height: 300px;
    }
    
    .chat-messages {
        max-height: 200px;
        min-height: 150px;
        padding: 0.5rem;
    }
    
    .chat-header h4 {
        font-size: 0.9rem;
    }
    
    .demo-cmd-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .streamer-cam {
        width: 60px;
        height: 40px;
        border-width: 2px;
    }
    
    #demo-bg {
        font-size: 1rem;
    }
    
    .generating-indicator p {
        font-size: 0.9rem;
    }
}

/* ===== TEMA CLARO ===== */
:root[data-theme="light"] .stream-chat,
:root[data-theme="light"] .demo-chat,
html.light-theme .stream-chat,
html.light-theme .demo-chat,
body.light-theme .stream-chat,
body.light-theme .demo-chat {
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .chat-header,
html.light-theme .chat-header,
body.light-theme .chat-header {
    background: #f8f9fa;
    border-bottom-color: #dee2e6;
}

:root[data-theme="light"] .chat-header h4,
html.light-theme .chat-header h4,
body.light-theme .chat-header h4 {
    color: #212529;
}

:root[data-theme="light"] .chat-message,
html.light-theme .chat-message,
body.light-theme .chat-message {
    color: #212529;
}

:root[data-theme="light"] .chat-message:hover,
html.light-theme .chat-message:hover,
body.light-theme .chat-message:hover {
    background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .chat-input,
html.light-theme .chat-input,
body.light-theme .chat-input {
    background: #f0f2f5;
    border-top-color: #dee2e6;
}

:root[data-theme="light"] .chat-input input,
html.light-theme .chat-input input,
body.light-theme .chat-input input {
    background: #ffffff;
    border-color: #ced4da;
    color: #212529;
}

/* ===== PRINT STYLES ===== */
@media print {
    .stream-demo,
    .stream-card,
    .stream-chat,
    .demo-chat {
        display: none !important;
    }
}

/* ===== ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
    .chat-message,
    .demo-cmd-btn,
    .chat-send,
    #demo-bg,
    .generating-indicator .spinner {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .stream-chat,
    .demo-chat {
        border: 2px solid #000;
    }
    
    .chat-message .username {
        font-weight: 800;
    }
    
    .demo-cmd-btn {
        border: 2px solid #000;
    }
}