/* MCA — Atlas AI chat widget */

.atlas {
  --atlas-bg: #0B1116;
  --atlas-surface: #121A22;
  --atlas-border: rgba(255, 255, 255, 0.08);
  --atlas-border-strong: rgba(255, 255, 255, 0.14);
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 80;
  font-family: var(--font-body);
}
@media (max-width: 600px) {
  .atlas { right: 16px; bottom: 16px; }
}

/* ---------- Launcher ---------- */
.atlas__launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 60px;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: transparent;
  border-radius: 999px;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.atlas__launcher:hover { transform: translateY(-2px); }
.atlas__launcher:active { transform: translateY(0); }
.atlas--open .atlas__launcher {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6) translateY(8px);
}

.atlas__orb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(120% 120% at 30% 25%, #16323b 0%, #0c171d 60%),
    #0b1116;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 40px -16px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.atlas__orb::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 200deg, var(--teal), #1A3B4D, var(--teal));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0.9;
  animation: atlas-spin 8s linear infinite;
}
@keyframes atlas-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .atlas__orb::before { animation: none; }
}

/* breathing glow halo */
.atlas__launcher::after {
  content: "";
  position: absolute;
  left: 30px;
  top: 30px;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--teal) 55%, transparent) 0%, transparent 70%);
  z-index: -1;
  animation: atlas-pulse 2.8s ease-in-out infinite;
}
@keyframes atlas-pulse {
  0%, 100% { opacity: 0.35; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.7;  transform: translate(-50%, -50%) scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .atlas__launcher::after { animation: none; }
}

.atlas__orb-glyph { position: relative; z-index: 1; display: block; }

.atlas__orb-status {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #2fd47a;
  border: 2.5px solid var(--atlas-bg);
  z-index: 2;
}

/* label pill that slides out from the orb */
.atlas__label {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  height: 60px;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  padding-right: 0;
  margin-left: -30px;
  padding-left: 42px;
  border-radius: 0 999px 999px 0;
  background: var(--atlas-surface);
  box-shadow:
    0 0 0 1px var(--atlas-border),
    0 18px 40px -16px rgba(0, 0, 0, 0.7);
  text-align: left;
  opacity: 0;
  transition: max-width 420ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 260ms ease, padding-right 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.atlas__launcher:hover .atlas__label {
  max-width: 220px;
  opacity: 1;
  padding-right: 22px;
}
.atlas__label-top {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.1;
}
.atlas__label-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin-top: 3px;
}

/* ---------- Panel ---------- */
.atlas__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 392px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 56px);
  background: var(--atlas-bg);
  border-radius: 22px;
  box-shadow:
    0 0 0 1px var(--atlas-border),
    0 40px 90px -30px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 280ms ease, transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
}
.atlas--open .atlas__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
@media (max-width: 600px) {
  .atlas__panel { width: calc(100vw - 32px); height: calc(100vh - 96px); }
}

/* header */
.atlas__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(0, 165, 161, 0.16), transparent 60%),
    #0d141b;
  border-bottom: 1px solid var(--atlas-border);
}
.atlas__head-orb {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(120% 120% at 30% 25%, #16323b 0%, #0c171d 60%);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 0 0 1px var(--atlas-border-strong);
}
.atlas__head-status {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2fd47a;
  border: 2px solid #0d141b;
}
.atlas__head-text { flex: 1; min-width: 0; }
.atlas__head-name {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.atlas__head-name .atlas__tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid color-mix(in srgb, var(--teal) 45%, transparent);
  border-radius: 999px;
  padding: 2px 7px;
  font-weight: 500;
}
.atlas__head-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.atlas__head-sub .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #2fd47a; display: inline-block;
}
.atlas__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--atlas-border);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.6);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.atlas__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: rotate(90deg);
}

/* body / messages */
.atlas__body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
}
.atlas__body::-webkit-scrollbar { width: 7px; }
.atlas__body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12); border-radius: 99px;
}

.atlas__msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: atlas-rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes atlas-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.atlas__msg--bot { align-self: flex-start; }
.atlas__msg--user { align-self: flex-end; flex-direction: row-reverse; }

.atlas__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  background: radial-gradient(120% 120% at 30% 25%, #16323b 0%, #0c171d 60%);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 0 0 1px var(--atlas-border);
}

.atlas__bubble {
  font-size: 14.5px;
  line-height: 1.55;
  padding: 12px 15px;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.92);
}
.atlas__msg--bot .atlas__bubble {
  background: var(--atlas-surface);
  border: 1px solid var(--atlas-border);
  border-top-left-radius: 5px;
}
.atlas__msg--user .atlas__bubble {
  background: linear-gradient(135deg, var(--teal), #048481);
  color: #fff;
  border-top-right-radius: 5px;
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--teal) 80%, transparent);
}
.atlas__bubble p { margin: 0 0 8px; }
.atlas__bubble p:last-child { margin-bottom: 0; }
.atlas__bubble strong { color: #fff; font-weight: 600; }

/* typing indicator */
.atlas__typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}
.atlas__typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  animation: atlas-bounce 1.2s ease-in-out infinite;
}
.atlas__typing span:nth-child(2) { animation-delay: 0.18s; }
.atlas__typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes atlas-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* suggestion chips */
.atlas__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 4px 38px;
  animation: atlas-rise 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 120ms;
}
.atlas__chip {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--atlas-border);
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.atlas__chip:hover {
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  border-color: color-mix(in srgb, var(--teal) 50%, transparent);
  color: #fff;
  transform: translateY(-1px);
}

/* footer input */
.atlas__foot {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--atlas-border);
  background: #0d141b;
}
.atlas__inputwrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--atlas-surface);
  border: 1px solid var(--atlas-border);
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.atlas__inputwrap--focus {
  border-color: color-mix(in srgb, var(--teal) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 14%, transparent);
}
.atlas__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  max-height: 96px;
  padding: 7px 0;
}
.atlas__input::placeholder { color: rgba(255, 255, 255, 0.38); }
.atlas__send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--teal), #048481);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease, filter 160ms ease;
}
.atlas__send:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.atlas__send:disabled { opacity: 0.4; cursor: default; }

.atlas__disclaimer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  margin: 10px 0 0;
}
.atlas__disclaimer .accent { color: var(--teal); }
