/* WhatsApp Realistic Styles - BíbliaZapZap */

/* CHAT CONTAINER */
.wa-chat {
    background: #e5ddd5;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.05"/><circle cx="10" cy="60" r="0.5" fill="%23ffffff" opacity="0.05"/><circle cx="90" cy="40" r="0.5" fill="%23ffffff" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    flex: 1;
    overflow: hidden; /* Container não tem scroll, só flex */
    border-radius: 0 0 30px 30px;
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* MESSAGES CONTAINER */
.wa-messages-container {
    flex: 1;
    overflow-y: auto; /* Scroll APENAS aqui */
    overflow-x: hidden;
    padding: 20px 20px 0 20px;
    order: 1; /* Garantir que fica antes do input */
    min-height: 0; /* Permite flex shrink */
    scroll-behavior: smooth; /* Scroll suave */
}

/* INPUT CONTAINER - Garantir que fica no final */
.wa-chat .wa-input-container {
    order: 999;
    flex-shrink: 0;
    background: #f0f0f0;
    padding: 10px 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 30px 30px;
    margin-top: auto;
    margin-bottom: 0;
    z-index: 1;
}

/* MENSAGENS COM MÍDIA - IMAGENS E ÁUDIO */
.wa-message-media {
    margin-bottom: 4px;
    display: flex;
    animation: slideIn 0.3s ease;
}

.wa-message.user .wa-message-media {
    justify-content: flex-end;
}

.wa-message.bot .wa-message-media {
    justify-content: flex-start;
}

.wa-media-container {
    max-width: 75%;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wa-message.user .wa-media-container {
    background: #d9fdd3;
    border-bottom-right-radius: 2px;
    border: 1px solid #d1f4cc;
}

.wa-message.bot .wa-media-container {
    background: white;
    border-bottom-left-radius: 2px;
    border: 1px solid #ECECEC;
}

.wa-media-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    border-radius: 8px;
}

.wa-media-audio {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    margin: 8px;
}

.wa-audio-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #25d366;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.wa-audio-play-btn:hover {
    background: #128c7e;
    transform: scale(1.05);
}

.wa-audio-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-audio-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.wa-audio-duration {
    font-size: 12px;
    color: #666;
}

.wa-audio-progress {
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.wa-audio-progress-bar {
    height: 100%;
    background: #25d366;
    width: 0%;
    transition: width 0.1s;
}

.wa-media-caption {
    padding: 8px 12px;
    font-size: 14px;
    color: #1f2937;
    line-height: 1.4;
}

.wa-media-time {
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
    text-align: right;
    padding: 0 12px 8px;
}

/* RESPONSIVIDADE MOBILE */
@media (max-width: 768px) {
    .wa-chat {
        height: 300px; /* Altura menor no mobile */
    }
    
    .wa-messages-container {
        padding: 15px 15px 0 15px;
    }
    
    .wa-input-container {
        padding: 8px 15px 15px 15px; /* Padding menor no mobile */
    }
    
    .wa-input-wrapper {
        padding: 8px 12px; /* Padding menor no mobile */
    }
    
    .wa-input {
        font-size: 14px; /* Fonte menor no mobile */
    }
    
    .wa-send-btn {
        width: 28px; /* Botão menor no mobile */
        height: 28px;
    }
    
    .wa-media-container {
        max-width: 85%;
    }
    
    .wa-media-image {
        max-width: 150px;
    }
    
    /* Logo responsivo */
    .wa-avatar {
        width: 32px !important;
        height: 32px !important;
    }
    
    .wa-avatar img {
        width: 100% !important;
        height: 100% !important;
    }
}

/* MESSAGE BUBBLES */
.wa-message {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-end;
}

.wa-message.user {
    justify-content: flex-end;
    flex-direction: column;
    align-items: flex-end;
}

.wa-message.bot {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.wa-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wa-bubble.user {
    background: #dcf8c6;
    border-radius: 18px 18px 4px 18px;
    margin-left: 20px;
}

.wa-bubble.bot {
    background: white;
    border-radius: 18px 18px 18px 4px;
    margin-right: 20px;
}

/* USER LABEL */
.wa-user-label {
    font-size: 0.7rem;
    color: #25d366;
    text-align: right;
    margin-top: 2px;
    font-weight: 600;
    margin-right: 20px;
    margin-bottom: 4px;
}

/* MESSAGE TEXT */
.wa-text {
    color: #303030;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.wa-time {
    font-size: 11px;
    color: #667781;
    text-align: right;
    margin-top: 4px;
}

.wa-status {
    position: absolute;
    bottom: 4px;
    right: 8px;
    color: #4fc3f7;
}

/* TYPING INDICATOR */
.wa-typing-indicator {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 16px;
}

.wa-typing-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 12px;
    background: white;
    border-radius: 18px 18px 18px 4px;
    margin-right: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    min-width: 40px;
}

.wa-typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.wa-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* DAY SEPARATOR */
.wa-day-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.wa-day-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #d1d7db;
}

.wa-day-separator span {
    background: #e5ddd5;
    color: #667781;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* INPUT CONTAINER */
.wa-input-container {
    background: #f0f0f0;
    padding: 10px 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 20px 20px;
    margin-top: auto;
    order: 999; /* Garantir que fica no final */
    z-index: 10;
}

.wa-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 25px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 0;
}

.wa-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 12px;
    font-size: 14px;
    background: transparent;
}

.wa-send-btn {
    background: #25d366;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.wa-send-btn:hover {
    background: #128c7e;
}

/* VERSES */
.wa-verse {
    font-weight: 600;
    color: #075e54;
    font-style: italic;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #25d366;
}

/* STATUS MESSAGES */
.wa-status-message {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1565c0;
    margin-bottom: 8px;
}

/* AUDIO MESSAGES */
.wa-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 8px;
}

.wa-audio-play {
    width: 24px;
    height: 24px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
}

.wa-audio-progress {
    flex: 1;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    position: relative;
}

.wa-audio-progress-bar {
    height: 100%;
    background: #25d366;
    border-radius: 2px;
    width: 30%;
}

.wa-audio-duration {
    font-size: 12px;
    color: #666;
}

/* IMAGE MESSAGES */
.wa-image {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.wa-image-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wa-image-icon {
    width: 20px;
    height: 20px;
    background: #6c757d;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.wa-image-content {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
}

/* MESSAGE CONTENT - Seguindo diretrizes do WhatsApp */
.wa-text {
    color: #303030;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.wa-text strong {
    font-weight: 600;
}

.wa-text em {
    font-style: italic;
}


/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .wa-chat {
        height: 300px;
        padding: 15px;
    }
    
    .wa-bubble {
        max-width: 85%;
        padding: 10px 14px;
    }
    
    .wa-bubble.user {
        margin-left: 15px;
    }
    
    .wa-bubble.bot {
        margin-right: 15px;
    }
    
    .wa-typing-dots {
        margin-right: 15px;
    }
}

/* SCROLLBAR STYLING - Aplicado ao messages container */
.wa-messages-container::-webkit-scrollbar {
    width: 5px;
}

.wa-messages-container::-webkit-scrollbar-track {
    background: transparent;
    margin: 0;
}

.wa-messages-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
}

.wa-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.4);
    background-clip: padding-box;
}

/* ANIMATIONS */
.wa-message {
    animation: slideIn 0.3s ease-out;
}

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

.wa-bubble {
    animation: bubbleIn 0.2s ease-out;
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* LEVEL BADGES */
.wa-level {
    color: #4ecdc4;
    font-weight: 700;
}

/* DAY SEPARATOR ENHANCED */
.wa-day-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.wa-day-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #d1d7db;
}

.wa-day-separator span {
    background: #e5ddd5;
    color: #667781;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* TYPING INDICATOR ENHANCED */
.wa-typing-indicator {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 16px;
}

.wa-typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px 18px 18px 4px;
    margin-right: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

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

.wa-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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