/**
 * Atlas Desktop V1 — presentation layer (min-width: 821px only).
 * Mobile assistant presentation at <=820px is unchanged.
 */

/* Desktop-only shell chrome: hidden by default; enabled at >=821px. */
.og-atlas-desktop-shell,
.og-atlas-composer-send,
.og-atlas-desktop-scope,
.og-atlas-contact-prompt,
.og-chat-submit-label-desktop,
.og-atlas-transcript {
  display: none;
}

.og-atlas-composer-label-desktop.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 821px) {
  /* ── Closed launcher: transparent Atlas cutout, no white disc ── */
  .og-chat-toggle {
    position: relative;
    display: block;
    width: 72px;
    height: 72px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: transform 0.25s ease;
  }

  .og-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: none;
    background: transparent;
  }

  .og-chat-toggle:focus-visible {
    outline: 2px solid #006cff;
    outline-offset: 4px;
    border-radius: 999px;
  }

  .og-chat-toggle.is-idle-pulse {
    animation: none;
  }

  .og-chat-toggle-icon,
  .og-chat-toggle-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .og-atlas-launcher-figure {
    display: block;
    width: 72px;
    height: 72px;
  }

  .og-chat-widget.og-atlas-is-listening .og-chat-toggle {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92);
  }

  /* ── Atlas figure (static complete head until independent eye layer) ── */
  .og-atlas-figure {
    position: relative;
    display: block;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    background: transparent;
  }

  .og-atlas-head {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    background: transparent;
  }

  .og-atlas-launcher-figure .og-atlas-head {
    filter: drop-shadow(0 10px 24px rgba(4, 14, 28, 0.24));
    transition: filter 0.25s ease;
  }

  .og-chat-toggle:hover .og-atlas-launcher-figure .og-atlas-head {
    filter: drop-shadow(0 14px 28px rgba(4, 14, 28, 0.3));
  }

  /* ── Proactive nudge bubble (closed launcher only) ── */
  .og-atlas-nudge {
    position: absolute;
    right: 0;
    bottom: calc(100% + 16px);
    z-index: 2;
    display: none;
    width: 210px;
    max-width: 210px;
    min-width: 210px;
    height: auto;
    padding: 10px 14px;
    border: 1px solid #dce8fb;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(4, 14, 28, 0.14);
    color: #040e1c;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    cursor: pointer;
    pointer-events: none;
  }

  .og-atlas-nudge::after {
    content: "";
    position: absolute;
    right: 26px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    border-right: 1px solid #dce8fb;
    border-bottom: 1px solid #dce8fb;
    background: #fff;
    transform: rotate(45deg);
  }

  .og-atlas-nudge.is-visible {
    display: block;
    pointer-events: auto;
  }

  .og-atlas-nudge[hidden] {
    display: none !important;
  }

  .og-atlas-nudge:hover {
    border-color: #bfd7ff;
    box-shadow: 0 14px 32px rgba(0, 108, 255, 0.12);
  }

  .og-atlas-nudge:focus-visible {
    outline: 2px solid #006cff;
    outline-offset: 2px;
  }

  .og-atlas-nudge-text {
    display: block;
  }

  .og-chat-widget.og-atlas-is-listening .og-atlas-nudge {
    display: none !important;
  }

  @keyframes og-atlas-launcher-hop {
    0% {
      transform: translateY(0);
    }

    45% {
      transform: translateY(-7px);
    }

    100% {
      transform: translateY(0);
    }
  }

  .og-atlas-launcher-figure.is-hopping {
    animation: og-atlas-launcher-hop 0.36s ease;
  }

  /* ── Open panel geometry + cradle ── */
  body.og-chat-open #og-chat-widget,
  body.og-chat-open .og-chat-widget {
    top: auto !important;
    left: auto !important;
    right: 24px !important;
    bottom: 24px !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    pointer-events: none !important;
  }

  #og-chat-panel.is-open,
  .og-chat-panel.is-open,
  .og-assistant-panel.is-open {
    position: fixed !important;
    top: auto !important;
    left: auto !important;
    right: 24px !important;
    bottom: 88px !important;
    width: min(400px, calc(100vw - 32px)) !important;
    height: auto !important;
    max-height: min(82vh, 680px) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }

  .og-chat-panel {
    top: auto;
    bottom: 88px;
    padding-top: 28px;
    border-color: #d4e0ef;
    box-shadow: 0 24px 60px rgba(4, 14, 28, 0.16);
    overflow: visible;
  }

  .og-chat-panel::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 50%;
    z-index: 2;
    width: 92px;
    height: 40px;
    border: 1px solid #d4e0ef;
    border-top: 0;
    border-radius: 0 0 46px 46px;
    background: #fff;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .og-assistant-brand-mobile {
    display: none !important;
  }

  .og-assistant-brand-atlas {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 auto;
    text-align: center;
    gap: 0;
    min-width: 0;
  }

  .og-assistant-header,
  .og-chat-panel-header {
    position: relative !important;
    top: auto !important;
    flex-direction: column;
    align-items: center;
    padding: 8px 56px 14px 20px !important;
    border-bottom: 1px solid #e8eef6;
    background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%) !important;
    border-radius: 24px 24px 0 0;
    flex: 0 0 auto !important;
  }

  .og-assistant-body,
  .og-assistant-success,
  .og-assistant-error-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: none !important;
    padding-bottom: 20px !important;
  }

  #og-chat-panel .og-atlas-panel-slot {
    position: absolute;
    top: -64px;
    left: 50%;
    z-index: 4;
    transform: translateX(-50%);
  }

  .og-atlas-figure--panel {
    width: 80px;
    height: 80px;
  }

  .og-atlas-identity-copy {
    padding-top: 34px;
    width: 100%;
  }

  .og-assistant-title-desktop {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #040e1c;
  }

  .og-assistant-intro-desktop {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.4;
  }

  .og-chat-close,
  #og-chat-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 5 !important;
    min-width: 36px !important;
    min-height: 36px !important;
    width: 36px !important;
    height: 36px !important;
  }

  /* ── Desktop greeting ── */
  .og-assistant-bubble-desktop {
    display: block;
    align-self: flex-start;
    max-width: 92%;
    padding: 12px 14px;
    border-radius: 16px 16px 16px 6px;
    background: #eef5ff;
    color: #040e1c;
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .og-assistant-bubble-desktop p {
    margin: 0;
  }

  .og-assistant-bubble-desktop .og-assistant-greeting-lead {
    margin-bottom: 6px;
    font-weight: 800;
  }

  .og-assistant-bubble-welcome,
  .og-assistant-bubble-extended {
    display: none !important;
  }

  /* ── Desktop V2 shell: hide old wizard chrome ── */
  .og-assistant-topic-wrap,
  .og-assistant-bubble-response,
  .og-assistant-form-progress {
    display: none !important;
  }

  .og-atlas-desktop-shell {
    display: grid;
    gap: 10px;
    margin: 2px 0 4px;
  }

  .og-atlas-desktop-prompt {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: #64748b;
  }

  .og-atlas-desktop-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .og-atlas-desktop-action {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #dce8fb;
    border-radius: 12px;
    background: #fff;
    color: #040e1c;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  }

  .og-atlas-desktop-action:hover {
    border-color: #006cff;
    background: #f3f8ff;
  }

  .og-atlas-desktop-action.is-selected,
  .og-atlas-desktop-action[aria-pressed="true"] {
    border-color: #006cff;
    background: #eef5ff;
    box-shadow: inset 0 0 0 1px #006cff;
  }

  .og-atlas-desktop-action:focus-visible {
    outline: 2px solid #006cff;
    outline-offset: 2px;
  }

  .og-atlas-desktop-guidance {
    display: none;
    align-self: flex-start;
    max-width: 94%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 14px 14px 14px 6px;
    background: #eef5ff;
    color: #040e1c;
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .og-atlas-desktop-guidance.is-visible {
    display: block;
  }

  .og-atlas-desktop-guidance[hidden] {
    display: none !important;
  }

  .og-atlas-transcript {
    display: grid;
    gap: 10px;
    margin: 4px 0 2px;
  }

  .og-atlas-transcript[hidden] {
    display: none !important;
  }

  .og-atlas-transcript-log {
    display: grid;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .og-atlas-turn {
    max-width: 94%;
    margin: 0;
    padding: 10px 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #040e1c;
  }

  .og-atlas-turn-assistant {
    justify-self: start;
    border-radius: 14px 14px 14px 6px;
    background: #eef5ff;
  }

  .og-atlas-turn-user {
    justify-self: end;
    border-radius: 14px 14px 6px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
  }

  .og-atlas-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .og-atlas-quick-reply {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #dce8fb;
    border-radius: 999px;
    background: #fff;
    color: #040e1c;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
  }

  .og-atlas-quick-reply:hover {
    border-color: #006cff;
    background: #f3f8ff;
  }

  .og-atlas-quick-reply:focus-visible {
    outline: 2px solid #006cff;
    outline-offset: 2px;
  }

  .og-atlas-composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
    min-height: 64px;
  }

  .og-atlas-composer-field {
    margin: 0;
  }

  .og-atlas-composer-label-mobile {
    display: none !important;
  }

  .og-atlas-composer-field textarea {
    min-height: 52px;
    max-height: 96px;
    height: 52px;
    padding: 12px 14px;
    border-radius: 14px;
    resize: none;
    font-size: 0.9rem;
  }

  .og-atlas-composer-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 52px;
    height: 52px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: #006cff;
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
  }

  .og-atlas-composer-send:hover {
    background: #0058d6;
  }

  .og-atlas-composer-send:focus-visible {
    outline: 2px solid #006cff;
    outline-offset: 2px;
  }

  .og-atlas-composer-send:disabled {
    opacity: 0.65;
    cursor: wait;
  }

  .og-atlas-desktop-scope {
    display: block;
    margin: 2px 0 0;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
  }

  /* Conversational mode: contact is escalation-only; legacy suggestions not primary. */
  .og-atlas-contact-section {
    display: none;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e8eef6;
  }

  .og-atlas-contact-section.is-revealed,
  .og-assistant-body.og-atlas-contact-revealed .og-atlas-contact-section {
    display: grid;
  }

  #og-chat-suggestions {
    display: none !important;
  }

  .og-atlas-contact-prompt {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    color: #040e1c;
  }

  .og-chat-submit-label-default {
    display: none;
  }

  .og-chat-submit-label-desktop {
    display: inline;
  }

  .og-assistant-body {
    padding-top: 14px;
    gap: 12px;
  }

  .og-chat-field input,
  .og-chat-field textarea {
    border-color: #dce8fb;
  }

  .og-chat-field input:focus,
  .og-chat-field textarea:focus {
    border-color: #006cff;
    box-shadow: 0 0 0 3px rgba(0, 108, 255, 0.12);
  }

  .og-chat-submit {
    width: 100%;
    background: linear-gradient(180deg, #0a74ff 0%, #006cff 100%);
    box-shadow: 0 10px 24px rgba(0, 108, 255, 0.22);
  }
}

@media (min-width: 821px) and (prefers-reduced-motion: reduce) {
  .og-chat-toggle,
  .og-chat-panel {
    transition: none;
  }

  .og-atlas-launcher-figure.is-hopping {
    animation: none;
  }
}

@media (max-width: 820px) {
  .og-assistant-brand-atlas,
  .og-atlas-launcher-figure,
  .og-assistant-bubble-desktop,
  .og-atlas-nudge,
  .og-atlas-desktop-shell,
  .og-atlas-composer-send,
  .og-atlas-desktop-scope,
  .og-atlas-contact-prompt,
  .og-chat-submit-label-desktop,
  .og-atlas-composer-label-desktop,
  .og-atlas-transcript {
    display: none !important;
  }

  .og-atlas-composer {
    display: block;
  }

  .og-atlas-contact-section {
    display: contents;
  }

  .og-chat-submit-label-default {
    display: inline;
  }
}
