/* ActionWear Assistant — Chat Widget */

.awa-widget {
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1e2127;
}

.awa-widget--right { right: 20px; }
.awa-widget--left  { left: 20px; }

/* Trigger button */
.awa-widget__trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    background: #fff;
}

.awa-widget__trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.awa-widget__trigger:focus-visible {
    outline: 2px solid var(--awa-accent, #E3A558);
    outline-offset: 3px;
}

/* Panel */
.awa-widget__panel {
    width: 380px;
    max-height: 560px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.awa-widget.awa-widget--open .awa-widget__panel {
    display: flex;
}

.awa-widget.awa-widget--open .awa-widget__trigger {
    display: none;
}

/* Header */
.awa-widget__header {
    background: #252830;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--awa-accent, #E3A558);
    flex-shrink: 0;
}

.awa-widget__title {
    font-weight: 600;
    font-size: 14px;
}

.awa-widget__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.awa-widget__close:hover { opacity: 1; }
.awa-widget__close:focus-visible { outline: 2px solid #fff; border-radius: 3px; }

/* Messages area */
.awa-widget__messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
    max-height: 380px;
}

/* Message bubbles */
.awa-msg {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.awa-msg--user {
    align-self: flex-end;
    background: var(--awa-accent, #E3A558);
    color: #1e2127;
    border-bottom-right-radius: 4px;
}

.awa-msg--ai {
    align-self: flex-start;
    background: #f5f0e5;
    color: #1e2127;
    border-bottom-left-radius: 4px;
}

.awa-msg--ai strong { font-weight: 600; }

/* Typing indicator */
.awa-typing {
    align-self: flex-start;
    padding: 10px 16px;
    background: #f5f0e5;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.awa-typing__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: awa-bounce 1.2s infinite ease-in-out;
}

.awa-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.awa-typing__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes awa-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Product card */
.awa-product {
    align-self: flex-start;
    max-width: 88%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.awa-product__thumb {
    width: 100%;
    height: 80px;
    background: #f5f0e5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.awa-product__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.awa-product__body {
    padding: 10px 12px;
}

.awa-product__name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.awa-product__brand {
    font-size: 11px;
    color: #888;
}

.awa-product__price {
    font-size: 13px;
    font-weight: 600;
    color: var(--awa-accent, #956F22);
    margin: 4px 0;
}

.awa-product__attrs {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
}

.awa-product__cta {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    background: var(--awa-accent, #E3A558);
    color: #1e2127;
    border-radius: 5px;
    text-decoration: none;
    transition: opacity 0.15s;
}

.awa-product__cta:hover { opacity: 0.85; }
.awa-product__cta:focus-visible { outline: 2px solid var(--awa-accent, #E3A558); outline-offset: 2px; }

/* Image preview */
.awa-widget__image-preview {
    padding: 6px 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fafafa;
    flex-shrink: 0;
}

.awa-widget__preview-img {
    max-height: 64px;
    max-width: 120px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #d0d0d0;
}

.awa-widget__preview-remove {
    background: #e0e0e0;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    flex-shrink: 0;
    transition: background 0.15s;
}

.awa-widget__preview-remove:hover { background: #ccc; }

/* Image in chat bubble */
.awa-msg__image {
    max-width: 100%;
    max-height: 120px;
    border-radius: 6px;
    margin-bottom: 4px;
    display: block;
}

/* Input area */
.awa-widget__input-area {
    padding: 8px 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}

/* Upload button */
.awa-widget__upload {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.awa-widget__upload:hover { color: #333; background: #f0f0f0; }
.awa-widget__upload:focus-visible { outline: 2px solid var(--awa-accent, #E3A558); outline-offset: 2px; }

.awa-widget__input {
    flex: 1;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    max-height: 80px;
    line-height: 1.4;
    color: #1e2127;
    background: #fafafa;
}

.awa-widget__input:focus { border-color: var(--awa-accent, #E3A558); }
.awa-widget__input::placeholder { color: #999; }

.awa-widget__send {
    background: #252830;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.awa-widget__send:disabled {
    opacity: 0.4;
    cursor: default;
}

.awa-widget__send:not(:disabled):hover { opacity: 0.85; }
.awa-widget__send:focus-visible { outline: 2px solid var(--awa-accent, #E3A558); outline-offset: 2px; }

/* Mobile: full-screen overlay */
@media (max-width: 480px) {
    .awa-widget__panel {
        position: fixed;
        inset: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .awa-widget__messages {
        max-height: none;
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .awa-typing__dot { animation: none; }
    .awa-widget__trigger { transition: none; }
}
