:root {
    --wa-header-bg: #008069;
    --wa-chat-bg: #EFEAE2;
    --wa-message-out: #E7FFDB;
    --wa-message-in: #FFFFFF;
    --wa-teal: #00a884;
}

/* Global Reset for Chat */
.chat-funnel {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    /* Backdrop */
}

.chat-funnel.active {
    display: flex;
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(100%);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-red {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.main-container {
    width: 100%;
    max-width: 500px;
    background-color: var(--wa-chat-bg);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-repeat: repeat;
    background-size: 300px;
    position: relative;
    overflow: hidden;
}

@media (min-width: 600px) {
    .main-container {
        height: 90vh;
        max-height: 800px;
        border-radius: 18px;
        border: 1px solid #d1d7db;
    }
}

/* Header */
header {
    background-color: var(--wa-header-bg);
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    flex-shrink: 0;
}

/* ... (middle content) ... */

/* Messages */
.message {
    max-width: 85%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    font-size: 14.2px;
    line-height: 19px;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    word-wrap: break-word;
    color: #111b21;
    /* Force dark text color */
}

.action-btn {
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-pic {
    width: 40px;
    height: 40px;
    background-color: #ddd;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 4px;
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

header .profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    padding: 0 !important;
    /* Override professional.css 65px padding */
}

.profile-info h1 {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.status-text {
    font-size: 12px;
    color: white;
    opacity: 0.9;
    font-weight: 400;
    margin: 0;
}

/* Chat Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Hide Scrollbar */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    background: transparent;
}

.chat-messages::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari/Opera */
}

/* Messages */
.message {
    max-width: 85%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    font-size: 14.2px;
    line-height: 19px;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    word-wrap: break-word;
}

.message.sabrina,
.message.dennis {
    align-self: flex-start;
    background-color: var(--wa-message-in);
    border-top-left-radius: 0;
}

.message.user {
    align-self: flex-end;
    background-color: var(--wa-message-out);
    border-top-right-radius: 0;
}

.message-time {
    display: inline-block;
    float: right;
    margin-left: 7px;
    position: relative;
    top: 5px;
    color: rgba(0, 0, 0, 0.45);
    font-size: 11px;
}

/* 📱 WHATSAPP STYLE INPUT BAR */
.wa-input-container {
    padding: 5px 10px 10px;
    background-color: transparent;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    z-index: 100;
}

.wa-input-wrapper {
    background: #ffffff;
    border-radius: 24px;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 12px;
    min-height: 48px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.wa-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-input-field {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 5px;
}

.wa-btn-emoji {
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    margin-right: 5px;
}

.wa-input-field input {
    width: 100%;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 16px;
    background: transparent;
    color: #111b21;
}

.wa-action-btn-container {
    width: 48px;
    height: 48px;
}

.wa-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #00a884;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.wa-action-btn:active {
    transform: scale(0.95);
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
        opacity: 0.6;
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
        opacity: 1;
    }
}

.wa-action-btn.pulse {
    animation: pulse-red 1.5s infinite;
    background-color: #ff0000;
}

/* Typing Indicator (Customized for WA style) */
.chat-typing {
    background-color: white;
    padding: 8px 12px;
    border-radius: 8px;
    border-top-left-radius: 0;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: #b4b4b4;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.chat-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Audio Player Styles from CredFacil */
.message-audio {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.audio-play {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #E9E9E9;
    /* User: WA Teal */
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .audio-play {
    background: #cfe9ba;
}

.play-icon,
.pause-icon {
    width: 24px;
    height: 24px;
    fill: #54656F;
}

.message.user .play-icon,
.message.user .pause-icon {
    fill: #54656F;
}

.audio-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    flex: 1;
}

.audio-wave span {
    width: 3px;
    background-color: #B9B9B9;
    border-radius: 2px;
    height: 12px;
}

.message.user .audio-wave span {
    background-color: #8BAA91;
}

.audio-wave.playing span {
    animation: waveAnim 0.8s ease-in-out infinite alternate;
    background-color: #54656F;
}

@keyframes waveAnim {
    from {
        height: 8px;
    }

    to {
        height: 20px;
    }
}

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

/* ========================================
   WHATSAPP STYLE AUDIO PLAYER
   ======================================== */
.wa-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    min-width: 200px;
    position: relative;
}

.wa-audio-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.wa-audio-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wa-mic-icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 14px;
    background: #25D366;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-audio-avatar.user-avatar {
    background: #dfe5e7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.wa-audio-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #E9E9E9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #54656F;
}

.wa-audio-btn:hover {
    background: #d1d7db;
}

.wa-audio-speed {
    background: rgba(0, 0, 0, 0.06);
    color: #54656F;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.wa-audio-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 100px;
}

.wa-audio-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
}

.wa-audio-waveform span {
    width: 3px;
    background-color: #B9B9B9;
    border-radius: 3px;
    transition: background-color 0.15s ease;
}

.message.user .wa-audio-waveform span {
    background-color: #8BAA91;
}

/* Played bars turn blue (progress indicator) */
.wa-audio-waveform span.played {
    background-color: #34B7F1 !important;
}

.message.user .wa-audio-waveform span.played {
    background-color: #25D366 !important;
}

/* Animation only on non-played bars while playing */
.wa-audio-waveform.playing span:not(.played) {
    animation: waveAnim 0.4s ease-in-out infinite alternate;
}

.wa-audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wa-audio-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.45);
}

.wa-audio-timestamp {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.45);
}

/* ========================================
   WHATSAPP TICKS (CHECKMARKS)
   ======================================== */
.wa-ticks {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
}

.wa-ticks svg {
    width: 16px;
    height: 11px;
}

/* Gray ticks (delivered) */
.wa-ticks.delivered svg {
    fill: rgba(0, 0, 0, 0.45);
}

/* Blue ticks (read) */
.wa-ticks.read svg {
    fill: #53bdeb;
}


/* ========================================
   PROFILE MODAL (from credfacil reference)
   ======================================== */
.profile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.profile-modal[style*="display: flex"] {
    display: flex !important;
}

.profile-modal .modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 350px;
    overflow: hidden;
}

.profile-modal .modal-close {
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px;
}

.profile-modal .modal-profile-pic {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 15px;
    overflow: hidden;
    border: 4px solid #f0f2f5;
}

.profile-modal .modal-profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-modal .modal-name {
    font-size: 20px;
    font-weight: 500;
    color: #111;
    margin-bottom: 5px;
}

.profile-modal .modal-phone {
    font-size: 16px;
    color: var(--wa-teal);
    margin-bottom: 5px;
}

.profile-modal .modal-actions {
    display: flex;
    justify-content: space-around;
    padding: 15px 10px;
    border-top: 1px solid #f0f2f5;
    background: #fafafa;
}

.profile-modal .modal-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background 0.2s;
}

.profile-modal .modal-action:hover {
    background: #e9edef;
}

.profile-modal .modal-action i {
    font-size: 22px;
    color: var(--wa-teal);
}

.profile-modal .modal-action span {
    font-size: 12px;
    color: var(--wa-teal);
}

/* Call Alert */
.call-alert {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #323739;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Custom Alert Modal */
.custom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.custom-modal.active {
    display: flex;
}