/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #fff;
    height: 100vh;
    overflow: hidden;
}

/* Header do Chat */
.user-bar {
    background: #075e54;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.back a {
    color: white;
    text-decoration: none;
    font-size: 18px;
}

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

.name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    margin-left: 15px;
}

.name span:first-child {
    font-weight: 600;
    font-size: 16px;
}

.verificado svg {
    width: 18px;
    height: 18px;
}

.status {
    font-size: 12px;
    opacity: 0.8;
}

.actions {
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.downBottom {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #25d366;
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    display: none;
}

/* Container principal */
.typebot-container {
    background-image: url('https://igorlemoes.com.br/files/whatsapp/background.png');
    background-size: initial;
    background-repeat: repeat-x;
    background-position: center;
    height: 100vh;
    padding-top: 60px;
    overflow-y: auto;
}

.typebot-chat-view {
    max-width: 800px;
    margin: 0 auto;
    background-color: rgba(0, 0, 0, 0);
    min-height: calc(100vh - 60px);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Informações da conta */
.info-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #d5f4f0;
    border-radius: 10px;
    padding: 10px;
    width: fit-content;
    max-width: 450px;
    margin: 3rem auto 0.5rem;
    font-size: 14px;
}

.info-container p {
    color: #53676b;
    margin: 0;
}

/* Data */
.hoje {
    position: fixed;
    z-index: 994;
    text-align: center;
    width: 50px;
    top: 80px;
    left: calc(50% - 25px);
    background-color: #ede8e2;
    margin: 0 auto;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0px 1px #c6beb7;
    padding: 4px 8px;
}

/* Área de mensagens */
.chat-messages {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Mensagens do bot */
.typebot-host-bubble {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    max-width: 85%;
}

.typebot-avatar-container {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.typebot-avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.bubble-typing {
    background-color: #f7f8ff;
    color: #303235;
    border-radius: 12px 12px 12px 0;
    padding: 12px 16px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    word-wrap: break-word;
}

.bubble-typing:after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0px 10px 10px 0;
    border-color: transparent #f7f8ff transparent transparent;
    bottom: 0;
    left: -9px;
    transform: scaleY(-1);
}

.bubble-typing p {
    margin: 0;
    line-height: 1.4;
}

.bubble-typing .slate-bold {
    font-weight: bold;
}

.bubble-typing .slate-italic {
    font-style: italic;
}

/* Mensagens do usuário */
.typebot-guest-bubble {
    background-color: #e1ffc7;
    color: #303235;
    border-radius: 12px 12px 0 12px;
    padding: 12px 16px;
    position: relative;
    max-width: 70%;
    margin-left: auto;
    margin-right: 0;
    word-wrap: break-word;
    min-width: 70px;
}

.typebot-guest-bubble:after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0px 0 10px 10px;
    border-color: transparent transparent transparent #e1ffc7;
    bottom: 0;
    right: -9px;
    transform: scaleY(-1);
}

/* Timestamps */
.hora {
    position: absolute;
    bottom: 2px;
    right: 10px;
    font-size: 11px;
    color: #999;
    z-index: 995;
}

.hora2 {
    position: absolute;
    bottom: 2px;
    right: 26px;
    font-size: 11px;
    color: #999;
    z-index: 995;
}

/* Ícones de check */
#checkIcon {
    position: absolute;
    bottom: 2px;
    right: 5px;
    height: 20px;
    width: 18px;
    z-index: 996;
}

#checkIcon path {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
}

#checkIcon path:nth-child(1) {
    animation: showIcon 250ms ease forwards;
    animation-delay: 500ms;
}

#checkIcon path:nth-child(2) {
    animation: showIcon 250ms ease forwards;
    animation-delay: 400ms;
}

@keyframes showIcon {
    to { stroke-dashoffset: 0; }
}

/* Player de Áudio Personalizado */
.custom-audio-player {
    background: #f0f0f0;
    border-radius: 20px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 280px;
    min-width: 200px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.audio-play-button {
    background: #25d366;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-play-button:hover {
    background: #20c55a;
    transform: scale(1.05);
}

.audio-play-button:active {
    transform: scale(0.95);
}

.audio-play-button svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.audio-time {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

.audio-progress-container {
    flex: 1;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    margin: 0 8px;
}

.audio-progress-bar {
    height: 100%;
    background: #25d366;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
}

.audio-progress-handle {
    position: absolute;
    top: 50%;
    right: 0;
    width: 12px;
    height: 12px;
    background: #25d366;
    border-radius: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.audio-progress-container:hover .audio-progress-handle {
    opacity: 1;
}

.audio-volume {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.audio-volume:hover {
    background: rgba(0, 0, 0, 0.05);
}

.audio-volume svg {
    width: 18px;
    height: 18px;
    fill: #666;
}

.audio-more {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.audio-more:hover {
    background: rgba(0, 0, 0, 0.05);
}

.audio-more svg {
    width: 16px;
    height: 16px;
    fill: #666;
}

/* Estados do player */
.audio-player.playing .audio-play-button {
    background: #dc3545;
}

.audio-player.playing .audio-play-button svg {
    transform: scale(0.8);
}

.audio-player.loading .audio-play-button {
    background: #6c757d;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Áudios antigos (ocultos) */
audio {
    display: none;
}

/* Imagens */
.bubble-typing img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}

/* Vídeos */
.bubble-typing iframe {
    width: 100%;
    height: 400px;
    border-radius: 6px;
    border: none;
}

/* Botões */
.typebot-button {
    background: #008a7c;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: center;
    width: 100%;
    max-width: 300px;
}

.typebot-button:hover {
    background: #006b5f;
    transform: translateY(-1px);
}

.typebot-button:active {
    transform: translateY(0);
}

/* Container de input */
.typebot-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 20px 0;
    margin-top: auto;
}

/* Animações */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

.text-fade-in {
    transition: opacity 0.4s ease-in 0.2s;
}

/* Espaçador inferior */
.typebot-bottom-spacer {
    height: 128px;
    flex-shrink: 0;
}

/* Responsividade */
@media (max-width: 768px) {
    .typebot-chat-view {
        padding: 15px;
    }
    
    .typebot-host-bubble {
        max-width: 90%;
    }
    
    .typebot-guest-bubble {
        max-width: 80%;
    }
    
    .info-container {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .user-bar {
        padding: 10px 15px;
    }
    
    .typebot-chat-view {
        padding: 10px;
    }
    
    .hoje {
        top: 70px;
    }
}

/* Scrollbar personalizada */
.typebot-container::-webkit-scrollbar {
    width: 6px;
}

.typebot-container::-webkit-scrollbar-track {
    background: transparent;
}

.typebot-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.typebot-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Efeitos de hover */
.typebot-button:hover {
    box-shadow: 0 4px 12px rgba(0, 138, 124, 0.3);
}

/* Estados especiais */
.guest-container {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 10px;
    margin-left: 50px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-2 {
    gap: 8px;
}

.items-end {
    align-items: flex-end;
}

.justify-end {
    justify-content: flex-end;
}

.w-full {
    width: 100%;
}

.max-w-full {
    max-width: 100%;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.opacity-100 {
    opacity: 1;
}

.whitespace-pre-wrap {
    white-space: pre-wrap;
}

.text-ellipsis {
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Animações de entrada das mensagens */
.typebot-chat-chunk {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    min-width: 0;
}

.typebot-chat-chunk .animate-fade-in {
    animation: fadeInFromBottom 0.3s ease-out;
}

@keyframes fadeInFromBottom {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}