/* AI Product Chat — styles */
.apc-chat {
    --apc-accent: #2563eb;
    --apc-height: 520px;
    display: flex;
    flex-direction: column;
    height: var(--apc-height);
    max-height: 80vh;
    border: 1px solid #e3e8ef;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.5;
    color: #1f2733;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}
.apc-chat * { box-sizing: border-box; }

.apc-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: #f7f9fc;
}

.apc-msg { display: flex; margin: 0 0 12px; }
.apc-msg.apc-user { justify-content: flex-end; }
.apc-bubble {
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 14px;
    word-wrap: break-word;
}
.apc-assistant .apc-bubble {
    background: #fff;
    border: 1px solid #e6ebf2;
    border-bottom-left-radius: 4px;
}
.apc-user .apc-bubble {
    background: var(--apc-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.apc-bubble p { margin: 0 0 8px; }
.apc-bubble p:last-child { margin-bottom: 0; }
.apc-bubble ul { margin: 6px 0; padding-left: 18px; }
.apc-bubble a { color: var(--apc-accent); font-weight: 600; }
.apc-user .apc-bubble a { color: #fff; text-decoration: underline; }
.apc-bubble code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* product cards */
.apc-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin: 0 0 14px;
}
.apc-card {
    display: block;
    border: 1px solid #e6ebf2;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s, transform .15s;
}
.apc-card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.12); transform: translateY(-2px); }
.apc-card-img {
    width: 100%;
    height: 110px;
    background-size: cover;
    background-position: center;
    background-color: #eef2f7;
}
.apc-card-noimg { background: linear-gradient(135deg, #eef2f7, #e2e8f0); }
.apc-card-body { padding: 8px 10px; }
.apc-card-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.apc-card-meta { font-size: 12px; color: #5a6b80; margin-top: 3px; }

/* input */
.apc-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e6ebf2;
    background: #fff;
}
.apc-input textarea {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid #d4dbe4;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    line-height: 1.4;
    max-height: 120px;
    outline: none;
}
.apc-input textarea:focus { border-color: var(--apc-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.apc-input button {
    flex: 0 0 auto;
    background: var(--apc-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
}
.apc-input button:disabled { opacity: .5; cursor: default; }

/* typing indicator */
.apc-typing .apc-bubble { display: inline-flex; gap: 4px; }
.apc-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #b3bccb; display: inline-block;
    animation: apc-bounce 1.2s infinite ease-in-out;
}
.apc-dot:nth-child(2) { animation-delay: .15s; }
.apc-dot:nth-child(3) { animation-delay: .3s; }
@keyframes apc-bounce { 0%,80%,100% { transform: translateY(0); opacity:.5 } 40% { transform: translateY(-4px); opacity:1 } }

/* floating widget */
.apc-launcher-wrap { --apc-accent: #2563eb; }
.apc-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 99998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--apc-accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(16,24,40,.22);
}
.apc-launcher-icon { font-size: 18px; line-height: 1; }
.apc-float-panel {
    position: fixed;
    right: 22px;
    bottom: 82px;
    z-index: 99999;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(16,24,40,.28);
    border: 1px solid #e3e8ef;
}
.apc-float-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--apc-accent);
    color: #fff;
    font-weight: 700;
}
.apc-float-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.apc-float-panel .apc-chat {
    border: none;
    border-radius: 0;
    box-shadow: none;
    --apc-height: 460px;
}
@media (max-width: 480px) {
    .apc-launcher-text { display: none; }
    .apc-float-panel { right: 12px; bottom: 76px; }
}
