/* Trợ lý đặt hàng - bóng chat nổi (tông xanh lá WAO FOODs) */

#asstBubble {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary-color, #005e20);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#asstBubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

#asstPanel {
    position: fixed;
    right: 20px;
    bottom: 88px;
    z-index: 1050;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: min(70vh, 560px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#asstPanel[hidden] {
    display: none;
}

#asstHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background-color: var(--primary-color, #005e20);
    color: #fff;
    font-weight: 600;
}

#asstHeader #asstClose {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

#asstMessages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f7f9f7;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asst-msg {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.asst-msg-user {
    align-self: flex-end;
    background: #e3f1e6;
    color: #1d3324;
    border-bottom-right-radius: 4px;
}

.asst-msg-assistant {
    align-self: flex-start;
    background: #ececec;
    color: #333;
    border-bottom-left-radius: 4px;
}

.asst-typing {
    font-style: italic;
    opacity: 0.7;
}

.asst-info {
    align-self: center;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.asst-order-link {
    color: var(--primary-color, #005e20);
    font-weight: 600;
    text-decoration: underline;
}

/* Markdown trong bong bóng trợ lý */
.asst-md-ul {
    margin: 4px 0;
    padding-left: 18px;
}

.asst-msg strong {
    font-weight: 700;
    color: #1d3324;
}

.asst-msg a {
    color: var(--primary-color, #005e20);
    text-decoration: underline;
    word-break: break-all;
}

/* Danh sách thẻ sản phẩm (catalog) */
.asst-product-list {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asst-product-card {
    border: 1px solid #d9e2da;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    max-width: 280px;
    margin: 4px 0;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.asst-product-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
}

.asst-product-name {
    font-weight: 600;
    color: #1d3324;
    font-size: 14px;
}

.asst-product-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
}

.asst-product-price-sale {
    font-weight: 700;
    color: var(--primary-color, #005e20);
    font-size: 14px;
}

.asst-product-price-orig {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
}

.asst-product-unit {
    color: #777;
    font-size: 12px;
}

.asst-badge-promo {
    align-self: flex-start;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    background: #e3f1e6;
    color: var(--primary-color, #005e20);
    border: 1px solid #b6dcc0;
}

.asst-product-order-btn {
    margin-top: 4px;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color, #005e20);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.asst-product-order-btn:hover {
    background-color: var(--primary-dark, #004518);
}

/* Chip sản phẩm bấm-được */
.asst-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    max-width: 90%;
}

.asst-chip {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid var(--primary-color, #005e20);
    border-radius: 16px;
    background: #fff;
    color: var(--primary-color, #005e20);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.asst-chip:hover {
    background: var(--primary-color, #005e20);
    color: #fff;
}

/* Thẻ tóm tắt đơn */
.asst-card {
    align-self: stretch;
    border: 1px solid #d9e2da;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.asst-card-head {
    font-weight: 600;
    color: #1d3324;
    font-size: 14px;
}

.asst-card-line {
    font-size: 13px;
    color: #555;
}

.asst-card-item {
    font-size: 13px;
    color: #333;
    padding-left: 4px;
}

.asst-card-item-missing {
    color: #c0392b;
}

/* Khối thông tin người nhận nổi bật trong thẻ xác nhận */
.asst-card-info {
    border: 1px solid #cfe3d4;
    background: #f1f8f2;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.asst-card-addr {
    font-weight: 600;
    color: #1d3324;
}

.asst-card-pay {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Badge phương thức thanh toán */
.asst-badge-cod,
.asst-badge-ck {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.asst-badge-cod {
    background: #fdf0d5;
    color: #8a5a00;
    border: 1px solid #f0d28a;
}

.asst-badge-ck {
    background: #e3f1e6;
    color: #1d6b32;
    border: 1px solid #b6dcc0;
}

/* Badge cảnh báo "mặc định — vui lòng xác nhận" (hổ phách) */
.asst-badge-warn {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    background: #fdf0d5;
    color: #8a5a00;
    border: 1px solid #f0d28a;
    white-space: nowrap;
}

/* Dòng tùy chọn xử lý đã chọn (nổi bật) */
.asst-card-opt {
    font-size: 13px;
    color: #333;
    padding-left: 8px;
}

.asst-opt-all {
    color: #8a5a00;
    font-weight: 700;
}

.asst-card-piece {
    color: #1d6b32;
    font-weight: 600;
    font-size: 13px;
}

.asst-card-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    padding-left: 8px;
}

.asst-card-remind {
    margin-top: 6px;
    font-size: 12px;
    color: #8a5a00;
    background: #fdf6e6;
    border: 1px dashed #e6c97a;
    border-radius: 6px;
    padding: 5px 8px;
}

/* Khu vực nhập thêm cho 1 dòng SP (số quả / tùy chọn / ghi chú) */
.asst-item-extras {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0 4px 8px;
}

.asst-item-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.asst-item-field-label {
    font-size: 12px;
    color: #555;
    min-width: 48px;
}

.asst-item-piece,
.asst-item-note {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 13px;
    font-family: inherit;
}

.asst-item-piece {
    width: 80px;
}

.asst-item-note {
    flex: 1;
}

.asst-item-piece:focus,
.asst-item-note:focus {
    outline: none;
    border-color: var(--primary-color, #005e20);
}

.asst-item-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Hàng chip tùy chọn + ô số lượng áp dụng */
.asst-opt-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.asst-opt-qty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.asst-opt-qty[hidden] {
    display: none;
}

.asst-opt-qty-input {
    width: 64px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 13px;
    font-family: inherit;
}

.asst-opt-qty-input:focus {
    outline: none;
    border-color: var(--primary-color, #005e20);
}

.asst-opt-qty-unit {
    font-size: 12px;
    color: #555;
}

/* Chip option đang bật */
.asst-opt-chip-on {
    background: var(--primary-color, #005e20);
    color: #fff;
}

.asst-confirm-btn {
    margin-top: 8px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color, #005e20);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.asst-confirm-btn:hover:not(:disabled) {
    background-color: var(--primary-dark, #004518);
}

.asst-confirm-btn:disabled {
    background-color: #9bb5a2;
    cursor: not-allowed;
}

.asst-card-actions {
    align-self: stretch;
    display: flex;
    justify-content: flex-end;
}

.asst-confirm-all {
    margin-top: 0;
}

#asstInputRow {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e3e3e3;
    background: #fff;
}

#asstInput {
    flex: 1;
    resize: none;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
}

#asstInput:focus {
    outline: none;
    border-color: var(--primary-color, #005e20);
}

#asstSend {
    align-self: flex-end;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color, #005e20);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

#asstSend:hover {
    background-color: var(--primary-dark, #004518);
}

/* Form nhập tay (phao khi chat mãi không đủ thông tin) */
.asst-info-form {
    align-self: stretch;
    border: 1px solid #cfe3d4;
    background: #f1f8f2;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asst-info-form-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d3324;
}

.asst-info-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.asst-info-label {
    font-size: 12px;
    color: #555;
}

.asst-info-input {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 14px;
    font-family: inherit;
}

.asst-info-input:focus {
    outline: none;
    border-color: var(--primary-color, #005e20);
}

.asst-info-err {
    font-size: 12px;
    color: #c0392b;
}

.asst-info-form-done {
    opacity: 0.65;
}

@media (max-width: 480px) {
    #asstPanel {
        right: 10px;
        left: 10px;
        bottom: 80px;
        width: auto;
        max-width: none;
        height: min(75vh, 560px);
    }

    .asst-product-card {
        max-width: none;
    }
}
