/* niokyar AI companion — uses the site design tokens (main.css). */

.nk-cmp-panel {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(30, 58, 100, .12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 520px;
}
.nk-cmp-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--secondary) / .5);
}
.nk-cmp-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background));
}
.nk-cmp-id { display: flex; flex-direction: column; line-height: 1.25; }
.nk-cmp-id strong { font-size: 15px; color: hsl(var(--foreground)); }
.nk-cmp-status { font-size: 12px; color: hsl(var(--muted-foreground)); }
.nk-cmp-status.is-online::before {
    content: '';
    display: inline-block;
    width: 7px; height: 7px;
    margin-right: 5px;
    border-radius: 999px;
    background: #22c55e;
    vertical-align: middle;
}
.nk-cmp-speaker {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid hsl(var(--border));
    border-radius: 999px;
    background: hsl(var(--background));
    color: hsl(var(--muted-foreground));
    cursor: pointer;
}
.nk-cmp-speaker[aria-pressed="true"] { color: hsl(var(--primary)); border-color: hsl(var(--primary)); }
.nk-cmp-speaker .nk-ic-on { display: none; }
.nk-cmp-speaker[aria-pressed="true"] .nk-ic-on { display: block; }
.nk-cmp-speaker[aria-pressed="true"] .nk-ic-off { display: none; }

.nk-cmp-mood { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; }
.nk-mood-chip {
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.nk-cmp-body {
    flex: 1;
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
}
.nk-msg { display: flex; }
.nk-msg.user { justify-content: flex-end; }
.nk-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.nk-msg.ai .nk-bubble {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
    border-bottom-left-radius: 4px;
}
.nk-msg.user .nk-bubble {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-bottom-right-radius: 4px;
}
.nk-typing {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    padding-left: 4px;
}
.nk-typing span {
    display: inline-block;
    width: 5px; height: 5px;
    margin-right: 3px;
    border-radius: 999px;
    background: currentColor;
    animation: nk-bounce 1.2s infinite ease-in-out;
}
.nk-typing span:nth-child(2) { animation-delay: .15s; }
.nk-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes nk-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.nk-cmp-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--background));
}
.nk-cmp-input {
    flex: 1;
    resize: none;
    max-height: 120px;
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
}
.nk-cmp-input:focus { outline: 2px solid hsl(var(--primary) / .35); border-color: hsl(var(--primary)); }
.nk-cmp-mic, .nk-cmp-send {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    cursor: pointer;
}
.nk-cmp-send { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: transparent; }
.nk-cmp-mic.is-listening { background: #ef4444; color: #fff; border-color: transparent; animation: nk-pulse 1s infinite; }
@keyframes nk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.nk-cmp-note { margin: 0; padding: 0 16px 12px; font-size: 11px; color: hsl(var(--muted-foreground)); text-align: center; }

.nk-cmp-role {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border: 1px solid hsl(var(--border));
    border-radius: 999px;
    background: hsl(var(--card));
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    color: hsl(var(--foreground));
}
.nk-cmp-role img { width: 30px; height: 30px; border-radius: 999px; object-fit: cover; }
.nk-cmp-role.is-active { border-color: hsl(var(--primary)); box-shadow: 0 0 0 1px hsl(var(--primary)); }

/* Pet home */
.nk-pet-grid { display: grid; gap: 20px; }
@media (min-width: 1024px) { .nk-pet-grid { grid-template-columns: 320px 1fr; } }
.nk-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 16px;
    padding: 20px;
}
.nk-pet-avatar { width: 120px; height: 120px; border-radius: 999px; object-fit: cover; border: 1px solid hsl(var(--border)); }
.nk-stat { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px solid hsl(var(--border)); }
.nk-stat:last-child { border-bottom: none; }
.nk-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); margin: 2px 4px 2px 0; }
.nk-progress { height: 8px; border-radius: 999px; background: hsl(var(--secondary)); overflow: hidden; }
.nk-progress > span { display: block; height: 100%; background: hsl(var(--primary)); }

@media (max-width: 640px) {
    .nk-cmp-body { max-height: 360px; }
    .nk-bubble { max-width: 90%; }
}

/* Life scene stage (advanced phase) */
.nk-scene-stage {
    position: relative;
    min-height: 150px;
    border-radius: 14px;
    border: 1px solid hsl(var(--border));
    background: linear-gradient(135deg, hsl(var(--secondary)), hsl(var(--accent)));
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    overflow: hidden;
}
.nk-scene-pet {
    width: 80px;
    height: 80px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid hsl(var(--background));
    box-shadow: 0 6px 18px rgba(30, 58, 100, .18);
}
.nk-scene-meta { position: relative; z-index: 1; }

/* Scene motion — activity animations (CSS tier) */
.nk-scene-pet { transform-origin: 50% 90%; }
.nk-anim-idle  { animation: nk-breathe 3s ease-in-out infinite; }
.nk-anim-run   { animation: nk-run .5s ease-in-out infinite; }
.nk-anim-read  { animation: nk-sway 3.2s ease-in-out infinite; }
.nk-anim-sleep { animation: nk-breathe 4.2s ease-in-out infinite; opacity: .92; }
.nk-anim-play  { animation: nk-hop .7s ease-in-out infinite; }
.nk-anim-bath  { animation: nk-float 3s ease-in-out infinite; }
.nk-anim-calm  { animation: nk-breathe 3.6s ease-in-out infinite; }
@keyframes nk-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
@keyframes nk-run { 0%,100%{transform:translateY(0) rotate(-4deg)} 50%{transform:translateY(-8px) rotate(4deg)} }
@keyframes nk-sway { 0%,100%{transform:rotate(-3deg)} 50%{transform:rotate(3deg)} }
@keyframes nk-hop { 0%,100%{transform:translateY(0)} 40%{transform:translateY(-12px)} }
@keyframes nk-float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
/* idle micro-actions (template random) */
.nk-idle-blink{animation:nk-breathe .5s ease-in-out 1}
.nk-idle-turn{animation:nk-sway .9s ease-in-out 1}
.nk-idle-hop{animation:nk-hop .6s ease-in-out 1}
.nk-idle-yawn{animation:nk-breathe 1.2s ease-in-out 1}
.nk-idle-wave{animation:nk-sway .7s ease-in-out 2}
.nk-idle-stretch{animation:nk-breathe 1.4s ease-in-out 1}

/* Motion v2 — bottom-anchored breathing (body rises, not whole-image zoom) + overlays */
.nk-scene-pet { transform-origin: 50% 100%; }
.nk-anim-idle  { animation: nk-breathe 3.2s ease-in-out infinite; }
.nk-anim-sleep { animation: nk-breathe 4.4s ease-in-out infinite; opacity: .95; }
@keyframes nk-breathe { 0%,100% { transform: scaleX(1) scaleY(1); } 50% { transform: scaleX(1.015) scaleY(1.035); } }
.nk-scene-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.nk-scene-fx::after { position: absolute; right: 12%; top: 12%; font-size: 18px; opacity: 0; animation: nk-fx 3s ease-in-out infinite; }
.nk-scene-stage:has(.nk-anim-sleep) .nk-scene-fx::after { content: '💤'; opacity: 1; }
.nk-scene-stage:has(.nk-anim-bath)  .nk-scene-fx::after { content: '🫧'; opacity: 1; }
.nk-scene-stage:has(.nk-anim-play)  .nk-scene-fx::after { content: '✨'; opacity: 1; }
.nk-scene-stage:has(.nk-anim-calm)  .nk-scene-fx::after { content: '💗'; opacity: 1; }
.nk-scene-stage:has(.nk-anim-read)  .nk-scene-fx::after { content: '📖'; opacity: 1; }
@keyframes nk-fx { 0%,100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(-8px); opacity: 1; } }
