/* ═══════════════════════════════════════════════════════════════════════
   DarkBot v2 — Slide-in Chat Panel
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Panel ───────────────────────────────────────────────────────────── */

.darkbot-panel {
    position: fixed; right: 20px; bottom: 20px;
    width: 400px; max-width: calc(100vw - 24px);
    height: 580px; max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06);
    z-index: 10001;
    display: flex; flex-direction: column;
    transform: translateY(20px) scale(.96);
    opacity: 0; visibility: hidden;
    transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .2s ease, visibility .2s ease;
}
.darkbot-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1; visibility: visible;
}

/* ─── Header ──────────────────────────────────────────────────────────── */

.darkbot-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.darkbot-panel-title { display: flex; align-items: center; gap: 8px; }
.darkbot-panel-name { font-size: 16px; font-weight: 700; color: #111; }
.darkbot-panel-badge {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: #888; background: #f0f0f0;
    padding: 3px 7px; border-radius: 4px;
}
.darkbot-panel-close {
    width: 32px; height: 32px; border: none; background: #f5f5f3;
    border-radius: 8px; cursor: pointer; display: flex;
    align-items: center; justify-content: center; color: #666;
    transition: background .15s;
}
.darkbot-panel-close:hover { background: #eee; color: #111; }

/* ─── Quick chips ─────────────────────────────────────────────────────── */

.darkbot-chips {
    display: flex; gap: 6px; padding: 12px 18px 8px;
    flex-wrap: wrap; flex-shrink: 0;
}
.darkbot-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 500; font-family: inherit;
    padding: 6px 12px; border-radius: 20px;
    border: 1px solid #e5e5e3; background: #fff; color: #444;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.darkbot-chip:hover { background: #f5f5f3; border-color: #ccc; color: #111; }
.darkbot-chip svg { flex-shrink: 0; }

/* ─── Messages ────────────────────────────────────────────────────────── */

.darkbot-body {
    flex: 1; overflow-y: auto; padding: 14px 18px;
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth;
}

.db-msg { max-width: 88%; font-size: 14px; line-height: 1.6; animation: db-fadein .2s ease; }
@keyframes db-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.db-msg-user {
    align-self: flex-end; background: #111; color: #fff;
    padding: 10px 14px; border-radius: 16px 16px 4px 16px;
}
.db-msg-bot {
    align-self: flex-start; background: #f7f7f5; color: #222;
    padding: 10px 14px; border-radius: 16px 16px 16px 4px;
}
.db-msg-bot p { margin: 0 0 6px; }
.db-msg-bot p:last-child { margin-bottom: 0; }
.db-msg-bot strong { font-weight: 700; color: #111; }
.db-msg-bot em { font-style: italic; }
.db-msg-bot ul { margin: 4px 0; padding-left: 16px; }
.db-msg-bot li { margin: 2px 0; }

/* Typing cursor */
.db-cursor {
    display: inline-block; width: 2px; height: 14px;
    background: #111; margin-left: 1px; vertical-align: text-bottom;
    animation: db-blink .6s step-end infinite;
}
@keyframes db-blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ─── Product cards ───────────────────────────────────────────────────── */

.darkbot-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.darkbot-card {
    display: flex; gap: 10px; align-items: center;
    background: #fff; border: 1px solid #eee; border-radius: 10px;
    padding: 10px; transition: border-color .15s;
}
.darkbot-card:hover { border-color: #ccc; }
.darkbot-card a {
    display: flex; gap: 10px; align-items: center;
    text-decoration: none; color: #111; flex: 1; min-width: 0;
}
.darkbot-thumb {
    width: 48px; height: 48px; border-radius: 8px;
    object-fit: cover; background: #f0f0ee; flex-shrink: 0;
}
.darkbot-card-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.darkbot-card-name {
    font-weight: 600; font-size: 13px; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.darkbot-card-price { font-size: 12px; color: #666; }
.darkbot-card-cart {
    padding: 6px 12px; background: #111; color: #fff;
    border: none; border-radius: 6px; font-size: 11px; font-weight: 600;
    cursor: pointer; white-space: nowrap; font-family: inherit;
    transition: background .15s;
}
.darkbot-card-cart:hover { background: #333; }

/* CTA link */
.darkbot-cta {
    display: inline-block; margin-top: 6px;
    padding: 8px 16px; background: #111; color: #fff;
    border-radius: 8px; font-size: 13px; font-weight: 600;
    text-decoration: none; transition: background .15s;
}
.darkbot-cta:hover { background: #333; color: #fff; }

/* ─── Footer ──────────────────────────────────────────────────────────── */

.darkbot-footer {
    flex-shrink: 0; padding: 10px 18px 14px;
    border-top: 1px solid #f0f0f0;
}
.darkbot-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: #aaa; min-height: 16px; margin-bottom: 6px;
}
.darkbot-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: #ccc; display: none;
}
.darkbot-status.active .darkbot-dot {
    display: inline-block; background: #111;
    animation: db-pulse 1s ease-in-out infinite;
}
@keyframes db-pulse { 0%,100%{opacity:.3} 50%{opacity:1} }

.darkbot-input-row { display: flex; gap: 8px; }
.darkbot-text-input {
    flex: 1; border: 1px solid #e5e5e3; border-radius: 10px;
    padding: 10px 14px; font-size: 14px; background: #fafaf8;
    color: #111; outline: none; font-family: inherit;
    transition: border-color .15s;
}
.darkbot-text-input:focus { border-color: #999; background: #fff; }
.darkbot-send-btn {
    width: 42px; height: 42px; background: #111; color: #fff;
    border: none; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s; flex-shrink: 0;
}
.darkbot-send-btn:hover { background: #333; }
.darkbot-send-btn:disabled { opacity: .4; cursor: not-allowed; }
.darkbot-disclaimer {
    font-size: 10px; color: #bbb; text-align: center; margin-top: 8px;
}

/* ─── FAB ─────────────────────────────────────────────────────────────── */

.darkbot-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 10002;
    width: 56px; height: 56px; border-radius: 50%;
    background: #111; color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    transition: transform .15s ease, box-shadow .15s ease;
}
.darkbot-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.3); }
.darkbot-fab.hidden { display: none; }

/* ─── Mobile ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .darkbot-panel {
        right: 0; bottom: 0; left: 0;
        width: 100%; max-width: 100%;
        height: 100vh; max-height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
    .darkbot-panel.open { transform: translateY(0); }
    .darkbot-chips { padding: 10px 14px 6px; }
    .darkbot-chip { font-size: 11px; padding: 5px 10px; }
    .darkbot-body { padding: 12px 14px; }
    .darkbot-footer { padding: 8px 14px 12px; }
}
