/*
 * This file is part of NP ACP Commerce Server Plugin.
 *
 * Copyright (C) 2026 Nine Point Inc. All Rights Reserved.
 * http://www.9point.co.jp/
 *
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
 * http://www.ec-cube.co.jp/
 *
 * License terms: see docs/LICENSE_TERMS_ja.md
 */

.acp-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 1100;
    font-family: "Avenir Next", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

.acp-chat-toggle {
    border: 0;
    border-radius: 9999px;
    background: linear-gradient(135deg, #0f766e, #166534 60%, #22c55e);
    color: #fff;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(4, 47, 46, 0.34);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.acp-chat-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(4, 47, 46, 0.38);
}

.acp-chat-panel {
    width: 356px;
    max-width: calc(100vw - 24px);
    margin-top: 12px;
    border-radius: 18px;
    display: none;
    overflow: hidden;
    border: 1px solid rgba(15, 118, 110, 0.16);
    background: linear-gradient(180deg, #f8fffc 0%, #ffffff 48%, #f0fdf4 100%);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.2);
    animation: acpFadeIn 0.32s ease;
}

.acp-chat-panel.is-open {
    display: block;
}

.acp-chat-header {
    background: linear-gradient(120deg, #064e3b, #0f766e 56%, #22c55e);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 13px;
    font-size: 13px;
}

.acp-chat-mode {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    padding: 2px 8px;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.04em;
}

.acp-chat-quick {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #dbe8e5;
    background: linear-gradient(180deg, #effcf7, #f7fffb);
    overflow-x: auto;
}

.acp-chat-quick-btn {
    border: 1px solid #b8d8d1;
    border-radius: 9999px;
    background: #fff;
    color: #064e3b;
    font-size: 11px;
    padding: 4px 9px;
    white-space: nowrap;
    cursor: pointer;
}

.acp-chat-quick-btn.acp-chat-quick-checkout {
    background: linear-gradient(120deg, #065f46, #0f766e);
    color: #fff;
    border-color: transparent;
}

.acp-chat-log {
    max-height: 360px;
    overflow-y: auto;
    padding: 11px;
    background:
        radial-gradient(circle at 100% 0%, rgba(110, 231, 183, 0.19), transparent 42%),
        radial-gradient(circle at 0% 100%, rgba(16, 185, 129, 0.11), transparent 42%),
        #f8fafc;
}

.acp-chat-msg {
    margin-bottom: 8px;
    display: flex;
}

.acp-chat-msg-user {
    justify-content: flex-end;
}

.acp-chat-bubble {
    max-width: 90%;
    border-radius: 13px;
    padding: 9px 11px;
    line-height: 1.45;
    font-size: 13px;
    white-space: pre-wrap;
    animation: acpRise 0.26s ease;
}

.acp-chat-msg-user .acp-chat-bubble {
    background: linear-gradient(120deg, #0f766e, #16a34a);
    color: #fff;
    box-shadow: 0 10px 20px rgba(6, 78, 59, 0.2);
}

.acp-chat-msg-assistant .acp-chat-bubble {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(16, 120, 112, 0.14);
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.acp-chat-form-wrap {
    border-top: 1px solid #d8e7e2;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    background: #f9fdfb;
}

.acp-chat-input {
    resize: none;
    border: 1px solid #bdd6ce;
    border-radius: 10px;
    padding: 8px;
    font-size: 13px;
    background: #fff;
}

.acp-chat-send {
    border: 0;
    border-radius: 9px;
    padding: 8px 12px;
    background: linear-gradient(120deg, #0f766e, #15803d);
    color: #fff;
    cursor: pointer;
}

.acp-chat-footer {
    border-top: 1px solid #d8e7e2;
    font-size: 11px;
    color: #475569;
    padding: 8px 10px;
    background: #f7fffb;
}

.acp-chat-suggestions {
    margin: 8px 0 6px;
    display: grid;
    gap: 8px;
}

.acp-chat-item {
    background: #fff;
    border: 1px solid #d1e4de;
    border-radius: 11px;
    padding: 8px;
}

.acp-chat-item-image {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #ecfeff;
}

.acp-chat-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.acp-chat-item-price {
    font-size: 12px;
    color: #334155;
    margin: 4px 0 8px;
}

.acp-chat-item-class {
    margin-bottom: 8px;
}

.acp-chat-class-select {
    width: 100%;
    border: 1px solid #cde1db;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
    padding: 6px 8px;
}

.acp-chat-item-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cde1db;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.acp-chat-qty-btn {
    border: 0;
    background: #f0fdfa;
    color: #0f172a;
    width: 30px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
}

.acp-chat-qty-value {
    min-width: 30px;
    text-align: center;
    font-size: 12px;
    color: #0f172a;
}

.acp-chat-add {
    border: 0;
    border-radius: 8px;
    font-size: 12px;
    background: #0f766e;
    color: #fff;
    padding: 6px 10px;
    cursor: pointer;
}

.acp-chat-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.acp-chat-category-btn {
    border: 1px solid #b8d8d1;
    border-radius: 9999px;
    background: #fff;
    color: #064e3b;
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
}

.acp-chat-category-btn:hover {
    background: #f0fdfa;
}

.acp-chat-add.added {
    background: #166534;
}

.acp-chat-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.acp-chat-item-actions .acp-chat-add,
.acp-chat-detail-btn {
    display: inline-block;
    width: 48%;
    text-align: center;
}

.acp-chat-detail-btn {
    border: 1px solid #0f766e;
    border-radius: 8px;
    font-size: 12px;
    color: #0f766e;
    background: #fff;
    padding: 6px 10px;
    text-decoration: none;
}

.acp-chat-receipt {
    width: 100%;
}

.acp-chat-receipt-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.acp-chat-receipt-table-wrap {
    overflow-x: auto;
}

.acp-chat-receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.acp-chat-receipt-table th,
.acp-chat-receipt-table td {
    border-bottom: 1px solid #deebe7;
    padding: 4px 2px;
    text-align: left;
}

.acp-chat-receipt-table .num {
    text-align: right;
    white-space: nowrap;
}

.acp-chat-receipt-op {
    border: 1px solid #9ecfc2;
    border-radius: 6px;
    background: #fff;
    color: #065f46;
    font-size: 10px;
    padding: 2px 6px;
    margin-left: 4px;
    cursor: pointer;
}

.acp-chat-receipt-op:first-child {
    margin-left: 0;
}

.acp-chat-receipt-op.is-danger {
    border-color: #fca5a5;
    color: #b91c1c;
}

.acp-chat-receipt-totals {
    margin-top: 8px;
    font-size: 12px;
    color: #0f172a;
}

.acp-chat-receipt-totals > div {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
}

.acp-chat-receipt-totals > div.total {
    border-top: 1px solid #c9d9d4;
    padding-top: 6px;
    margin-top: 6px;
    font-weight: 700;
}

.acp-chat-receipt-note {
    margin-top: 8px;
    font-size: 11px;
    color: #475569;
}

.acp-chat-proceed {
    border: 0;
    margin-top: 10px;
    display: inline-block;
    width: 100%;
    text-align: center;
    border-radius: 8px;
    background: linear-gradient(120deg, #b91c1c, #dc2626);
    color: #fff;
    padding: 7px 10px;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.acp-chat-receipt-empty {
    color: #334155;
}

.acp-chat-receipt-confirm-btn {
    border: 1px solid #0f766e;
    border-radius: 8px;
    font-size: 11px;
    color: #0f766e;
    background: #fff;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.acp-chat-receipt-confirm-btn:hover {
    background: #0f766e;
    color: #fff;
}

.acp-chat-form-card {
    width: 100%;
    display: grid;
    gap: 8px;
    background: linear-gradient(180deg, #f0fdf4, #ffffff);
    border: 1px solid #c9e4da !important;
}

.acp-chat-form-title {
    font-size: 12px;
    font-weight: 700;
    color: #065f46;
}

.acp-chat-form-card label {
    display: grid;
    gap: 4px;
    font-size: 11px;
    color: #334155;
}

.acp-chat-form-card input {
    border: 1px solid #bfd9d0;
    border-radius: 8px;
    padding: 7px 8px;
    font-size: 12px;
    background: #fff;
}

.acp-chat-form-submit {
    border: 0;
    border-radius: 9px;
    background: linear-gradient(120deg, #0f766e, #15803d);
    color: #fff;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.acp-chat-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.acp-chat-form-error {
    min-height: 14px;
    color: #b91c1c;
    font-size: 11px;
}

.acp-chat-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.acp-chat-action-btn {
    border: 1px solid #9ecfc2;
    border-radius: 8px;
    background: #fff;
    color: #065f46;
    padding: 7px 9px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
}

.acp-chat-action-btn.is-primary {
    background: linear-gradient(120deg, #0f766e, #16a34a);
    color: #fff;
    border-color: transparent;
}

@keyframes acpFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes acpRise {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .acp-chat-widget {
        right: 10px;
        bottom: 10px;
    }

    .acp-chat-panel {
        width: min(364px, calc(100vw - 20px));
    }

    .acp-chat-item-actions {
        flex-wrap: wrap;
    }

    .acp-chat-item-actions .acp-chat-add,
    .acp-chat-detail-btn {
        width: 100%;
    }
}
