.chat-widget-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffeb28 0%, #776e18 100%);
    color: #e9eefc;
    border: 1px solid rgba(212, 175, 55, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 14px 28px rgba(11, 18, 32, 0.4),
        0 0 0 3px rgba(212, 175, 55, 0.2),
        0 0 30px rgba(212, 175, 55, 0.55);
    cursor: pointer;
    z-index: 12000;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    animation: chatPremiumPulse 2.8s ease-in-out infinite;
}

.chat-widget-btn .chat-icon {
    font-size: 24px;
    color: #dbe7ff;
    filter: drop-shadow(0 1px 1px rgba(14, 22, 44, 0.35));
}

.chat-widget-btn .online-dot {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #fff;
}

.chat-widget-btn .unread-badge {
    position: absolute;
    left: -2px;
    top: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    padding: 0 6px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget-btn .chat-tooltip {
    position: absolute;
    right: 76px;
    white-space: nowrap;
    background: #111827;
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.chat-widget-btn:hover .chat-tooltip {
    opacity: 1;
}

.chat-widget-btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow:
        0 18px 34px rgba(11, 18, 32, 0.45),
        0 0 0 4px rgba(212, 175, 55, 0.28),
        0 0 38px rgba(212, 175, 55, 0.68);
    filter: saturate(1.05);
}

.chat-widget-btn:active {
    transform: translateY(-1px) scale(0.99);
}

@keyframes chatPremiumPulse {
    0%, 100% {
        box-shadow:
            0 14px 28px rgba(11, 18, 32, 0.4),
            0 0 0 3px rgba(212, 175, 55, 0.18),
            0 0 26px rgba(212, 175, 55, 0.48);
    }
    50% {
        box-shadow:
            0 16px 30px rgba(11, 18, 32, 0.44),
            0 0 0 4px rgba(212, 175, 55, 0.24),
            0 0 34px rgba(212, 175, 55, 0.62);
    }
}

.chat-widget-window {
    position: fixed;
    right: 24px;
    bottom: 98px;
    width: 318px;
    height: 451px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    display: none;
    flex-direction: column;
    z-index: 12001;
}

.chat-widget-window.open {
    display: flex;
}

.chat-widget-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    background: linear-gradient(135deg, #0b1220 0%, #1e2a44 100%);
}

.agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.agent-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.agent-name {
    font-weight: 700;
    font-size: 14px;
}

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

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.header-btn {
    border: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}

.chat-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f9fafb;
}

.chat-message {
    margin: 8px 0;
    display: flex;
    flex-direction: column;
}

.chat-message.user {
    align-items: flex-end;
}

.chat-message.agent {
    align-items: flex-start;
}

.chat-message .bubble {
    max-width: 78%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
}

.chat-message.user .bubble {
    background: #1e2a44;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.agent .bubble {
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.chat-message .timestamp {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
}

.chat-widget-footer {
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
}

.footer-btn,
.send-btn {
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eef2ff;
    color: #1e2a44;
    cursor: pointer;
}

.chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    outline: none;
}

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    border-radius: 50%;
    background: #9ca3af;
    animation: chatDot 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

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

@media (max-width: 768px) {
    .chat-widget-btn {
        right: 16px;
        bottom: 16px;
        width: 68px;
        height: 68px;
    }

    .chat-widget-window {
        right: 12px;
        bottom: 92px;
        width: min(360px, calc(100vw - 24px));
        height: 68vh;
    }
}

@media (max-width: 600px) {
    .chat-widget-btn {
        right: 14px;
        bottom: 14px;
    }

    .chat-widget-window {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 86px;
        height: 70vh;
    }
}
