/* 2026-04-08 — extracted from ai.ejs inline script style injection */
/* 2026-04-28 — Single-composer architecture; removed references to deleted welcome sub-elements. */

/* Message container spacing */
#messages {
  padding-bottom: 24px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  max-height: none;
  min-height: 0;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .conversation {
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }

  .user-input {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    background: linear-gradient(to top, rgba(7, 11, 20, 0.98), rgba(7, 11, 20, 0.92)) !important;
    padding: 8px 10px 12px !important;
    border-top: 1px solid var(--chat-md-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    margin-top: auto;
    width: 100%;
  }

  .input-box {
    align-items: center;
    border-radius: 20px;
    margin: 0;
    width: 100%;
  }

  .composer-surface {
    padding: 8px 10px 8px 12px !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    gap: 8px !important;
    border-radius: 20px !important;
    width: 100%;
  }

  .composer-shell #message-input {
    padding: 8px 0 !important;
    min-height: 40px !important;
    flex: 1;
  }

  .composer-controls {
    margin-bottom: 2px;
  }

  .composer-disclaimer {
    margin-top: 8px !important;
    font-size: 0.7rem !important;
  }
}

/* 2026-04-28 — Mobile Material Dark refinements */
@media (max-width: 768px) {
  body {
    --navbar-height: 56px;
    --chat-sidebar-width: min(82vw, 304px);
  }

  .navbar {
    height: var(--navbar-height);
    padding: 0 10px;
  }

  .navbar-left {
    gap: 6px;
    left: auto;
  }

  .navbar-actions {
    gap: 4px;
  }

  .navbar-action-btn,
  .hamburger-menu {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .logo {
    margin-left: 2px;
  }

  .logo h1 {
    display: none;
  }

  .row {
    margin-top: var(--navbar-height) !important;
    height: calc(100vh - var(--navbar-height)) !important;
    height: calc(100dvh - var(--navbar-height)) !important;
    min-height: calc(100vh - var(--navbar-height)) !important;
    min-height: calc(100dvh - var(--navbar-height)) !important;
  }

  .box.conversations {
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: var(--chat-sidebar-width);
    padding: calc(var(--navbar-height) + 12px) 12px 14px;
    background: rgba(7, 11, 20, 0.96) !important;
    border-right: 1px solid var(--chat-md-border) !important;
    z-index: 1001;
  }

  body.mobile-nav-open .box.conversations {
    transform: translateX(0) !important;
    box-shadow: 24px 0 48px rgba(0, 0, 0, 0.36);
  }

  #sidebar-backdrop {
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  .conversation #messages {
    padding: 16px 12px 18px !important;
    gap: 12px;
  }

  .message {
    gap: 8px;
  }

  .message .user {
    width: 30px;
    height: 30px;
  }

  .message-assistant .content {
    max-width: calc(100% - 42px);
    padding: 10px 12px;
  }

  .message-user .content {
    padding: 10px 12px;
  }

  .message .content p,
  .message .content li {
    font-size: 0.94rem;
  }

  /* 2026-04-28 — Minimal welcome on mobile */
  #welcome-screen {
    justify-content: center;
    padding: 28px 14px 24px;
    gap: 14px;
  }

  .welcome-logo {
    width: 56px;
    height: 56px;
  }

  .welcome-heading {
    font-size: 1.6rem;
  }

  .welcome-sub {
    font-size: 0.93rem;
  }

  .welcome-chips {
    max-width: 100%;
  }

  .welcome-chip {
    min-height: 32px;
    font-size: 0.78rem;
    padding: 7px 12px;
  }

  .conversation .user-input {
    position: relative !important;
    width: 100% !important;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom)) !important;
    background: rgba(7, 11, 20, 0.94) !important;
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.22);
  }

  .composer-surface {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 10px !important;
    border-radius: var(--chat-md-radius-lg) !important;
  }

  .composer-shell #message-input {
    min-height: 38px !important;
    padding: 2px 0 !important;
    font-size: 16px !important;
  }

  .composer-controls {
    justify-content: space-between;
    margin-bottom: 0;
  }

  .composer-icon-btn,
  #send-button {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
  }

  .composer-disclaimer {
    margin-top: 6px !important;
    font-size: 0.68rem !important;
  }

  .sl-chat-modal {
    padding: 16px;
    align-items: flex-end;
  }

  .sl-chat-modal-card {
    padding: 22px;
    max-width: calc(100vw - 32px);
    border-radius: 20px;
    width: 100%;
  }

  .sl-chat-modal-actions {
    flex-direction: column;
  }
}

@media (max-width: 400px) {
  .welcome-heading {
    font-size: 1.4rem;
  }
}

/* 2026-05-01 - Mobile pass for the Grok-ish /chat redesign. */
@media (max-width: 768px) {
  body {
    --chat-rail-width: 0px;
    --chat-drawer-width: min(86vw, 320px);
    --chat-composer-max: 100%;
    --chat-content-max: 100%;
    --navbar-height: 56px;
    background: #020304 !important;
  }

  .chat-ambient {
    top: var(--navbar-height);
  }

  .navbar {
    position: fixed !important;
    inset: 0 0 auto 0 !important;
    width: 100% !important;
    height: var(--navbar-height) !important;
    padding: 0 10px !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    background: rgba(0, 0, 0, 0.72) !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.085) !important;
  }

  .navbar-left {
    flex-direction: row !important;
    width: auto !important;
    gap: 8px !important;
  }

  .navbar-actions {
    order: 1;
    flex-direction: row !important;
    gap: 4px !important;
  }

  .logo {
    order: 2;
  }

  .logo a {
    width: auto;
    height: 40px;
    gap: 7px;
  }

  .logo h1 {
    display: block !important;
    font-size: 0.98rem !important;
    color: #fff !important;
  }

  .navbar-right {
    order: 3;
    margin-left: auto !important;
  }

  .row {
    width: 100vw !important;
    height: calc(100vh - var(--navbar-height)) !important;
    height: calc(100dvh - var(--navbar-height)) !important;
    min-height: calc(100vh - var(--navbar-height)) !important;
    min-height: calc(100dvh - var(--navbar-height)) !important;
    margin: var(--navbar-height) 0 0 !important;
  }

  .box.conversations,
  body.desktop-nav-closed .box.conversations {
    left: 0 !important;
    top: 0 !important;
    width: var(--chat-drawer-width) !important;
    max-width: var(--chat-drawer-width) !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: calc(var(--navbar-height) + 12px) 12px 14px !important;
    transform: translateX(calc(-1 * var(--chat-drawer-width) - 8px)) !important;
  }

  body.mobile-nav-open .box.conversations {
    transform: translateX(0) !important;
    box-shadow: 22px 0 44px rgba(0, 0, 0, 0.38) !important;
  }

  body.chat-welcome-active .conversation {
    justify-content: center;
    padding: 0 14px 5vh !important;
  }

  #welcome-screen {
    gap: 10px !important;
    width: 100% !important;
  }

  .welcome-brand {
    gap: 9px;
    margin-bottom: 2px;
  }

  .welcome-logo {
    width: 46px !important;
    height: 46px !important;
    border-radius: 15px !important;
  }

  .welcome-wordmark {
    font-size: 1.35rem;
  }

  .welcome-heading {
    font-size: clamp(1.45rem, 8vw, 1.95rem) !important;
  }

  /* 2026-05-05 - Single line on mobile; shrink instead of wrapping. */
  .welcome-sub {
    width: 100% !important;
    max-width: 100% !important;
    font-size: clamp(0.62rem, 2.9vw, 0.9rem) !important;
    white-space: nowrap !important;
    overflow: hidden;
  }

  .conversation .user-input.composer--hero {
    width: 100% !important;
    margin-top: 8px !important;
  }

  .composer-surface {
    flex-direction: row !important;
    align-items: flex-end !important;
    gap: 6px !important;
    min-height: 56px;
    padding: 7px 7px 7px 9px !important;
    border-radius: 28px !important;
  }

  .composer-controls {
    display: contents !important;
  }

  .composer-left {
    order: -1;
    flex: 0 0 auto !important;
  }

  .composer-shell #message-input {
    min-height: 40px !important;
    padding: 9px 2px 7px !important;
    font-size: 16px !important;
  }

  .composer-icon-btn,
  #send-button,
  .composer-controls #send-button {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
  }

  body.chat-welcome-active .welcome-chips {
    gap: 8px !important;
    margin-top: 12px !important;
  }

  .welcome-chip {
    min-height: 36px !important;
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
  }

  .conversation .user-input {
    padding: 10px 10px max(10px, env(safe-area-inset-bottom)) !important;
  }

  .conversation #messages {
    padding: 16px 12px 18px !important;
  }
}

@media (max-width: 400px) {
  .logo h1 {
    display: none !important;
  }

  body.chat-welcome-active .conversation {
    padding-bottom: 3vh !important;
  }

  .welcome-wordmark {
    font-size: 1.2rem;
  }
}

/* 2026-05-04 - Stable mobile drawer layering for the navbar hamburger. */
@media (max-width: 768px) {
  .navbar {
    z-index: 1220 !important;
  }

  #sidebar-backdrop {
    display: block !important;
    position: fixed !important;
    inset: 0 0 0 var(--chat-drawer-width) !important;
    z-index: 1200 !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: opacity 180ms cubic-bezier(0.2, 0, 0, 1), visibility 0s linear 180ms;
  }

  body.mobile-nav-open #sidebar-backdrop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 180ms cubic-bezier(0.2, 0, 0, 1);
  }

  /* 2026-05-04 — Drawer must sit ABOVE the navbar so the chats overlap the header. */
  .box.conversations,
  body.desktop-nav-closed .box.conversations {
    z-index: 1300 !important;
    display: flex !important;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(calc(-1 * var(--chat-drawer-width) - 8px), 0, 0) !important;
    will-change: transform;
    transition: transform 220ms cubic-bezier(0.2, 0, 0, 1), visibility 0s linear 220ms;
  }

  /* 2026-05-04 — When the chat drawer is open, hide the navbar entirely so it
     can never poke through. The drawer has its own header (profile + close). */
  body.mobile-nav-open .navbar {
    display: none !important;
  }

  body.mobile-nav-open .box.conversations {
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) !important;
    transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
  }

  body.mobile-nav-open {
    overflow: hidden;
    touch-action: none;
  }

  body.mobile-nav-open .box.conversations {
    touch-action: auto;
  }
}

/* 2026-05-04 - Full-screen Grok-style mobile conversation menu. */
@media (max-width: 768px) {
  body {
    --chat-drawer-width: 100vw;
  }

  .box.conversations,
  body.desktop-nav-closed .box.conversations {
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: max(18px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom)) !important;
    gap: 20px !important;
    border: 0 !important;
    background: #111114 !important;
    box-shadow: none !important;
    transform: translate3d(-100vw, 0, 0) !important;
  }

  body.mobile-nav-open .box.conversations {
    transform: translate3d(0, 0, 0) !important;
  }

  body.mobile-nav-open #sidebar-backdrop {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .chat-menu-head {
    padding-top: 8px;
  }

  .chat-profile-strip-primary .chat-profile-avatar-wrap {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .chat-profile-strip-primary .chat-profile-avatar-initial {
    font-size: 1.3rem;
  }

  .chat-profile-strip-primary .chat-profile-name {
    font-size: clamp(1.6rem, 6vw, 2.25rem);
    line-height: 1.05;
  }

  .chat-profile-strip-primary .chat-profile-sub {
    display: none;
  }

  .chat-menu-collapse {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.08);
  }

  .chat-sidebar-cta {
    min-height: 76px;
    border-radius: 28px;
    padding: 12px 14px;
  }

  .chat-sidebar-cta-copy strong {
    font-size: 1.1rem;
  }

  .chat-sidebar-cta-copy small {
    font-size: 0.88rem;
  }

  .chat-conversations-title,
  .chat-pinned-title {
    margin-top: 4px;
    font-size: 1.12rem;
  }

  .chat-pinned-title button {
    width: 38px;
    height: 38px;
  }

  /* 2026-05-04 — `.bottom_buttons` now flows in the flex column instead of
     position:fixed, so we no longer need to reserve 104px of bottom padding
     to keep list items from being hidden behind a floating bar. */
  .conversations-list {
    flex: 1 1 auto !important;
    min-height: 0;
    padding-bottom: 12px !important;
  }

  .conversations .convo {
    min-height: 92px !important;
    padding: 10px 4px !important;
  }

  .convo-title {
    font-size: clamp(1.34rem, 5vw, 1.72rem) !important;
    line-height: 1.18 !important;
  }

  .convo-time {
    font-size: 1.05rem;
  }

  .convo-menu-btn {
    width: 42px;
    height: 42px;
    gap: 2px;
  }

  .convo-menu-btn span {
    width: 3.5px;
    height: 3.5px;
  }

  /* 2026-05-04 — Anchor sidebar bottom row to the flex column footer instead of
     position:fixed. The earlier `position:fixed; top:0; bottom:18px` cascade
     (chat-core.css mobile rule sets top:0 without !important) stretched the row
     to viewport height and centered the search/buttons mid-screen, while also
     overlaying the conversations list and the close button. Relative + auto
     margin keeps it pinned at the bottom of the drawer without the overlay. */
  .bottom_buttons {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    margin-top: auto !important;
    flex: 0 0 auto;
    z-index: 3;
    grid-template-columns: minmax(0, 1fr) 64px 64px;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 0 max(8px, env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    background: transparent !important;
  }

  .chat-sidebar-search {
    height: 64px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.085);
  }

  .chat-sidebar-search input {
    font-size: 1.3rem;
  }

  .chat-sidebar-round-btn {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.085);
  }

  /* 2026-05-04 — Mobile new-chat icon larger and more prominent. The pencil
     glyph reads as a primary action so it gets the biggest stroke in the row. */
  .chat-sidebar-new-btn svg {
    width: 38px !important;
    height: 38px !important;
    stroke-width: 2.1 !important;
  }

  body.chat-welcome-active .composer-disclaimer {
    display: block !important;
    margin: 8px auto 0 !important;
    max-width: 330px;
    color: rgba(226, 232, 240, 0.62);
    font-size: 0.74rem !important;
    line-height: 1.35;
    text-align: center;
  }

  body.chat-has-messages .composer-disclaimer {
    display: none !important;
  }
}

/* 2026-05-05 - Tighten /chat sizing on mobile while preserving desktop scale. */
@media (max-width: 768px) {
  body.chat-welcome-active .conversation {
    padding: 0 12px 3.5vh !important;
  }

  #welcome-screen {
    gap: 8px !important;
  }

  .welcome-brand {
    gap: 8px !important;
    margin-bottom: 0 !important;
  }

  .welcome-logo {
    width: 40px !important;
    height: 40px !important;
    border-radius: 13px !important;
  }

  .welcome-wordmark {
    font-size: 1.1rem !important;
  }

  .welcome-heading {
    font-size: clamp(1.28rem, 6.6vw, 1.62rem) !important;
    line-height: 1.12 !important;
  }

  /* 2026-05-05 - Single line on smallest viewports; shrink with clamp. */
  .welcome-sub {
    width: 100% !important;
    max-width: 100% !important;
    font-size: clamp(0.58rem, 2.7vw, 0.84rem) !important;
    line-height: 1.45 !important;
    white-space: nowrap !important;
    overflow: hidden;
  }

  body.chat-welcome-active .welcome-chips {
    gap: 6px !important;
    margin-top: 8px !important;
  }

  .welcome-chip {
    min-height: 31px !important;
    padding: 6px 10px !important;
    font-size: 0.74rem !important;
  }

  .conversation #messages {
    padding: 12px 10px 14px !important;
  }

  .message {
    padding: 10px 0 !important;
  }

  .message .user {
    width: 28px !important;
    height: 28px !important;
  }

  .message-assistant .content {
    max-width: calc(100% - 38px) !important;
    padding: 9px 10px !important;
  }

  .message-user .content {
    padding: 9px 10px !important;
  }

  .message .content p,
  .message .content li {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
  }

  .conversation .user-input {
    padding: 8px 8px max(8px, env(safe-area-inset-bottom)) !important;
  }

  .composer-surface {
    min-height: 50px !important;
    gap: 5px !important;
    padding: 6px 6px 6px 8px !important;
    border-radius: 24px !important;
  }

  .composer-shell #message-input {
    min-height: 36px !important;
    padding: 7px 2px 6px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
  }

  .composer-icon-btn,
  #send-button,
  .composer-controls #send-button {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }

  .chat-profile-strip-primary .chat-profile-avatar-wrap {
    width: 52px !important;
    height: 52px !important;
    flex-basis: 52px !important;
  }

  .chat-profile-strip-primary .chat-profile-avatar-initial {
    font-size: 1.08rem !important;
  }

  .chat-profile-strip-primary .chat-profile-name {
    font-size: clamp(1.24rem, 5vw, 1.58rem) !important;
  }

  .chat-menu-collapse {
    width: 52px !important;
    height: 52px !important;
  }

  .chat-sidebar-cta {
    min-height: 64px !important;
    border-radius: 22px !important;
    padding: 10px 12px !important;
  }

  .chat-sidebar-cta-copy strong {
    font-size: 0.98rem !important;
  }

  .chat-sidebar-cta-copy small {
    font-size: 0.78rem !important;
  }

  .chat-conversations-title,
  .chat-pinned-title {
    font-size: 1rem !important;
  }

  .conversations .convo {
    min-height: 72px !important;
    padding: 8px 4px !important;
  }

  .convo-title {
    font-size: clamp(1.02rem, 4vw, 1.26rem) !important;
    line-height: 1.22 !important;
  }

  .convo-time {
    font-size: 0.88rem !important;
  }

  .convo-menu-btn {
    width: 36px !important;
    height: 36px !important;
  }

  .bottom_buttons {
    grid-template-columns: minmax(0, 1fr) 52px 52px !important;
    gap: 9px !important;
    padding-top: 8px !important;
  }

  .chat-sidebar-search {
    height: 52px !important;
    padding: 0 16px !important;
  }

  .chat-sidebar-search input {
    font-size: 1rem !important;
  }

  .chat-sidebar-round-btn {
    width: 52px !important;
    height: 52px !important;
  }

  .chat-sidebar-new-btn svg {
    width: 30px !important;
    height: 30px !important;
  }
}

@media (max-width: 400px) {
  .welcome-heading {
    font-size: 1.22rem !important;
  }

  .welcome-wordmark {
    font-size: 1.02rem !important;
  }
}

/* 2026-05-05 - Mobile loads after chat-core, so restate the visible disclaimer
   contract here for both welcome and active chat states.
   2026-05-05 - Sit under the welcome chips, single-line, shrink text instead
   of wrapping on narrow viewports. */
@media (max-width: 768px) {
  .conversation .user-input .composer-disclaimer,
  body.chat-welcome-active .conversation .user-input .composer-disclaimer,
  body.chat-has-messages .conversation .user-input .composer-disclaimer {
    display: block !important;
    order: 1;
    width: 100%;
    max-width: 100%;
    margin: 8px auto 0 !important;
    padding: 0 6px;
    color: rgba(226, 232, 240, 0.66);
    font-size: clamp(0.5rem, 2.5vw, 0.68rem) !important;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
  }

  .conversation .user-input {
    display: flex !important;
    flex-direction: column;
    flex: 0 0 auto;
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }

  body.chat-welcome-active .conversation {
    min-height: 0;
  }
}

/* 2026-05-08 - Larger AI response text on mobile for readability. Scoped to
   assistant bubbles so user messages keep their existing size. */
@media (max-width: 768px) {
  .message-assistant .content p,
  .message-assistant .content li,
  .message-assistant .content blockquote {
    font-size: 1.05rem !important;
    line-height: 1.55 !important;
  }
}
