/* ============================================================
   Accessibility - Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Vendor Chat
   ============================================================ */

.vendor-chat-root {
    display: flex;
    height: calc(100vh - 120px);
    min-height: 400px;
    background: var(--color-bg);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

/* Sidebar - family list */
.vendor-chat-sidebar {
    width: 280px;
    min-width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
}

.vendor-chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    gap: 10px;
}

.vendor-chat-sidebar-header h2 {
    font-size: var(--font-size-body);
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.vendor-family-list {
    flex: 1;
    overflow-y: auto;
}

.vendor-family-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.vendor-family-item:hover { background: var(--color-hover); }
.vendor-family-item.active { background: var(--color-primary-light, rgba(100,200,180,0.12)); }

.vendor-family-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
}

.vendor-family-name {
    font-weight: 600;
    font-size: var(--font-size-body);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.vendor-family-time {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    white-space: nowrap;
}

.vendor-family-preview {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vendor-window-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 9px;
    font-size: var(--font-size-small);
    font-weight: 700;
}

/* Thread panel */
.vendor-chat-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-bg);
}

.vendor-chat-thread-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vendor-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vendor-chat-no-messages {
    text-align: center;
    padding: 32px;
    font-size: var(--font-size-body);
}

/* Message bubbles */
.vendor-msg { display: flex; flex-direction: column; max-width: 72%; }
.vendor-msg-out { align-self: flex-end; align-items: flex-end; }
.vendor-msg-in  { align-self: flex-start; align-items: flex-start; }

.vendor-msg-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: var(--font-size-body);
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.vendor-msg-out .vendor-msg-bubble {
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.vendor-msg-in .vendor-msg-bubble {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.vendor-msg-meta {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    margin-top: 3px;
    padding: 0 2px;
}

.vendor-msg-sender { font-weight: 600; }

/* Compose bar */
.vendor-chat-compose {
    border-top: 1px solid var(--color-border);
    padding: 10px 14px;
    background: var(--color-surface);
}

.vendor-chat-compose-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.vendor-chat-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: var(--font-size-body);
    resize: none;
    min-height: 38px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
}

.vendor-chat-input:focus { outline: none; border-color: var(--color-primary); }

/* Window info banner */
.vendor-window-info {
    font-size: var(--font-size-small);
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.vendor-window-open   { background: rgba(46,158,94,0.12); color: var(--color-success); }
.vendor-window-closed { background: rgba(255,165,0,0.12); color: #b36b00; }

/* Mobile */
@media (max-width: 600px) {
    .vendor-chat-root { flex-direction: column; height: auto; min-height: 0; }
    .vendor-chat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); max-height: 220px; }
    .vendor-chat-thread { min-height: 300px; }
}

