/*******************************
 Chat button – glassmorphism header style and adaptive scroll styling
*******************************/
#chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.025em;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}
#chat-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.2);
}
#chat-button:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Adaptive scrolled state */
#chat-button.scrolled {
    text-shadow: none;
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}
/* Light theme scrolled appearance */
:root:not([data-theme='dark']) #chat-button.scrolled {
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
}
/* Dark theme scrolled appearance */
:root[data-theme='dark'] #chat-button.scrolled {
    background: #0f172a;
    color: var(--text-color);
    border-color: #334155;
}

#chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 1000;
}

#chat-container.open {
    display: flex;
}

.chat-header {
    padding: 15px;
    background: #2d74ed;
    color: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    margin: 5px 0;
}

.user-message {
    background: #e9ecef;
    align-self: flex-end;
}

.bot-message {
    background: #2d74ed;
    color: white;
    align-self: flex-start;
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
}

#chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    outline: none;
}

#send-message {
    background: #2d74ed;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
}

#send-message:hover {
    background: #2461c9;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 15px;
    align-self: flex-start;
    margin: 5px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}


/* Enhancements: animated open, theme-aware, avatar, suggestions, responsive */
#chat-container { opacity: 0; transform: translateY(8px); transition: transform .25s ease, opacity .25s ease; border: 1px solid #e5e7eb; }
#chat-container.open { display: flex; opacity: 1; transform: translateY(0); }

/* Assistant header avatar + titles */
.assistant-meta { display: flex; align-items: center; gap: .75rem; }
.assistant-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(255,255,255,.25), rgba(255,255,255,0)); border: 2px solid rgba(255,255,255,0.55); box-shadow: 0 0 0 0 rgba(99,102,241, .4); animation: pulseGlow 2.5s infinite; }
.assistant-title { display: block; font-weight: 600; line-height: 1; }
.assistant-subtitle { display: block; font-size: .8rem; opacity: .85; line-height: 1.2; }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(99,102,241,.35);} 70% { box-shadow: 0 0 0 10px rgba(99,102,241,0);} 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0);} }

/* Suggestions (chips) */
.chat-suggestions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem .75rem; border-top: 1px solid #dee2e6; }
.chip { border: 1px solid #cbd5e1; background: #ffffff; color: #0f172a; border-radius: 999px; padding: .35rem .75rem; font-size: .85rem; cursor: pointer; transition: background .2s ease, transform .1s ease; }
.chip:hover { transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Theme: dark */
:root[data-theme='dark'] #chat-container { background: #0f172a; color: var(--text-color); border-color: #1f2937; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
:root[data-theme='dark'] .chat-header { background: #111827; }
:root[data-theme='dark'] .user-message { background: #1f2937; color: var(--text-color); }
:root[data-theme='dark'] .bot-message { background: var(--primary-color); color: #0b1220; }
:root[data-theme='dark'] #send-message { background: var(--accent-color); }
:root[data-theme='dark'] .chat-suggestions { border-top-color: #1f2937; }
:root[data-theme='dark'] .chip { background: #0f172a; color: var(--text-color); border-color: #334155; }

/* Responsive */
@media (max-width: 600px) {
  #chat-container { right: 12px; bottom: 80px; width: calc(100% - 24px); height: 65vh; }
  .chat-header { padding: 12px; }
  #chat-input { font-size: 16px; } /* prevent iOS zoom */
}


/* Premium polish: robot avatar, message animations, gradient header, orb button */
/* Robot avatar */
.assistant-robot { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.assistant-robot .robot { display: block; }
.assistant-robot .robot-bob { transform-origin: 50% 50%; animation: robotBob 5s ease-in-out infinite; }
.assistant-robot .eye { fill: #0b1220; transform-origin: center; animation: eyeBlink 5s infinite; }
.assistant-robot .eye.eye-right { animation-delay: 1.2s; }
.assistant-robot .antenna { fill: currentColor; opacity: .6; }
.assistant-robot .antenna-tip { fill: var(--accent-color); filter: drop-shadow(0 0 4px rgba(34,211,238,.9)); animation: antennaPulse 2.8s ease-in-out infinite; }
@keyframes robotBob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-5px);} }
@keyframes eyeBlink { 0%, 88%, 100% { transform: scaleY(1) scaleX(1);} 90% { transform: scaleY(0.1) scaleX(1.05);} 92% { transform: scaleY(1) scaleX(1);} }
@keyframes antennaPulse { 0%,100% { transform: translateY(0) scale(1);} 50% { transform: translateY(-2px) scale(1.1);} }

/* Header: branded gradient and spacing */
.chat-header { background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); border-radius: 14px 14px 0 0; padding: 14px 16px; box-shadow: inset 0 -1px 0 rgba(255,255,255,.25); }
.assistant-title { letter-spacing: .2px; }
.assistant-subtitle { opacity: .9; }

/* Messages: premium bubbles + tails */
.chat-messages { position: relative; padding: 14px; gap: 12px; }
.message { border-radius: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.06); border: 1px solid transparent; }
.bot-message { background: linear-gradient(135deg, rgba(96,165,250,.18), rgba(34,211,238,.18)); color: #0b1220; border-color: rgba(99,102,241,.25); }
.user-message { background: linear-gradient(180deg, #ffffff, #f8fafc); border-color: #e5e7eb; }
.bot-message::after, .user-message::after { content: ''; position: absolute; bottom: 10px; width: 12px; height: 12px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.bot-message { position: relative; }
.user-message { position: relative; }
.bot-message::after { left: -6px; border-left: inherit; border-bottom: inherit; }
.user-message::after { right: -6px; border-right: inherit; border-bottom: inherit; }

/* Message appearance animations */
.message-enter { animation: bubbleIn .26s cubic-bezier(.22,.61,.36,1) both; transform-origin: 12% 88%; }
@keyframes bubbleIn { 0% { transform: translateY(8px) scale(.96); opacity: 0;} 100% { transform: translateY(0) scale(1); opacity: 1;} }

/* Optional exit (not auto-used, kept for future) */
.message-exit { animation: bubbleOut .18s ease both; }
@keyframes bubbleOut { 0% { transform: translateY(0) scale(1); opacity:1;} 100% { transform: translateY(4px) scale(.98); opacity:0;} }

/* Typing indicator polish */
.typing-indicator { background: linear-gradient(180deg, #f8fafc, #eef2f7); border: 1px solid #e5e7eb; box-shadow: 0 8px 18px rgba(0,0,0,.06); }
.typing-dot { background: #64748b; border-radius: 50%; animation: typing 1s infinite ease-in-out; }

/* Suggestion chips: richer states */
.chip { background: linear-gradient(180deg, #ffffff, #f8fafc); border-color: #e5e7eb; box-shadow: 0 2px 6px rgba(0,0,0,.06); transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease; }
.chip:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.08); }
.chip:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(0,0,0,.06); }

/* Chat button: orb + pulse */
#chat-button { width: 56px; height: 56px; padding: 0; border-radius: 999px; font-size: 22px; position: fixed; display: inline-flex; align-items: center; justify-content: center; }
:root:not([data-theme='dark']) #chat-button { background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); color: #0b1220; border: none; box-shadow: 0 15px 30px rgba(0,0,0,.18); }
:root[data-theme='dark'] #chat-button { background: linear-gradient(135deg, rgba(96,165,250,.25), rgba(34,211,238,.25)); color: var(--text-color); border: 1px solid #334155; box-shadow: 0 15px 30px rgba(0,0,0,.35); }
#chat-button::before { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(99,102,241,.4); animation: ringPulse 2.5s infinite; }
#chat-button::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; background: radial-gradient(circle, rgba(99,102,241,.35), transparent 60%); filter: blur(6px); opacity: 0; transition: opacity .3s; }
#chat-button:hover::after { opacity: .8; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(99,102,241,.4);} 70% { box-shadow: 0 0 0 12px rgba(99,102,241,0);} 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0);} }

/* Inputs */
#chat-input { background: #ffffff; border-color: #e5e7eb; border-radius: 999px; padding: 10px 14px; transition: box-shadow .2s ease, border-color .2s ease; }
#chat-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
:root[data-theme='dark'] #chat-input { background: #0b1220; border-color: #1f2937; color: var(--text-color); }
:root[data-theme='dark'] .typing-indicator { background: #0f172a; border-color: #1f2937; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
:root[data-theme='dark'] .bot-message { background: linear-gradient(135deg, rgba(96,165,250,.2), rgba(34,211,238,.18)); border-color: rgba(148,163,184,.22); color: var(--text-color); }


/* ===== Page-embedded Robot Assistant (no popup) ===== */
#robot-assistant { position: fixed; right: 20px; left: auto; bottom: 20px; z-index: 1000; display: grid; grid-auto-rows: auto; gap: 10px; align-items: end; pointer-events: none; }
#robot-assistant.scrolled { transform: translateY(-2px); transition: transform .25s ease; }

/* Robot button (primary interface) */
#robot-assistant .assistant-robot { pointer-events: auto; width: 64px; height: 64px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.25); background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); box-shadow: 0 12px 26px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.25); cursor: pointer; position: relative; transition: transform .15s ease, box-shadow .2s ease; }
#robot-assistant .assistant-robot:focus-visible { outline: 3px solid rgba(99,102,241,.5); outline-offset: 3px; }
#robot-assistant .assistant-robot:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 18px 42px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.25); }
#robot-assistant .assistant-robot.listening::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; box-shadow: 0 0 0 0 rgba(99,102,241,.45); animation: ringPulse 2.4s infinite; }

/* Bubbles above robot */
#robot-assistant .robot-bubbles { pointer-events: auto; max-width: min(clamp(220px, 28ch, 300px), calc(100vw - 160px)); display: grid; gap: 8px; }
#robot-assistant .bubble { display: inline-block; position: relative; border-radius: 16px; padding: 10px 14px; font-size: .9rem; line-height: 1.35; box-shadow: 0 8px 18px rgba(0,0,0,.12); border: 1px solid transparent; background: #fff; color: #0b1220; }
#robot-assistant .bubble.bot { background: linear-gradient(135deg, rgba(96,165,250,.16), rgba(34,211,238,.16)); border-color: rgba(99,102,241,.25); }
#robot-assistant .bubble.user { background: linear-gradient(180deg, #ffffff, #f8fafc); border-color: #e5e7eb; justify-self: end; }
#robot-assistant .bubble::after { content: ''; position: absolute; bottom: -6px; left: 16px; width: 12px; height: 12px; background: inherit; transform: rotate(45deg); border-bottom: inherit; border-left: inherit; border-radius: 2px; }
#robot-assistant .bubble.user::after { left: auto; right: 16px; border-right: inherit; border-left: none; }
#robot-assistant .typing-bubble { display: inline-flex; gap: 6px; padding: 10px 12px; background: linear-gradient(180deg, #f8fafc, #eef2f7); border-color: #e5e7eb; }

/* Suggestions row */
#robot-assistant .robot-suggestions { pointer-events: auto; display: flex; flex-wrap: wrap; gap: 6px; }
#robot-assistant .robot-suggestions .chip { padding: .35rem .7rem; border-radius: 999px; border: 1px solid #e5e7eb; background: linear-gradient(180deg, #ffffff, #f8fafc); box-shadow: 0 2px 6px rgba(0,0,0,.06); font-size: .85rem; cursor: pointer; transition: transform .12s ease, box-shadow .2s ease; }
#robot-assistant .robot-suggestions .chip:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.08); }
#robot-assistant .robot-suggestions .chip:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Input micro-bubble */
#robot-assistant .robot-input-bubble { pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 999px; box-shadow: 0 10px 22px rgba(0,0,0,.12); }
#robot-assistant #robot-input { border: none; outline: none; min-width: 140px; font-size: .9rem; }
#robot-assistant #robot-send { border: none; background: var(--accent-color); color: #0b1220; width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 12px rgba(0,0,0,.16); }
#robot-assistant #robot-send:hover { transform: translateY(-1px); }

/* Dark theme */
:root[data-theme='dark'] #robot-assistant .assistant-robot { border-color: #334155; background: linear-gradient(135deg, rgba(96,165,250,.2), rgba(34,211,238,.2)); box-shadow: 0 12px 26px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05); }
:root[data-theme='dark'] #robot-assistant .bubble { background: #0f172a; color: var(--text-color); border-color: #1f2937; }
:root[data-theme='dark'] #robot-assistant .bubble.bot { background: linear-gradient(135deg, rgba(96,165,250,.18), rgba(34,211,238,.18)); border-color: rgba(148,163,184,.22); }
:root[data-theme='dark'] #robot-assistant .typing-bubble { background: #0f172a; border-color: #1f2937; }
:root[data-theme='dark'] #robot-assistant .robot-input-bubble { background: #0f172a; border-color: #1f2937; }
:root[data-theme='dark'] #robot-assistant #robot-input { background: transparent; color: var(--text-color); }
:root[data-theme='dark'] #robot-assistant .robot-suggestions .chip { background: #0f172a; color: var(--text-color); border-color: #334155; }

@media (max-width: 600px) { #robot-assistant { right: 12px; left: auto; bottom: 14px; gap: 8px; } #robot-assistant .assistant-robot { width: 56px; height: 56px; } #robot-assistant .robot-bubbles { max-width: min(88vw, 360px); } }

/* Layout refinement: place input to the left of the robot and link them */
#robot-assistant { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 10px; }
#robot-assistant .robot-bubbles { grid-column: 1 / -1; }
#robot-assistant .robot-suggestions { grid-column: 1 / -1; }
#robot-assistant .assistant-robot { grid-column: 2; grid-row: 2; }
#robot-assistant .robot-input-bubble { grid-column: 1; grid-row: 2; justify-self: end; position: relative; }
/* Connector tail from input bubble to robot */
#robot-assistant .robot-input-bubble::after { content: ''; position: absolute; top: 50%; right: -6px; width: 12px; height: 12px; background: inherit; transform: translateY(-50%) rotate(45deg); border-top: inherit; border-right: inherit; border-radius: 2px; }
:root[data-theme='dark'] #robot-assistant .robot-input-bubble::after { border-color: #1f2937; }

/* Robot limb micro-animations */
#robot-assistant .assistant-robot .arm-left { animation: armSway 6s ease-in-out infinite; }
#robot-assistant .assistant-robot .arm-right { animation: armSway 6s ease-in-out infinite; animation-delay: 1.5s; }
@keyframes armSway { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(3deg); } }

/* Make SVG content clearly visible and add personality */
#robot-assistant .assistant-robot .robot { overflow: visible; filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
#robot-assistant .assistant-robot .arm { transform-box: fill-box; transform-origin: center; }
#robot-assistant .assistant-robot .leg { transform-box: fill-box; transform-origin: center; }
#robot-assistant .assistant-robot .mouth { fill: rgba(11,18,32,.85); opacity: .9; }
/* Hide mouth-talk by default to prevent idle jitter; show only when speaking */
#robot-assistant .mouth-talk { display: none; }
#robot-assistant .assistant-robot.speaking .mouth-talk { display: block; }

/* Stronger interactive feedback */
#robot-assistant .assistant-robot:hover .eye { transform: translateY(-1px) scale(1.06); transition: transform .18s cubic-bezier(.22,.61,.36,1); }
#robot-assistant .assistant-robot:hover .antenna-tip { animation-duration: 1.6s; }
#robot-assistant .assistant-robot:active { transform: translateY(0) scale(.98); }

/* Wave when listening; stronger pulse */
#robot-assistant .assistant-robot.listening { box-shadow: 0 20px 46px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.25); }
#robot-assistant .assistant-robot.listening .antenna-tip { animation-duration: 1.2s; }
#robot-assistant .assistant-robot.listening .arm-right { animation: armWaveOnce .9s ease-out 0s 1; }

/* Hover wave loop */
/* Readability + wrapping in robot bubbles */
#robot-assistant .bubble { word-break: break-word; hyphens: auto; letter-spacing: .1px; }
#robot-assistant .bubble strong { font-weight: 600; }

/* Input micro-bubble appear */
#robot-assistant .robot-input-bubble.animate-in { animation: inputPop .2s ease both; transform-origin: right center; }
@keyframes inputPop { 0% { transform: translateY(6px) scale(.96); opacity: 0;} 100% { transform: translateY(0) scale(1); opacity: 1;} }

/* Eye/pupil styling and tracking via CSS vars */
#robot-assistant .sclera { fill: #fff; }
#robot-assistant .pupil { fill: #0b1220; transform-box: fill-box; transform-origin: center; }
#robot-assistant .pupil-left { transform: translate(var(--plx, 0px), var(--ply, 0px)); }
#robot-assistant .pupil-right { transform: translate(var(--prx, 0px), var(--pry, 0px)); }

/* Brows for expression */
#robot-assistant .brow { fill: currentColor; opacity: .6; transform-box: fill-box; transform-origin: center; transition: transform .25s ease, opacity .25s ease; }

/* Head tilt/breathing: applied to the main group */
#robot-assistant .robot-bob { animation: robotBob 5s ease-in-out infinite, breath 7s ease-in-out infinite; transform: rotate(var(--tilt, 0deg)); }
@keyframes breath { 0%, 100% { transform: translateY(0) rotate(var(--tilt, 0deg)) scale(1);} 50% { transform: translateY(-2px) rotate(var(--tilt, 0deg)) scale(1.01);} }

/* Speaking: subtle mouth talk */
#robot-assistant .assistant-robot.speaking .mouth-talk { transform-box: fill-box; transform-origin: 32px 39px; animation: talk 300ms ease-in-out infinite; }
@keyframes talk { 0%,100% { transform: scaleY(1);} 50% { transform: scaleY(1.4);} }

/* Thinking: brows tilt inward */
#robot-assistant .assistant-robot.thinking .brow-left { transform: rotate(12deg) translateY(-1px); }
#robot-assistant .assistant-robot.thinking .brow-right { transform: rotate(-12deg) translateY(-1px); }

/* Happy: show smile path, dim neutral mouth */
#robot-assistant .mouth-smile { display: none; }
#robot-assistant .assistant-robot.happy .mouth { opacity: .25; }
#robot-assistant .assistant-robot.happy .mouth-smile { display: block; }

/* Pointing reaction */
#robot-assistant .assistant-robot.pointing .arm-right { animation: none; transform: rotate(22deg) !important; transition: transform .25s ease; }

#robot-assistant .assistant-robot:hover .arm-right { animation: armWave 1.2s ease-in-out infinite; transform-origin: center; }
/* ---- Overrides: realistic standalone robot, scrollable bubbles, speaking-only mouth ---- */
/* Make robot larger, remove circular background and ring, and be standalone */
#robot-assistant .assistant-robot { width: 112px; height: 160px; padding: 0; border: none !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; display: inline-flex; align-items: end; justify-content: center; }
:root[data-theme='dark'] #robot-assistant .assistant-robot { background: transparent !important; box-shadow: none !important; border: none !important; }
#robot-assistant .assistant-robot.listening::after { content: none !important; }

/* Bubbles: wider and scrollable for long content */
#robot-assistant .robot-bubbles { max-width: min(clamp(220px, 28ch, 300px), calc(100vw - 160px)); max-height: 36vh; overflow-y: auto; padding-top: 8px; padding-right: 6px; -webkit-overflow-scrolling: touch; }
#robot-assistant .bubble { max-height: none; overflow: visible; }

/* Mobile scale-down */
@media (max-width: 600px) {
  #robot-assistant .assistant-robot { width: 72px; height: 104px; }
  #robot-assistant .robot-bubbles { max-width: min(88vw, 280px); max-height: 45vh; }
  #robot-assistant .bubble { max-height: none; }
}
@media (max-width: 400px) {
  #robot-assistant .assistant-robot { width: 64px; height: 96px; }
  #robot-assistant .robot-bubbles { max-width: min(92vw, 260px); }
}


@keyframes armWave { 0% { transform: rotate(0deg);} 25% { transform: rotate(18deg);} 50% { transform: rotate(0deg);} 75% { transform: rotate(-8deg);} 100% { transform: rotate(0deg);} }
@keyframes armWaveOnce { 0% { transform: rotate(0deg);} 40% { transform: rotate(22deg);} 100% { transform: rotate(0deg);} }

/* Vertical stack layout: all interaction text above the robot */
#robot-assistant { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; gap: 10px 16px; align-items: start; justify-items: start; }
#robot-assistant .robot-bubbles { grid-column: 1; grid-row: 1; }
#robot-assistant .robot-suggestions { grid-column: 1; grid-row: 2; margin-top: 4px; justify-self: start; }
#robot-assistant .robot-input-bubble { grid-column: 1; grid-row: 3; justify-self: start; margin-top: 2px; }
#robot-assistant .assistant-robot { grid-column: 1; grid-row: 4; align-self: end; }
/* Remove connector tail in vertical layout */
#robot-assistant .robot-input-bubble::after { content: none !important; }

/* Unified conversation panel: messages + input in one container */
#robot-assistant .robot-conversation { pointer-events: auto; display: grid; grid-template-rows: 1fr auto auto; gap: 8px; max-width: min(360px, calc(100vw - 160px)); max-height: 48vh; background: #ffffff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 10px; box-shadow: 0 12px 26px rgba(0,0,0,.12); overflow: hidden; }
:root[data-theme='dark'] #robot-assistant .robot-conversation { background: #0f172a; border-color: #1f2937; box-shadow: 0 12px 26px rgba(0,0,0,.45); }
#robot-assistant .robot-conversation .robot-bubbles { overflow-y: auto; max-height: none; padding-right: 6px; }
#robot-assistant .robot-conversation .robot-suggestions { border-top: 1px solid rgba(148,163,184,.22); padding-top: 6px; margin-top: -2px; }
#robot-assistant .robot-conversation .robot-bubbles { max-width: 100% !important; }

:root[data-theme='dark'] #robot-assistant .robot-conversation .robot-suggestions { border-top-color: #1f2937; }
#robot-assistant .robot-conversation .robot-input-bubble { width: 100%; justify-self: stretch; border-radius: 12px; }
/* Place the unified conversation above the robot */
#robot-assistant .robot-conversation { grid-column: 1; grid-row: 1 / span 3; }

/* Hide conversation when minimized */
#robot-assistant.minimized .robot-conversation { opacity: 0; transform: translateY(6px) scale(.98); pointer-events: none; transition: opacity .22s ease, transform .25s ease; }

/* Make only the conversation panel scroll, not individual bubbles */
#robot-assistant .bubble { max-height: none; overflow: visible; }

@media (max-width: 600px) {
  #robot-assistant .robot-conversation { max-width: min(92vw, 360px); max-height: 60vh; padding: 8px; }
}


@media (max-width: 600px) {
  #robot-assistant { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; gap: 8px; }
  #robot-assistant .robot-bubbles { grid-column: 1; grid-row: 1; }
  #robot-assistant .robot-suggestions { grid-column: 1; grid-row: 2; }
  #robot-assistant .robot-input-bubble { grid-column: 1; grid-row: 3; }
  #robot-assistant .assistant-robot { grid-column: 1; grid-row: 4; justify-self: end; }
}



/* ===== Minimized (eyes-only) mode ===== */
#robot-assistant.minimized { pointer-events: none; }
#robot-assistant.minimized .assistant-robot,
#robot-assistant.minimized .robot-bubbles,
#robot-assistant.minimized .robot-suggestions,
#robot-assistant.minimized .robot-input-bubble { opacity: 0; transform: translateY(6px) scale(.98); pointer-events: none; transition: opacity .22s ease, transform .25s ease; }

/* Eyes-only button (shows when minimized) */
#robot-assistant .assistant-eyes { display: none; position: fixed; right: 16px; bottom: 16px; width: 56px; height: 32px; border-radius: 999px; background: linear-gradient(135deg, rgba(96,165,250,.18), rgba(34,211,238,.18)); border: 1px solid rgba(148,163,184,.22); box-shadow: 0 12px 26px rgba(0,0,0,.25); align-items: center; justify-content: center; cursor: pointer; pointer-events: auto; transition: transform .18s ease, opacity .2s ease, box-shadow .2s ease; }
#robot-assistant .assistant-eyes .eyes { display: block; filter: drop-shadow(0 6px 12px rgba(0,0,0,.25)); }
#robot-assistant .assistant-eyes:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 18px 42px rgba(0,0,0,.3); }
#robot-assistant .assistant-eyes:focus-visible { outline: 3px solid rgba(34,211,238,.5); outline-offset: 3px; }
#robot-assistant.minimized .assistant-eyes { display: inline-flex; opacity: 1; }
#robot-assistant:not(.minimized) .assistant-eyes { opacity: 0; }

/* Ensure pupils in eyes-only respond to CSS vars */
#robot-assistant .assistant-eyes .pupil-left { transform: translate(var(--plx, 0px), var(--ply, 0px)); }
#robot-assistant .assistant-eyes .pupil-right { transform: translate(var(--prx, 0px), var(--pry, 0px)); }

@media (max-width: 600px) {
  #robot-assistant .assistant-eyes { right: 10px; bottom: 10px; width: 52px; height: 30px; }
}


/* Mobile decorative-only mode: keep eyes visible, remove all interactivity */
@media (max-width: 600px) {
  /* Hide all interactive/expanded UI */
  #robot-assistant .assistant-robot,
  #robot-assistant .robot-bubbles,
  #robot-assistant .robot-suggestions,
  #robot-assistant .robot-input-bubble { display: none !important; }

  /* Eyes remain visible but non-interactive */
  #robot-assistant .assistant-eyes {
    display: inline-flex !important;
    opacity: 1 !important;
    pointer-events: none !important;
    cursor: default !important;
  }
}
