/* Smartsupp-inspired Live Chat Widget */
#arthur-chat * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#arthur-chat {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.4;
}

/* Floating chat button */
#arthur-chat .chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
}

#arthur-chat .chat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(16, 185, 129, 0.5);
}

#arthur-chat .chat-btn .chat-btn-close {
    display: none;
}

#arthur-chat .chat-btn.active .chat-btn-icon {
    display: none;
}

#arthur-chat .chat-btn.active .chat-btn-close {
    display: block;
}

/* Notification badge */
#arthur-chat .chat-btn .chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

#arthur-chat .chat-btn .chat-badge.show {
    display: flex;
}

/* Chat window */
#arthur-chat .chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 370px;
    height: 540px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 99998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideIn 0.3s ease;
}

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

#arthur-chat .chat-window.open {
    display: flex;
}

/* Chat header */
#arthur-chat .chat-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 20px 20px 18px;
    position: relative;
    flex-shrink: 0;
}

#arthur-chat .chat-header .chat-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#arthur-chat .chat-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

#arthur-chat .chat-header .chat-minimize {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 18px;
    padding: 2px;
    transition: color 0.2s;
}

#arthur-chat .chat-header .chat-minimize:hover {
    color: #fff;
}

#arthur-chat .chat-header .chat-status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

/* Chat body */
#arthur-chat .chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome / initial state */
#arthur-chat .chat-body .chat-welcome {
    text-align: center;
    padding: 30px 10px 10px;
    color: #64748b;
}

#arthur-chat .chat-body .chat-welcome .chat-welcome-icon {
    font-size: 42px;
    margin-bottom: 12px;
    color: #10b981;
}

#arthur-chat .chat-body .chat-welcome h4 {
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 6px;
}

#arthur-chat .chat-body .chat-welcome p {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

/* Chat message bubbles */
#arthur-chat .chat-body .chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: msgIn 0.25s ease;
}

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

#arthur-chat .chat-body .chat-msg.visitor {
    align-self: flex-end;
    background: #10b981;
    color: #fff;
    border-bottom-right-radius: 4px;
}

#arthur-chat .chat-body .chat-msg.admin {
    align-self: flex-start;
    background: #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

#arthur-chat .chat-body .chat-msg .chat-msg-meta {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
}

#arthur-chat .chat-body .chat-msg.visitor .chat-msg-meta {
    text-align: right;
}

/* Bot typing indicator */
#arthur-chat .chat-body .chat-typing {
    background: #e2e8f0;
    padding: 14px 18px;
}

#arthur-chat .typing-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

#arthur-chat .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

/* Chat input area */
#arthur-chat .chat-footer {
    padding: 12px 16px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

#arthur-chat .chat-footer .chat-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#arthur-chat .chat-footer input,
#arthur-chat .chat-footer textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: none;
    outline: none;
}

#arthur-chat .chat-footer input:focus,
#arthur-chat .chat-footer textarea:focus {
    border-color: #10b981;
}

#arthur-chat .chat-footer .chat-send-row {
    display: flex;
    gap: 8px;
}

#arthur-chat .chat-footer .chat-send-row input {
    flex: 1;
}

#arthur-chat .chat-footer .chat-send-btn {
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
    font-family: inherit;
    font-weight: 600;
}

#arthur-chat .chat-footer .chat-send-btn:hover {
    background: #059669;
}

#arthur-chat .chat-footer .chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Chat textarea submit row */
#arthur-chat .chat-footer .chat-msg-row {
    display: flex;
    gap: 8px;
}

#arthur-chat .chat-footer .chat-msg-row textarea {
    flex: 1;
    min-height: 44px;
    max-height: 80px;
}

/* Responsive */
@media (max-width: 480px) {
    #arthur-chat .chat-window {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    #arthur-chat .chat-btn {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
        font-size: 22px;
    }
}
