/* ═══════ Chat Widget ═══════ */

/* Toggle button */
.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg, #08020f);
    border: 2px solid var(--neon, #ff00ea);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px var(--neon, #ff00ea), inset 0 0 10px rgba(255, 0, 234, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: var(--neon, #ff00ea);
}
.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 0 18px var(--neon, #ff00ea), 0 0 36px var(--neon, #ff00ea), inset 0 0 14px rgba(255, 0, 234, 0.4);
    color: #fff;
}
.chat-toggle svg {
    width: 26px;
    height: 26px;
    transition: transform 0.2s ease;
}
.chat-toggle.open svg {
    transform: rotate(90deg);
}

/* Drawer panel */
.chat-drawer {
    width: 380px;
    max-height: 520px;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--neon, #ff00ea);
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 0 24px var(--neon, #ff00ea), 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: chatSlideUp 0.25s ease-out;
}
.chat-drawer.hidden {
    display: none;
}
@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(107, 114, 128, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.chat-header-icon {
    font-size: 22px;
    line-height: 1;
    color: var(--neon-secondary, #00f0ff);
    text-shadow: 0 0 6px var(--neon-secondary, #00f0ff);
}
.chat-header-title {
    font-family: 'VT323', monospace;
    font-size: 20px;
    letter-spacing: 0.08em;
    color: white;
    text-shadow: 0 0 6px var(--neon, #ff00ea);
}
.chat-header-label {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--neon-secondary, #00f0ff);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Messages container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--accent-800, #333); border-radius: 3px; }

/* Message bubbles */
.chat-msg {
    display: flex;
    animation: fadeInUp 0.3s ease-out both;
}
.chat-msg.user {
    justify-content: flex-end;
}
.chat-msg.assistant {
    justify-content: flex-start;
}
.chat-bubble {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.chat-msg.user .chat-bubble {
    background: rgba(255, 0, 234, 0.12);
    border: 1px solid var(--neon, #ff00ea);
    box-shadow: 0 0 6px rgba(255, 0, 234, 0.35);
    color: white;
    border-bottom-right-radius: 0;
}
.chat-msg.assistant .chat-bubble {
    background: rgba(8, 2, 15, 0.85);
    border: 1px solid var(--neon-secondary, #00f0ff);
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.25);
    color: #e5e7eb;
    border-bottom-left-radius: 0;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.typing-dots span {
    width: 7px;
    height: 7px;
    background: #6b7280;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Input area */
.chat-input-area {
    padding: 10px 14px 14px;
    border-top: 1px solid rgba(107, 114, 128, 0.2);
    flex-shrink: 0;
}
.chat-form {
    display: flex;
    gap: 8px;
}
.chat-input {
    flex: 1;
    background: rgba(8, 2, 15, 0.85);
    border: 1px solid rgba(255, 0, 234, 0.4);
    border-radius: 0;
    padding: 9px 12px;
    color: white;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chat-input:focus {
    border-color: var(--neon, #ff00ea);
    box-shadow: 0 0 8px var(--neon, #ff00ea);
}
.chat-input::placeholder {
    color: #6b7280;
}
.chat-send {
    background: transparent;
    border: 1px solid var(--neon, #ff00ea);
    border-radius: 0;
    padding: 0 14px;
    cursor: pointer;
    color: var(--neon, #ff00ea);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 6px var(--neon, #ff00ea), inset 0 0 6px rgba(255, 0, 234, 0.18);
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}
.chat-send:hover {
    background: var(--neon, #ff00ea);
    color: #fff;
}
.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.chat-send svg {
    width: 18px;
    height: 18px;
}

/* ═══════ Inline Board Cards ═══════ */

.chat-boards-container {
    margin-top: 8px;
}
.chat-cat-label {
    font-family: 'VT323', monospace;
    font-size: 14px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--neon-secondary, #00f0ff);
    text-shadow: 0 0 4px var(--neon-secondary, #00f0ff);
    margin: 8px 0 4px;
}
.chat-board-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(107, 114, 128, 0.15);
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background 0.15s ease;
}
.chat-board-card:hover {
    background: rgba(31, 41, 55, 0.85);
}

/* Mini score ring */
.mini-score-ring {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: white;
}
.mini-score-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        var(--ring-color, #0c87f0) calc(var(--pct, 0) * 3.6deg),
        rgba(55, 65, 81, 0.5) calc(var(--pct, 0) * 3.6deg)
    );
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

.chat-board-info {
    flex: 1;
    min-width: 0;
}
.chat-board-name {
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-board-name:hover {
    color: var(--accent-400, #36a5ff);
}
.chat-board-stats {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 1px;
}
.chat-board-price {
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    text-align: right;
}
.chat-board-price.on-sale { color: #34d399; }
.chat-board-price.full-price { color: #9ca3af; }
.chat-board-oos {
    font-size: 9px;
    color: #f59e0b;
    font-weight: 500;
}

/* ═══════ Mobile responsive ═══════ */
@media (max-width: 640px) {
    .chat-drawer {
        width: calc(100vw - 32px);
        max-height: 70vh;
    }
}
