/* Topolograph Agent - light topology-inspired Chainlit theme */

:root {
  --topo-blue: #0878f9;
  --topo-blue-dark: #0564d8;
  --topo-blue-soft: #edf5ff;
  --topo-ink: #172235;
  --topo-muted: #69758a;
  --topo-line: #d8e9ff;
  --topo-surface: rgba(255, 255, 255, 0.94);
  --topo-shadow: 0 22px 60px rgba(28, 65, 112, 0.14);
}

html.dark {
  --topo-blue: #58a6ff;
  --topo-blue-dark: #79b8ff;
  --topo-blue-soft: #152a43;
  --topo-ink: #eef5ff;
  --topo-muted: #9eacc0;
  --topo-line: #263c56;
  --topo-surface: rgba(20, 29, 41, 0.96);
  --topo-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

html,
body,
#root {
  color: var(--topo-ink);
  background-color: #fbfdff;
}

html.dark body,
html.dark #root {
  background-color: #0d141d;
}

html.dark #root {
  background-image: url("/public/hex-grid-dark.svg");
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

#root {
  background-image: url("/public/hex-grid.svg");
  background-size: 240px 208px;
  background-attachment: fixed;
}

#root::before {
  position: fixed;
  inset: 60px 0 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 35%, rgba(8, 120, 249, 0.07), transparent 24%),
    radial-gradient(circle at 76% 58%, rgba(8, 120, 249, 0.06), transparent 22%),
    linear-gradient(rgba(251, 253, 255, 0.72), rgba(251, 253, 255, 0.82));
}

html.dark #root::before {
  background:
    radial-gradient(circle at 18% 35%, rgba(50, 132, 224, 0.08), transparent 24%),
    radial-gradient(circle at 76% 58%, rgba(50, 132, 224, 0.06), transparent 22%),
    linear-gradient(rgba(13, 20, 29, 0.68), rgba(13, 20, 29, 0.8));
}

#root > * {
  position: relative;
  z-index: 1;
}

#root > .grid > div:last-child {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 18px;
  background-color: #fbfdff;
  background-image: url("/public/hex-grid.svg");
  background-size: 240px 208px;
  background-attachment: fixed;
  box-sizing: border-box;
}

html.dark #root > .grid > div:last-child {
  background-color: #0d141d;
  background-image: url("/public/hex-grid-dark.svg");
}

#header {
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid #e5edf7;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(15, 44, 80, 0.02);
  backdrop-filter: blur(14px);
}

html.dark #header {
  border-bottom-color: #26374b;
  background: rgba(14, 21, 31, 0.96);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

.topo-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  color: var(--topo-ink);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.topo-header-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 5px 14px rgba(8, 120, 249, 0.24);
}

#header button {
  color: #5f6b7c;
}

#header button:hover {
  color: var(--topo-blue);
  background: var(--topo-blue-soft);
}

html.dark #header button {
  color: #aeb9c9;
}

html.dark #header button:hover {
  color: #d7e8ff;
  background: #18283b;
}

.topo-dialog-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: min(100%, 520px);
  min-height: 560px;
  padding: 12px 0;
}

.topo-dialog-frame {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 16px;
  border: 1px solid rgba(133, 177, 230, 0.26);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(8, 120, 249, 0.16), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(69, 159, 255, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.98));
  box-shadow: 0 24px 70px rgba(28, 65, 112, 0.18);
  overflow: hidden;
}

.topo-dialog-frame::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(rgba(8, 120, 249, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 120, 249, 0.03) 1px, transparent 1px);
  background-size: 100% 38px, 42px 100%;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 82%);
}

.topo-dialog-frame > * {
  position: relative;
  z-index: 1;
}

.topo-dialog-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}

.topo-dialog-dots {
  display: flex;
  gap: 7px;
}

.topo-dialog-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(145, 162, 186, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.topo-dialog-dot:first-child {
  background: #fb6f72;
}

.topo-dialog-dot:nth-child(2) {
  background: #f7cc6d;
}

.topo-dialog-dot:nth-child(3) {
  background: #66d19f;
}

.topo-dialog-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topo-dialog-title {
  color: #1a2432;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.topo-dialog-subtitle {
  color: rgba(95, 111, 134, 0.82);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topo-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100% - 34px);
  padding: 4px 2px 2px;
  overflow: hidden;
}

.topo-dialog-turn {
  display: flex;
}

.topo-dialog-turn-user {
  justify-content: flex-end;
}

.topo-dialog-turn-agent {
  justify-content: flex-start;
}

.topo-dialog-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid rgba(145, 174, 211, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(28, 65, 112, 0.08);
}

.topo-dialog-turn-user .topo-dialog-bubble {
  border-color: rgba(145, 202, 255, 0.36);
  background: linear-gradient(180deg, rgba(18, 110, 221, 0.95), rgba(10, 91, 192, 0.98));
}

.topo-dialog-turn-agent .topo-dialog-bubble {
  background: rgba(255, 255, 255, 0.86);
}

.topo-dialog-label {
  margin-bottom: 4px;
  color: rgba(95, 111, 134, 0.86);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topo-dialog-turn-user .topo-dialog-label {
  color: rgba(238, 246, 255, 0.95);
}

.topo-dialog-content {
  color: #182130;
  font-size: 12.5px;
  line-height: 1.48;
  word-break: break-word;
}

.topo-dialog-content code {
  padding: 1px 5px;
  border: 1px solid rgba(110, 149, 198, 0.22);
  border-radius: 6px;
  background: rgba(235, 243, 253, 0.95);
  color: #1f5fb6;
  font-size: 0.95em;
}

.topo-dialog-turn-user .topo-dialog-content {
  color: rgba(248, 251, 255, 0.98);
}

.topo-dialog-turn-user .topo-dialog-content code {
  border-color: rgba(223, 238, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
  color: #f8fbff;
}

.topo-dialog-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-style: dashed;
  border-color: rgba(145, 174, 211, 0.2);
  background: rgba(255, 255, 255, 0.78);
}

.topo-dialog-composer::before {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5db0ff, #1570e5);
  content: "";
  box-shadow: 0 0 0 5px rgba(21, 112, 229, 0.08);
}

.topo-dialog-composer .topo-dialog-content {
  color: rgba(76, 92, 116, 0.9);
  font-size: 12px;
  font-style: italic;
}

#header a img,
#header a svg {
  display: none;
}

#header button:has(a) {
  height: 34px;
  padding: 0 10px;
}

#header button:has(a[href*="upload-ospf-isis-lsdb"]) {
  border: 1px solid #99c5ff;
  color: var(--topo-blue);
  background: #fff;
}

html.dark #header button:has(a[href*="upload-ospf-isis-lsdb"]) {
  border-color: #3f74ad;
  color: #8fc5ff;
  background: #101a26;
}

#topo-logout-button {
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: #667386;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#topo-logout-button:hover {
  color: #c2414b;
  background: #fff1f2;
}

html.dark #topo-logout-button:hover {
  color: #ff9da5;
  background: #3a2026;
}

#readme-button {
  display: none;
}

#welcome-screen {
  width: min(100%, 780px);
  max-width: 780px;
  margin-top: -60px;
  gap: 14px;
}

#welcome-screen > .logo {
  display: none;
}

#message-composer {
  min-height: 84px;
  padding: 15px 18px 12px;
  border: 1px solid #d8e5f4;
  border-radius: 18px;
  background: var(--topo-surface);
  box-shadow: var(--topo-shadow);
  backdrop-filter: blur(12px);
}

html.dark #message-composer {
  border-color: #30445c;
  background: var(--topo-surface);
}

#chat-input {
  color: var(--topo-ink);
  font-size: 16px;
}

html.dark #chat-input {
  color: var(--topo-ink);
}

#chat-input::placeholder {
  color: #8994a6;
}

html.dark #chat-input::placeholder {
  color: #8291a5;
}

#chat-submit {
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--topo-blue);
  box-shadow: 0 7px 18px rgba(8, 120, 249, 0.25);
}

#chat-submit:hover:not(:disabled) {
  background: var(--topo-blue-dark);
}

#chat-submit:disabled {
  color: #fff;
  background: #9bc9ff;
  opacity: 1;
}

#upload-button {
  color: #718096;
}

html.dark #upload-button {
  color: #9caec4;
}

#starters {
  max-width: 820px;
  margin-top: 4px;
  gap: 8px;
}

#starters::before {
  flex-basis: 100%;
  margin: 3px 0 1px;
  color: #7b8798;
  content: "TRY ASKING";
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
}

#starters button {
  height: 36px;
  padding: 0 14px;
  border-color: #c9ddfb;
  color: #3977cf;
  background: rgba(239, 246, 255, 0.9);
  box-shadow: 0 1px 2px rgba(37, 93, 164, 0.04);
}

html.dark #starters button {
  border-color: #315070;
  color: #8fc5ff;
  background: rgba(20, 42, 67, 0.9);
}

#starters button:hover {
  border-color: #9fc5fb;
  color: var(--topo-blue-dark);
  background: #e4f0ff;
}

html.dark #starters button:hover {
  border-color: #4e7cac;
  color: #b8d9ff;
  background: #1a3859;
}

#starters button p {
  color: inherit;
  font-size: 13px;
  font-weight: 650;
}

.message-content code {
  padding: 2px 6px;
  border: 1px solid #c8defb;
  border-radius: 5px;
  color: var(--topo-blue-dark);
  background: var(--topo-blue-soft);
  font-size: 0.88em;
}

form:has(.topo-login-copy) {
  padding: 32px;
  border: 1px solid #dce8f5;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 50px rgba(28, 65, 112, 0.12);
  backdrop-filter: blur(12px);
}

html.dark form:has(.topo-login-copy) {
  border-color: #30445c;
  background: rgba(18, 27, 39, 0.9);
}

form:has(.topo-login-copy) h1 {
  color: var(--topo-ink);
  font-size: 27px;
  letter-spacing: -0.03em;
}

.topo-login-copy {
  margin: -12px 0 2px;
  color: var(--topo-muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.topo-landing-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 14px;
}

.topo-landing-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #d6e3f3;
  border-radius: 999px;
  color: #3569b8;
  background: rgba(245, 249, 255, 0.92);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.topo-landing-link:hover {
  transform: translateY(-1px);
  border-color: #a8c6f2;
  color: var(--topo-blue-dark);
  background: #e7f1ff;
}

.topo-landing-link:focus-visible {
  outline: 2px solid rgba(8, 120, 249, 0.28);
  outline-offset: 2px;
}

html.dark .topo-landing-link {
  border-color: #2f4d6d;
  color: #97c8ff;
  background: rgba(17, 27, 40, 0.92);
}

html.dark .topo-landing-link:hover {
  border-color: #4f7ead;
  color: #c7e1ff;
  background: #18324d;
}

form:has(.topo-login-copy) button {
  height: 46px;
  border: 0;
  color: #fff;
  background: var(--topo-blue);
  box-shadow: 0 8px 20px rgba(8, 120, 249, 0.24);
}

form:has(.topo-login-copy) button:hover {
  color: #fff;
  background: var(--topo-blue-dark);
}

#root > .grid > div:first-child > div:first-child .logo {
  width: 174px;
}

html.dark #root > .grid > div:last-child img {
  filter: brightness(0.58) saturate(1.15);
}

@media (max-width: 720px) {
  #header {
    height: 58px;
    padding: 0 12px;
  }

  #header button:has(a[href*="upload-ospf-isis-lsdb"]) {
    display: none;
  }

  #header button:has(a) {
    padding: 0 6px;
    font-size: 12px;
  }

  #topo-logout-button {
    padding: 0 5px;
    font-size: 12px;
  }

  .topo-header-brand {
    margin-left: 2px;
    font-size: 16px;
  }

  .topo-header-brand span {
    display: none;
  }

  .topo-header-brand::after {
    content: "Topolograph";
  }

  .topo-header-brand img {
    width: 30px;
    height: 30px;
  }

  #welcome-screen {
    justify-content: center;
    margin-top: -58px;
  }

  #message-composer {
    min-height: 78px;
    border-radius: 16px;
  }

  .topo-dialog-preview {
    min-height: 420px;
    padding: 8px 0 0;
  }

  .topo-dialog-frame {
    border-radius: 22px;
    padding: 13px;
  }

  .topo-dialog-bubble {
    max-width: 94%;
    padding: 9px 11px;
  }

  #starters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    width: 100%;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  #starters::-webkit-scrollbar {
    display: none;
  }

  #starters::before {
    display: none;
  }

  #starters button {
    flex: 0 0 auto;
    max-width: 84vw;
  }

  form:has(.topo-login-copy) {
    padding: 26px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
