/* Existing shared components and transitions; design tokens live in design.css. */
/* Theme values are defined only in design.css. */

      @keyframes message-in {
        from {
          opacity: 0;
          transform: translateY(4px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      /* Short travel + decelerating ease: the message settles rather than
         slides. Matches the timing used across modern AI clients. */
      .message-enter {
        animation: message-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
      }

      /* Soft hover lift — only after the enter animation has settled. */
      .message-enter[data-role="user"]:hover .msg-user-bubble,
      .message-enter[data-role="assistant"]:hover .msg-ai-bubble {
        transform: translateY(-1px);
      }
      .wordmark-vitmeet {
        font-family: "Chakra Petch", "Space Grotesk", system-ui, sans-serif;
        font-weight: 700;
        letter-spacing: 0.04em;
        line-height: 1;
        color: #7c3aed; /* light mode: solid, no glow */
      }

      /* dark mode gets the full gradient + glow treatment */
      .dark .wordmark-vitmeet {
        background: linear-gradient(
          135deg,
          #d8b4fe 0%,
          #a855f7 45%,
          #7c3aed 100%
        );
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.55));
      }

      @supports not (background-clip: text) {
        .dark .wordmark-vitmeet {
          background: none;
          color: #c084fc;
        }
      }
      .msg-user-bubble,
      .msg-ai-bubble {
        transition:
          transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
          border-color 0.2s ease,
          box-shadow 0.2s ease;
      }

      .chat-scroll::-webkit-scrollbar {
        width: 4px;
      }

      .chat-scroll::-webkit-scrollbar-thumb {
        background-color: rgba(161, 161, 170, 0.3);
        border-radius: 9999px;
      }

      /* Sidebar desktop slide (RTL: panel sits on the inline-start / right edge) */
      @media (min-width: 768px) {
        .sidebar-panel {
          width: var(--sidebar-width);
          flex-shrink: 0;
          margin-inline-start: calc(var(--sidebar-width) * -1);
          transition: margin-inline-start 0.24s cubic-bezier(0.22, 1, 0.36, 1);
          will-change: margin-inline-start;
        }

        .sidebar-open .sidebar-panel {
          margin-inline-start: 0;
        }

        .sidebar-close-btn {
          display: none;
        }
      }

      @media (max-width: 767px) {
        .sidebar-panel {
          position: fixed;
          top: 0;
          inset-inline-start: 0;
          height: 100%;
          width: var(--sidebar-width);
          transform: translateX(100%);
          transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
          z-index: 50;
          will-change: transform;
        }

        .sidebar-open .sidebar-panel {
          transform: translateX(0);
        }

        .sidebar-backdrop {
          opacity: 0;
          pointer-events: none;
          transition: opacity 0.2s ease-out;
        }

        .sidebar-open .sidebar-backdrop {
          opacity: 1;
          pointer-events: auto;
        }
      }

      /* Modal transition */
      .modal-overlay {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease-in-out;
      }

      .modal-overlay.active {
        opacity: 1;
        pointer-events: auto;
      }

      .modal-panel {
        transform: translateY(8px);
        transition: transform 0.2s ease-in-out;
      }

      .modal-overlay.active .modal-panel {
        transform: translateY(0);
      }

      .interactive {
        transition:
          color 0.2s ease,
          background-color 0.2s ease,
          border-color 0.2s ease,
          box-shadow 0.2s ease,
          opacity 0.2s ease,
          transform 0.2s ease;
      }

      button:not(:disabled) {
        -webkit-tap-highlight-color: transparent;
      }

      button:not(:disabled):active {
        transform: scale(0.97);
      }

      button:disabled {
        cursor: not-allowed;
        opacity: 0.5;
      }

      .surface-elevated {
        background: var(--surface-elevated);
        border-color: var(--border);
        box-shadow: var(--shadow-soft);
      }

      .surface-glass {
        background: var(--surface-glass);
        border-color: var(--border);
        box-shadow: var(--shadow-elevated);
        backdrop-filter: blur(16px);
      }

      /* Toast — bottom-right, glass surface + purple countdown line */
      .toast-container {
        position: fixed;
        right: 1rem;
        bottom: 1rem;
        z-index: 400;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
        pointer-events: none;
      }

      .toast {
        pointer-events: auto;
        min-width: 17rem;
        max-width: min(22rem, calc(100vw - 2rem));
        overflow: hidden;
        border-radius: 0.875rem;
        transform-origin: bottom right;
      }

      .toast-body {
        display: flex;
        align-items: center;
        gap: 0.625rem;
        padding: 0.875rem 1rem;
      }

      .toast-icon {
        display: inline-flex;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        width: 1.75rem;
        height: 1.75rem;
        border-radius: 9999px;
        background: rgba(147, 51, 234, 0.12);
        color: var(--primary);
      }

      .toast-icon svg {
        width: 1rem;
        height: 1rem;
      }

      .toast-message {
        margin: 0;
        font-size: 0.8125rem;
        font-weight: 500;
        line-height: 1.45;
        color: var(--text-main);
      }

      .toast-progress-track {
        height: 2px;
        background: rgba(147, 51, 234, 0.12);
      }

      .toast-progress-bar {
        height: 100%;
        background: linear-gradient(
          90deg,
          var(--primary) 0%,
          var(--primary-hover) 100%
        );
        transform-origin: left center;
        animation: toast-countdown linear forwards;
      }

      .toast-enter {
        animation: toast-in 280ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
      }

      .toast-exit {
        animation: toast-out 240ms ease-in forwards;
      }

      @keyframes toast-in {
        from {
          opacity: 0;
          transform: translateY(0.65rem) scale(0.98);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }

      @keyframes toast-out {
        from {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
        to {
          opacity: 0;
          transform: translateY(0.4rem) scale(0.98);
        }
      }

      @keyframes toast-countdown {
        from {
          transform: scaleX(1);
        }
        to {
          transform: scaleX(0);
        }
      }

      .composer-shell {
        box-shadow:
          0 1px 0 rgba(255, 255, 255, 0.04) inset,
          var(--shadow-soft);
      }

      .composer-shell:focus-within {
        border-color: rgba(147, 51, 234, 0.52);
        box-shadow:
          0 0 0 3px rgba(147, 51, 234, 0.13),
          var(--shadow-soft);
        transform: scale(1.006);
      }

      .composer-shell:hover {
        border-color: var(--border-strong);
      }

      #input::placeholder {
        opacity: 0.68;
        transition:
          opacity 0.2s ease,
          transform 0.2s ease;
      }

      #input:focus::placeholder {
        opacity: 0.38;
        transform: translateX(-3px);
      }

      .mascot-stage {
        position: relative;
        min-height: 9rem;
      }

      .mascot-stage::after {
        position: absolute;
        inset-inline: 25%;
        bottom: 0.35rem;
        height: 0.8rem;
        content: "";
        border-radius: 9999px;
        background: rgba(147, 51, 234, 0.12);
        filter: blur(12px);
      }

      .mascot-stage .mascot-svg {
        position: relative;
        z-index: 1;
        animation: mascot-breathe 4s ease-in-out infinite;
        transform-origin: 50% 80%;
      }

      /* Thinking state: larger, calmly breathing mascot + soft glow.
         Replaces outdated bouncing-dot loaders. */
      .thinking-mascot {
        animation: thinking-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
        filter: drop-shadow(0 0 18px rgba(147, 51, 234, 0.18));
      }

      .thinking-mascot .mascot-svg {
        width: 5rem;
        height: 5rem;
        animation: mascot-thinking 3.6s ease-in-out infinite;
        transform-origin: 50% 80%;
      }

      .thinking-mascot [id^="mascotPupil"] {
        animation: eye-pulse 2.8s ease-in-out infinite;
        transform-box: fill-box;
        transform-origin: center;
      }

      @keyframes thinking-in {
        from {
          opacity: 0;
          transform: translateY(4px) scale(0.97);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }

      /* Shimmering label: one animated background-position, no layout work. */
      .thinking-label {
        letter-spacing: 0.01em;
        background: linear-gradient(
          90deg,
          var(--text-muted) 0%,
          var(--text-main) 45%,
          var(--text-muted) 100%
        );
        background-size: 200% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: thinking-shimmer 2.8s linear infinite;
      }

      @keyframes thinking-shimmer {
        from {
          background-position: 200% 0;
        }
        to {
          background-position: -200% 0;
        }
      }

      @keyframes mascot-breathe {
        0%,
        100% {
          transform: translateY(0) scale(1);
        }
        50% {
          transform: translateY(-2px) scale(1.012);
        }
      }

      @keyframes mascot-thinking {
        0%,
        100% {
          transform: translateY(0) scale(1);
          opacity: 0.92;
        }
        50% {
          transform: translateY(-3px) scale(1.018);
          opacity: 1;
        }
      }

      @keyframes eye-pulse {
        0%,
        100% {
          opacity: 0.8;
          transform: scale(0.97);
        }
        50% {
          opacity: 1;
          transform: scale(1.04);
        }
      }

      .settings-panel-enter {
        animation: settings-panel-in 0.2s ease-out;
      }

      @keyframes settings-panel-in {
        from {
          opacity: 0;
          transform: translateY(4px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      /* Streaming placeholder: blinking caret trailing the partial reply. */
      .is-streaming::after {
        content: "";
        display: inline-block;
        width: 2px;
        height: 1em;
        margin-inline-start: 2px;
        vertical-align: text-bottom;
        background-color: currentColor;
        opacity: 0.7;
        animation: caret-blink 1s steps(2, start) infinite;
      }

      @keyframes caret-blink {
        50% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The shimmer relies on motion to stay legible — fall back to a
           plain muted label rather than a frozen gradient. */
        .thinking-label {
          background: none;
          color: var(--text-muted);
        }

        .message-enter[data-role="user"]:hover .msg-user-bubble,
        .message-enter[data-role="assistant"]:hover .msg-ai-bubble {
          transform: none;
        }

        *,
        *::before,
        *::after {
          scroll-behavior: auto !important;
          animation-duration: 0.01ms !important;
          animation-iteration-count: 1 !important;
          transition-duration: 0.01ms !important;
        }
      }

      /* --- Step 3: Hero-to-Chat composer transition --- */
      .chat-greeting {
        max-height: 22rem;
        opacity: 1;
      }
      #chatContainer:not(.is-chat-active) #chat {
        flex-grow: 1;
        padding-top: 0;
        padding-bottom: 0;
      }
      #chatContainer:not(.is-chat-active) .composer-region {
        flex-grow: 0;
      }
      #chatContainer.is-chat-active #chat {
        flex-grow: 1;
      }
      #chatContainer.is-chat-active .composer-region {
        flex-grow: 0;
      }
      #chatContainer.is-chat-active .chat-greeting {
        max-height: 0;
        margin: 0;
        padding-top: 0;
        padding-bottom: 0;
        opacity: 0;
        pointer-events: none;
      }
      /* Suggestion chips sit between greeting and composer — hide with hero. */
      #chatContainer.is-chat-active #suggestionChips {
        max-height: 0;
        margin: 0;
        padding: 0;
        opacity: 0;
        pointer-events: none;
        overflow: hidden;
      }
