/* ===== CHAT WIDGET ===== */
.cw-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E8612D, #C74E1F);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(232, 97, 45, 0.4);
    transition: all 0.3s ease;
    animation: cw-bounce 3s ease-in-out infinite;
}
.cw-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 32px rgba(232, 97, 45, 0.5);
}
.cw-trigger svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: transform 0.3s;
}
.cw-trigger.active svg.cw-icon-chat { display: none; }
.cw-trigger.active svg.cw-icon-close { display: block; }
.cw-trigger svg.cw-icon-close { display: none; }

@keyframes cw-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.cw-trigger.active { animation: none; }

/* Notification dot */
.cw-trigger .cw-notif {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #070E1A;
    font-size: 0;
    animation: cw-pulse-notif 2s ease-in-out infinite;
}
.cw-trigger.active .cw-notif { display: none; }

@keyframes cw-pulse-notif {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ===== CHAT WINDOW ===== */
.cw-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    max-height: 520px;
    background: rgba(15, 30, 52, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(232, 97, 45, 0.1);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.cw-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.cw-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(232, 97, 45, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    position: relative;
}
.cw-header-close {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #8899AB;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.cw-header-close:hover {
    background: rgba(255,255,255,0.1);
    color: #F0F2F5;
}
.cw-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E8612D, #C74E1F);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}
.cw-header-info {
    flex: 1;
}
.cw-header-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #F0F2F5;
}
.cw-header-status {
    font-size: 0.75rem;
    color: #25D366;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cw-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #25D366;
    border-radius: 50%;
}

/* Messages area */
.cw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 340px;
}
.cw-messages::-webkit-scrollbar {
    width: 4px;
}
.cw-messages::-webkit-scrollbar-track {
    background: transparent;
}
.cw-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Message bubbles */
.cw-msg {
    max-width: 85%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: cw-msg-in 0.3s ease;
}
@keyframes cw-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cw-msg.bot {
    background: rgba(232, 97, 45, 0.12);
    border: 1px solid rgba(232, 97, 45, 0.2);
    color: #F0F2F5;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.cw-msg.user {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8899AB;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.cw-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}
.cw-typing span {
    width: 6px;
    height: 6px;
    background: rgba(232, 97, 45, 0.6);
    border-radius: 50%;
    animation: cw-typing-dot 1.4s ease-in-out infinite;
}
.cw-typing span:nth-child(2) { animation-delay: 0.2s; }
.cw-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cw-typing-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Options */
.cw-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
    width: 85%;
    animation: cw-msg-in 0.3s ease;
}
.cw-option-btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(232, 97, 45, 0.3);
    background: rgba(232, 97, 45, 0.06);
    color: #F0F2F5;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.cw-option-btn:hover {
    background: rgba(232, 97, 45, 0.15);
    border-color: #E8612D;
    transform: translateX(4px);
}

/* Input area */
.cw-input-area {
    display: none;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.cw-input-area.visible {
    display: flex;
    gap: 8px;
    align-items: center;
}
.cw-input-area input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #F0F2F5;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.cw-input-area input:focus {
    border-color: rgba(232, 97, 45, 0.5);
}
.cw-input-area input::placeholder {
    color: rgba(136, 153, 171, 0.6);
}
.cw-input-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #E8612D;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.cw-input-send:hover {
    background: #C74E1F;
    transform: scale(1.05);
}
.cw-input-send svg {
    width: 18px;
    height: 18px;
}

/* Final CTA button */
.cw-final-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 100px;
    background: #25D366;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
    animation: cw-msg-in 0.3s ease;
}
.cw-final-cta:hover {
    background: #20bd5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
}
.cw-final-cta svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* ===== POPUP OVERLAY ===== */
.cw-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.cw-popup-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.cw-popup {
    width: 400px;
    max-width: 90vw;
    background: rgba(15, 30, 52, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(232, 97, 45, 0.2);
    border-radius: 20px;
    padding: 32px 28px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(232, 97, 45, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.cw-popup-overlay.visible .cw-popup {
    transform: scale(1) translateY(0);
}

.cw-popup-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(136, 153, 171, 0.6);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.cw-popup-close:hover {
    color: #F0F2F5;
}

.cw-popup .cw-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.1rem;
    margin: 0 auto 16px;
}
.cw-popup-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #F0F2F5;
    margin-bottom: 8px;
}
.cw-popup-msg {
    color: #8899AB;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}
.cw-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 100px;
    background: linear-gradient(135deg, #E8612D, #C74E1F);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}
.cw-popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(232, 97, 45, 0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .cw-window {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .cw-messages {
        max-height: none;
        flex: 1;
    }
    .cw-trigger {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
    }
    .cw-header-close {
        display: flex;
    }
}
