/* --- Base e Reset --- */
body {
    background-color: #f9f9f9;
    font-family: Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    height: 56px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-left {
    display: flex;
    align-items: center;
}

.menu-icon {
    background: none;
    border: none;
    padding: 8px;
    margin-right: 8px;
    cursor: pointer;
    border-radius: 50%;
}

.menu-icon:hover {
    background: #f2f2f2;
}

.nav-center {
    flex: 0 1 728px;
    display: flex;
    align-items: center;
    margin-left: 40px;
}

.search-bar-yt {
    display: flex;
    flex: 1;
    margin-left: 32px;
}

.search-bar-yt input {
    width: 100%;
    height: 40px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 40px 0 0 40px;
    padding: 0 16px;
    font-size: 16px;
    outline: none;
    box-shadow: inset 0 1px 2px #eee;
}

.search-bar-yt input:focus {
    border-color: #0556bf;
}

.search-bar-yt button {
    width: 64px;
    height: 40px;
    background: #f8f8f8;
    border: 1px solid #ccc;
    border-left: none;
    border-radius: 0 40px 40px 0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mic-icon {
    background: #f8f8f8;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-icons img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}

/* Responsividade do Header */
@media (max-width: 768px) {
    .nav-center {
        display: none;
        /* Esconde busca em tablets/celulares como no Youtube */
    }

    .nav-left {
        flex: 1;
    }
}

/* --- Container Principal --- */
.container {
    display: flex;
    flex-direction: row;
    /* Desktop: Lado a lado */
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
    gap: 24px;
}

/* --- Seção do Vídeo --- */
.video-section {
    flex: 2;
    /* Ocupa mais espaço que o chat */
    min-width: 0;
    /* Evita quebra de layout com flex */
}

.video-container {
    width: 100%;
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.video-title {
    font-size: 18px;
    margin: 12px 0;
    line-height: 1.4;
    font-weight: 500;
}

/* --- Info do Canal --- */
.channel-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.profile {
    display: flex;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile h3 {
    font-size: 16px;
    margin: 0;
}

.profile p {
    font-size: 12px;
    color: #606060;
    margin: 0;
}

.subscribe-btn {
    background: #0f0f0f;
    color: white;
    padding: 0 16px;
    height: 36px;
    border-radius: 18px;
    border: none;
    font-weight: 500;
    cursor: pointer;
}

/* --- Seção do Chat --- */
/* --- Seção do Chat Ajustada --- */
.chat-section {
    display: flex;
    flex-direction: column;
    height: 70vh;
    min-height: 500px;
    /* Ou a altura que você definiu */
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    /* Impede que o chat estique a página */
}

.chat-messages {
    flex: 1;
    /* Faz esta parte ocupar todo o espaço entre o header e o footer */
    overflow-y: auto;
    /* Habilita a rolagem interna */
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    /* Essa propriedade ajuda a manter o scroll no fundo em navegadores modernos */
    scroll-behavior: smooth;
}

.chat-footer {
    flex-shrink: 0;
    /* Impede que o footer seja esmagado quando houver muitas mensagens */
    padding: 10px 16px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
}

/* Personalização da barra de rolagem para ficar fina (estilo moderno) */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 10px;
}

/* --- MEDIA QUERIES (A MÁGICA DO MOBILE) --- */
@media (max-width: 1000px) {
    .container {
        flex-direction: column;
        /* Vídeo em cima, Chat embaixo */
        padding: 0;
        /* Remove padding lateral no mobile */
        gap: 0;
    }

    .video-section {
        padding: 10px;
    }

    .video-container {
        border-radius: 0;
        /* Vídeo "edge-to-edge" no mobile fica melhor */
    }

    .chat-section {
        width: 100%;
        height: 75vh;
        /* ocupa 75% da tela */
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .video-title {
        font-size: 16px;
        padding: 0 10px;
    }

    .channel-info {
        padding: 0 10px 15px 10px;
    }
}

/* Ajuste fino para telas muito pequenas */
@media (max-width: 480px) {
    .subscribe-btn {
        padding: 0 12px;
        font-size: 13px;
    }

    .chat-section {
        height: 80vh;
    }

    .video-stats {
        width: 100%;
        font-size: 12px;
        color: #606060;
    }
}

.pulse-button {
    display: inline-block;
    background-color: #ff8c00;
    /* Laranja vibrante */
    color: white;
    padding: 18px 35px;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.7);
    animation: pulse 2s infinite;
    transition: transform 0.2s;
    font-family: 'Roboto', sans-serif;
}

.pulse-button:hover {
    transform: scale(1.05);
    background-color: #e67e00;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(255, 140, 0, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 140, 0, 0);
    }
}

/* Container Geral */
.chat-section {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
}

/* Container pai para garantir alinhamento na navbar */
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Estilo da Marca Redonda */
.user-avatar-text {
    width: 32px;
    /* Tamanho padrão do YouTube */
    height: 32px;
    background-color: #045a10;
    /* Vermelho YouTube (ou mude para a cor que desejar) */
    color: white;
    /* Cor da letra Y */
    border-radius: 50%;
    /* Faz o círculo perfeito */

    /* Centralização Total do "Y" (O segredo do Flexbox) */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Estilo da Letra "Y" */
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 18px;
    /* Ajuste conforme o tamanho do círculo */
    font-weight: 500;
    /* Deixa a letra um pouco mais grossa */
    text-transform: uppercase;
    /* Garante que seja sempre maiúsculo */
    user-select: none;
    /* Impede que o usuário selecione a letra */

    /* Feedback visual ao passar o mouse */
    cursor: pointer;
    transition: filter 0.2s;
}

.user-avatar-text:hover {
    filter: brightness(0.9);
    /* Escurece levemente ao passar o mouse */
}

/* Header */
.chat-header {
    padding: 8px 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

/* Lista de Mensagens */
.chat-messages {
    flex: 1;
    overflow-y: scroll;
    padding: 16px 0;
    background: #f9f9f9;
    /* Fundo levemente cinza como no YT */
}

/* Item de Mensagem Individual (Importante para o JS renderizar assim) */
.chat-msg-item {
    display: flex;
    padding: 4px 16px;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    line-height: 16px;
}

.chat-msg-item:hover {
    background: #f2f2f2;
}

.chat-msg-item .msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-msg-item .msg-author {
    color: #5f5f5f;
    font-weight: 500;
    margin-right: 8px;
}

/* Footer e Input */
.chat-footer {
    padding: 16px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chat-input-wrapper {
    display: flex;
    flex: 1;
    gap: 12px;
}

.user-avatar-small img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.input-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-container input {
    border: none;
    border-bottom: 1px solid #ccc;
    outline: none;
    font-size: 13px;
    padding-bottom: 4px;
    transition: border-color 0.3s;
}

.input-container input:focus {
    border-bottom: 2px solid #065fd4;
}

.input-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    position: relative;
}

.char-count {
    font-size: 11px;
    color: #606060;
}

#sendMessageBtn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}