.amea-widget * { box-sizing: border-box; }

.amea-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    transition: transform .15s ease;
}
.amea-toggle:hover { transform: scale(1.06); }

.amea-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
}

.amea-header {
    background: #2563eb;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.amea-title { font-weight: 600; font-size: 15px; }
.amea-close {
    background: none; border: none; color: #fff;
    font-size: 24px; line-height: 1; cursor: pointer;
}

.amea-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.amea-msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.amea-msg.user {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.amea-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.amea-msg.status { align-self: center; background: transparent; color: #6b7280; font-size: 12px; }

.amea-input-area {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
.amea-text {
    flex: 1;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 14px;
    max-height: 90px;
    outline: none;
    font-family: inherit;
}
.amea-text:focus { border-color: #2563eb; }

.amea-mic, .amea-send {
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.amea-mic { background: #e5e7eb; color: #374151; }
.amea-mic.recording { background: #ef4444; color: #fff; animation: amea-pulse 1s infinite; }
.amea-send { background: #2563eb; color: #fff; font-size: 13px; width: auto; padding: 0 16px; border-radius: 20px; }
.amea-send:disabled { opacity: .5; cursor: not-allowed; }

@keyframes amea-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
    70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* RTL support */
html[dir="rtl"] .amea-toggle,
html[dir="rtl"] .amea-panel { right: auto; left: 24px; }
html[dir="rtl"] .amea-msg.user { align-self: flex-start; border-bottom-left-radius: 4px; border-bottom-right-radius: 14px; }
html[dir="rtl"] .amea-msg.bot { align-self: flex-end; }
