/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e5ddd5;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Container Principal - Estilo WhatsApp */
.chat-container {
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
}

/* Header WhatsApp */
.chat-header {
    background: #075e54;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-text h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.status {
    font-size: 12px;
    color: #a7a7a7;
}

/* Área de Mensagens - Estilo WhatsApp */
.chat-messages {
    flex: 1;
    padding: 16px 12px 0 12px;
    overflow-y: auto;
    background: #e5ddd5;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 119, 198, 0.2) 0%, transparent 50%);
    scroll-behavior: smooth;
    min-height: calc(100vh - 80px);
    position: relative;
    padding-bottom: 75px !important;
}

/* Espaçamento fixo no final */
.chat-messages::after {
    content: '';
    display: block;
    height: 125px;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
}

.fixed-bottom-spacer {
    height: 125px;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

/* Mensagens */
.message {
    margin-bottom: 16px;
    animation: fadeInUp 0.5s ease-out;
}

.message.bot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message.user {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 8px;
    flex-direction: row-reverse;
    margin-bottom: 40px;
}

.message.user .message-avatar {
    display: none;
}

/* Avatar */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    flex-shrink: 0;
}

.message-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.message-avatar i {
    color: #666;
    font-size: 14px;
}

/* Conteúdo das Mensagens */
.message-content {
    max-width: 85%;
    position: relative;
}

.message.bot .message-content {
    max-width: 85%;
    position: relative;
}

.message.user .message-content {
    max-width: 85%;
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    margin-left: auto;
    margin-right: 0;
}

.message-text {
    background: #ffffff;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.message.user .message-text {
    background: #dcf8c6;
    color: #333;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    margin-right: 0;
}

/* Botões de Ação - Estilo WhatsApp */
.action-button {
    background: #075e54;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    margin-bottom: 40px;
    margin-left: auto;
    margin-right: 0;
    display: block;
    min-width: 200px;
    max-width: 280px;
    box-shadow: 0 2px 8px rgba(7, 94, 84, 0.3);
    text-align: center;
    width: fit-content;
}

.action-button:hover {
    background: #064a42;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(7, 94, 84, 0.4);
}

.action-button:active {
    transform: translateY(0);
    background: #053a34;
}

/* Inputs - Reformulados */
.text-input {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    padding: 14px 18px;
    border-radius: 25px;
    font-size: 15px;
    width: 100%;
    max-width: 280px;
    margin-top: 12px;
    margin-bottom: 16px;
    margin-left: auto;
    margin-right: 0;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

.text-input:focus {
    border-color: #075e54;
    box-shadow: 0 0 0 3px rgba(7, 94, 84, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Container para inputs do usuário */
.message.user .message-content {
    max-width: 85%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    margin-right: 0;
}

/* Botões de tipo PIX */
.pix-type-button {
    background: #075e54;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 6px;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(7, 94, 84, 0.3);
}

.pix-type-button:hover {
    background: #064a42;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(7, 94, 84, 0.4);
}

/* Botões de perguntas múltiplas */
.question-button {
    background: #075e54;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 6px;
    min-width: 200px;
    box-shadow: 0 2px 8px rgba(7, 94, 84, 0.3);
}

.question-button:hover {
    background: #064a42;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(7, 94, 84, 0.4);
}

/* Imagens */
.image-container {
    margin: 8px 0;
}

.image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Player de Áudio WhatsApp - Design Melhorado */
.whatsapp-audio-player {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 12px 16px;
    border-radius: 20px;
    display: flex !important;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
    max-width: 260px;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10;
}

.audio-play-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #075e54 0%, #0a6b5f 100%);
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(7, 94, 84, 0.4), 0 1px 3px rgba(7, 94, 84, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 11;
}

.audio-play-button:hover {
    background: linear-gradient(135deg, #0a6b5f 0%, #0d7a6b 100%);
    transform: scale(1.15);
    box-shadow: 0 5px 12px rgba(7, 94, 84, 0.5), 0 2px 6px rgba(7, 94, 84, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}


/* Player de Vídeo WhatsApp - CONTAINER RESPONSIVO */
.whatsapp-video-player {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    width: 100%;
    margin: 8px 0;
    position: relative;
}

.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 200%; /* Proporção 1:2 (200x400) */
    background: #000;
    border-radius: 12px 12px 0 0;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 12px 12px 0 0;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-overlay:hover {
    background: rgba(0, 0, 0, 0.2);
}

.play-button {
    width: 50px;
    height: 50px;
    background: rgba(7, 94, 84, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.play-button:hover {
    background: rgba(7, 94, 84, 1);
    transform: scale(1.1);
}

.video-info {
    padding: 10px 12px;
    background: #ffffff;
}

.video-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.video-description {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
}

.whatsapp-audio-player:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Estilo para áudio tocando */
.whatsapp-audio-player.playing {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border: 1px solid #075e54;
    box-shadow: 0 3px 10px rgba(7, 94, 84, 0.2), 0 1px 4px rgba(7, 94, 84, 0.1);
}

.audio-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 18px;
    flex: 1;
    padding: 2px 0;
    margin: 0 8px;
}

.wave-bar {
    width: 3px;
    background: linear-gradient(180deg, #075e54 0%, #0a6b5f 100%);
    border-radius: 2px;
    animation: wave 1.4s ease-in-out infinite;
    box-shadow: 0 1px 2px rgba(7, 94, 84, 0.3);
}

.wave-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 16px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 12px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 8px; animation-delay: 0.4s; }

/* Animação das barras quando tocando */
.audio-waveform.playing .wave-bar {
    animation-duration: 0.8s;
    animation-iteration-count: infinite;
}

.audio-waveform.playing .wave-bar:nth-child(1) { animation-delay: 0s; }
.audio-waveform.playing .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-waveform.playing .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-waveform.playing .wave-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-waveform.playing .wave-bar:nth-child(5) { animation-delay: 0.4s; }

.audio-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.audio-duration {
    font-size: 12px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Comprovante NuBank */
.comprovante-nubank {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

.comprovante-header {
    background: #ffffff;
    padding: 16px 20px;
    text-align: center;
    color: #333;
}

.nubank-logo {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 4px;
}

.comprovante-title {
    font-size: 14px;
    opacity: 0.9;
}

.comprovante-body {
    padding: 20px;
}

.valor-section {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.valor-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.valor-amount {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.agendamento-section {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.agendamento-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.agendamento-data {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.pagador-section, .recebedor-section {
    margin-bottom: 16px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pagador-info, .recebedor-info {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.codigo-section {
    text-align: center;
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.codigo-label {
    font-size: 10px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 1px;
}

.codigo-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.empresa-section {
    text-align: center;
    padding: 12px 16px;
    background: #f8f9fa;
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

/* Modais */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close:hover {
    color: #000;
}

/* Animações */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* Responsividade Mobile First */
@media (max-width: 768px) {
    .chat-header {
        padding: 12px 16px;
    }
    
    .header-text h3 {
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 12px 8px 0 8px;
        padding-bottom: 100px !important;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .message.user {
        margin-bottom: 30px;
    }
    
    .action-button {
        min-width: 200px;
        padding: 16px 24px;
        font-size: 16px;
        margin-bottom: 50px;
        min-height: 55px;
    }
    
    .whatsapp-audio-player {
        min-width: 200px;
        max-width: 280px;
    }
    
    .audio-play-button {
        width: 48px;
        height: 48px;
    }
    
    .audio-play-button svg {
        width: 24px;
        height: 24px;
    }
    
    .whatsapp-video-player {
        max-width: 270px;
    }
    
    .video-container {
        padding-bottom: 200%; /* Mantém proporção 1:2 */
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 10px 12px;
    }
    
    .header-text h3 {
        font-size: 15px;
    }
    
    .chat-messages {
        padding: 10px 6px 0 6px;
        padding-bottom: 125px !important;
    }
    
    .message-content {
        max-width: 95%;
    }
    
    .message.user {
        margin-bottom: 25px;
    }
    
    .action-button {
        min-width: 180px;
        padding: 14px 20px;
        font-size: 15px;
        margin-bottom: 40px;
        min-height: 60px;
    }
    
    .whatsapp-video-player {
        max-width: 240px;
    }
    
    .video-container {
        padding-bottom: 200%; /* Mantém proporção 1:2 */
    }
    
    .play-button {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* Scrollbar Personalizada */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}