/* ============================================================
   Accessibility - Reduced Motion
   ============================================================ */
/* ============================================================
   My Family - Redesigned
   ============================================================ */

.constellation-root {
    position: relative;
}

.family-canvas {
    background: var(--color-bg);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}


.constellation-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    padding: 40px 0;
    gap: 36px;
}

.constellation-node.no-anim {
    animation: none;
    opacity: 1;
}

.constellation-row {
    display: flex;
    gap: 44px;
    justify-content: center;
    align-items: flex-start;
}

.constellation-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    opacity: 0;
    animation: nodeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.node-circle {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    overflow: hidden;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.18s ease;
    box-shadow: 0 4px 18px rgba(107, 76, 138, 0.12);
}

[data-theme="dark"] .node-circle {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}


.constellation-node:not(.constellation-node--self):active .node-circle {
    transform: scale(0.91);
}

@media (hover: hover) {
    .constellation-node:not(.constellation-node--self):hover .node-circle {
        transform: translateY(-3px) scale(1.04);
        box-shadow: 0 10px 28px rgba(107, 76, 138, 0.18);
    }
}

.node-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.node-circle-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--color-primary-light) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.node-name {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    max-width: 96px;
    line-height: 1.35;
    letter-spacing: 0.01em;
}


@keyframes nodeIn {
    from { opacity: 0; transform: scale(0.72); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes nodeHop {
    0%   { transform: translate(var(--hop-dx), var(--hop-dy)) scale(1); }
    45%  { transform: translate(calc(var(--hop-dx) * 0.5), calc(var(--hop-dy) * 0.5)) scale(1.18); }
    100% { transform: translate(0px, 0px) scale(1); }
}


@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; }
}

