/* ============================================
   Moto Agent - Chat Widget
   ============================================ */

/* Floating Action Button */
.moto-agent-fab {
    position: fixed;
    bottom: 24px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--agent-color, #E53935);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.moto-agent-right .moto-agent-fab { right: 24px; }
.moto-agent-left .moto-agent-fab  { left: 24px; }

.moto-agent-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.moto-agent-fab:active {
    transform: scale(0.96);
}

/* Chat Panel */
.moto-agent-panel {
    position: fixed;
    bottom: 100px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 570px;
    max-height: calc(100vh - 130px);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: motoAgentSlideUp 0.3s ease-out;
}

.moto-agent-right .moto-agent-panel { right: 24px; }
.moto-agent-left .moto-agent-panel  { left: 24px; }

@keyframes motoAgentSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.moto-agent-header {
    background: var(--agent-color, #E53935);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.moto-agent-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.moto-agent-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.moto-agent-header-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.moto-agent-header-status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
}

.moto-agent-header-status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #69f0ae;
    border-radius: 50%;
    display: inline-block;
}

.moto-agent-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.moto-agent-close-btn:hover {
    opacity: 1;
}

/* Messages Area */
.moto-agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f5f5f5;
    scroll-behavior: smooth;
}

.moto-agent-messages::-webkit-scrollbar {
    width: 5px;
}

.moto-agent-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Message Bubbles */
.moto-agent-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.moto-agent-msg-agent {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.moto-agent-msg-agent strong {
    font-weight: 700;
    color: #222;
}

.moto-agent-msg-user {
    background: var(--agent-color, #E53935);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.moto-agent-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.moto-agent-typing-dot {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: motoAgentBounce 1.4s infinite both;
}

.moto-agent-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.moto-agent-typing-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes motoAgentBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Quick Replies */
.moto-agent-quick-replies {
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #f5f5f5;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.moto-agent-quick-btn {
    padding: 7px 14px;
    border: 1.5px solid var(--agent-color, #E53935);
    border-radius: 20px;
    background: #fff;
    color: var(--agent-color, #E53935);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.moto-agent-quick-btn:hover {
    background: var(--agent-color, #E53935);
    color: #fff;
}

/* Input Area */
.moto-agent-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.moto-agent-input {
    flex: 1;
    border: 1.5px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #fafafa;
}

.moto-agent-input:focus {
    border-color: var(--agent-color, #E53935);
    background: #fff;
}

.moto-agent-input:disabled {
    opacity: 0.6;
}

.moto-agent-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--agent-color, #E53935);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.moto-agent-send-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.moto-agent-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Timestamp */
.moto-agent-timestamp {
    text-align: center;
    font-size: 11px;
    color: #999;
    padding: 4px 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .moto-agent-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        bottom: 8px;
        right: 8px !important;
        left: 8px !important;
        border-radius: 12px;
    }

    .moto-agent-fab {
        bottom: 16px;
        right: 16px !important;
        left: auto !important;
        width: 56px;
        height: 56px;
    }

    .moto-agent-quick-replies {
        padding: 8px;
    }

    .moto-agent-quick-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}
