.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5a623, #e8941a);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(245, 166, 35, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(245, 166, 35, 0.5);
}

.chat-toggle-icon {
    font-size: 26px;
    color: #fff;
}

.chat-toggle-close i {
    font-size: 22px;
    color: #fff;
}

.chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.chat-greeting-bubble {
    position: absolute;
    bottom: 72px;
    right: 0;
    background: #fff;
    color: #333;
    padding: 14px 18px;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    font-size: 14px;
    line-height: 1.5;
    width: 280px;
    animation: greetSlideIn 0.4s ease;
    cursor: pointer;
}

.chat-greeting-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}

.chat-greeting-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
}

.chat-greeting-close:hover {
    color: #666;
}

.chat-greeting-name {
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-greeting-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5a623, #e8941a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

@keyframes greetSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-box {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: chatSlideUp 0.3s ease;
}

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

.chat-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(245,166,35,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #f5a623;
}

.chat-header-title {
    font-weight: 600;
    font-size: 15px;
}

.chat-header-status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
    animation: pulse 2s infinite;
}

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

.chat-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px;
}

.chat-header-close:hover {
    opacity: 1;
}

.chat-start-form {
    padding: 24px 20px;
    text-align: center;
}

.chat-start-welcome {
    margin-bottom: 20px;
}

.chat-start-emoji {
    font-size: 48px;
    margin-bottom: 8px;
}

.chat-start-welcome h5 {
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
    font-size: 18px;
}

.chat-start-welcome p {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.chat-form-group {
    margin-bottom: 12px;
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.chat-input:focus {
    outline: none;
    border-color: #f5a623;
}

.chat-start-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f5a623, #e8941a);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-start-btn:hover {
    background: linear-gradient(135deg, #e8941a, #d4850f);
    transform: translateY(-1px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    max-height: 340px;
    min-height: 280px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    animation: msgFadeIn 0.3s ease;
}

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

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

.chat-message.bot,
.chat-message.admin {
    align-items: flex-start;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.visitor .chat-bubble {
    background: linear-gradient(135deg, #f5a623, #e8941a);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .chat-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.chat-message.admin .chat-bubble {
    background: #e8f4fd;
    color: #1a1a2e;
    border: 1px solid #bee5eb;
    border-bottom-left-radius: 4px;
}

.chat-sender-name {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
    padding: 0 4px;
}

.chat-message-time {
    font-size: 10px;
    color: #aaa;
    margin-top: 3px;
    padding: 0 4px;
}

.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 70px;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fff;
}

.chat-send-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-message-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-message-input:focus {
    outline: none;
    border-color: #f5a623;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5a623, #e8941a);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #e8941a, #d4850f);
    transform: scale(1.05);
}

.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px 4px;
    background: #f8f9fa;
}

.chat-quick-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.chat-quick-btn:hover {
    background: #f5a623;
    color: #fff;
    border-color: #f5a623;
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-box {
        width: calc(100vw - 32px);
        max-height: 70vh;
        right: -8px;
        bottom: 68px;
    }

    .chat-toggle {
        width: 52px;
        height: 52px;
    }

    .chat-toggle-icon {
        font-size: 22px;
    }

    .chat-greeting-bubble {
        width: 240px;
        right: 0;
    }
}
