/* SimDev portfolio assistant — isolated component styles */
.ai-agent {
  --ai-teal: var(--c-primary, #19c2c1);
  --ai-teal-dark: var(--c-primary-dk, #13a09f);
  --ai-navy: var(--c-brand, #0d1021);
  --ai-purple: #7657f6;
  --ai-panel: rgba(255, 255, 255, .97);
  --ai-muted: #667085;
  position: fixed;
  right: clamp(16px, 2vw, 30px);
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1200;
  font-family: var(--f-sans, 'Inter', sans-serif);
  isolation: isolate;
}

.ai-agent [hidden] {
  display: none !important;
}

.ai-agent > input[name="__RequestVerificationToken"] {
  display: none;
}

.ai-agent__launcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 196px;
  min-height: 52px;
  padding: 7px 13px 7px 8px;
  color: var(--ai-navy);
  text-align: left;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(25,194,193,.34);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(24,47,70,.14), 0 2px 8px rgba(25,194,193,.08);
  cursor: pointer;
  overflow: hidden;
}

.ai-agent__launcher:hover,
.ai-agent__launcher:focus-visible {
  color: var(--ai-navy);
  transform: translateY(-2px);
  border-color: var(--ai-teal);
  box-shadow: 0 16px 36px rgba(24,47,70,.18), 0 3px 10px rgba(25,194,193,.14);
}

.ai-agent__launcher-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 3px;
  color: #fff;
  background: #0d1021;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(13,16,33,.18), 0 0 0 2px rgba(25,194,193,.18);
}

.ai-agent__launcher-icon img,
.ai-agent__brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ai-agent__launcher-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.ai-agent__launcher-copy strong {
  color: var(--ai-navy);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
}

.ai-agent__launcher-copy small {
  margin-top: 3px;
  color: #667085;
  font-size: 10px;
  font-weight: 500;
}

.ai-agent__pulse {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: #4ade80;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74,222,128,.5);
  animation: ai-agent-pulse 2.2s infinite;
}

.ai-agent__panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(590px, calc(100dvh - 92px));
  max-height: calc(100vh - 92px);
  margin-bottom: 12px;
  background: var(--ai-panel);
  border: 1px solid rgba(25,194,193,.24);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(24,47,70,.20), 0 4px 14px rgba(24,47,70,.08);
  overflow: hidden;
  transform-origin: right bottom;
  animation: ai-agent-open .22s ease-out;
}

.ai-agent__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 11px 13px 10px 15px;
  color: var(--ai-navy);
  background:
    radial-gradient(circle at 88% -40%, rgba(118,87,246,.14), transparent 56%),
    linear-gradient(135deg, rgba(25,194,193,.13), rgba(255,255,255,.96) 58%);
  border-bottom: 1px solid rgba(25,194,193,.18);
}

.ai-agent__identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ai-agent__identity > span:last-child {
  display: flex;
  flex-direction: column;
}

.ai-agent__identity strong {
  color: var(--ai-navy);
  font-size: 13px;
  font-weight: 700;
}

.ai-agent__identity small {
  margin-top: 3px;
  color: #667085;
  font-size: 10px;
}

.ai-agent__avatar,
.ai-agent__message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(145deg, var(--ai-teal), #20b7d4);
  border-radius: 10px;
}

.ai-agent__brand-mark {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 3px;
  background: #0d1021;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(13,16,33,.16), 0 0 0 2px rgba(25,194,193,.16);
}

.ai-agent__avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
  box-shadow: 0 5px 15px rgba(25,194,193,.28);
}

.ai-agent__online-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 9px;
  height: 9px;
  background: #4ade80;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(13,16,33,.18);
}

.ai-agent__icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #667085;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(13,16,33,.08);
  border-radius: 9px;
  cursor: pointer;
}

.ai-agent__icon-button:hover {
  color: var(--ai-navy);
  background: #fff;
}

.ai-agent__header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ai-agent__messages {
  flex: 1 1 auto;
  padding: 18px 16px 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(25,194,193,.10), transparent 38%),
    radial-gradient(circle at 0 100%, rgba(118,87,246,.06), transparent 34%),
    #fbfdff;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.ai-agent__new-messages {
  align-self: center;
  z-index: 2;
  margin: -43px 0 10px;
  padding: 7px 11px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  background: var(--ai-teal-dark);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 5px 15px rgba(13,16,33,.2);
  cursor: pointer;
}

.ai-agent__new-messages i { margin-left: 5px; }

body.ai-agent-focus-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.ai-agent--expanded::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(232, 245, 250, .72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.ai-agent--expanded {
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(76px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.ai-agent--expanded .ai-agent__panel {
  width: min(860px, calc(100vw - 40px));
  height: min(760px, calc(100dvh - 96px));
  max-height: calc(100vh - 96px);
  margin: 0;
  pointer-events: auto;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(24,47,70,.25), 0 0 0 1px rgba(25,194,193,.12);
}

.ai-agent--expanded .ai-agent__messages { padding: 24px clamp(18px, 5vw, 54px) 18px; }
.ai-agent--expanded .ai-agent__bubble { max-width: min(76%, 620px); }
.ai-agent--expanded .ai-agent__suggestions,
.ai-agent--expanded .ai-agent__composer,
.ai-agent--expanded .ai-agent__notice { width: min(720px, calc(100% - 28px)); align-self: center; }

.ai-agent__message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.ai-agent__message--visitor {
  justify-content: flex-end;
}

.ai-agent__message-avatar {
  width: 32px;
  height: 28px;
  flex: 0 0 32px;
  margin-bottom: 2px;
  font-size: 7px;
  letter-spacing: .04em;
  border-radius: 9px;
}

.ai-agent__bubble {
  max-width: 82%;
  padding: 11px 13px;
  color: #344054;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #fff;
  border: 1px solid #e7eaf0;
  border-radius: 5px 12px 12px 12px;
  box-shadow: 0 3px 10px rgba(13,16,33,.045);
}

.ai-agent__message--visitor .ai-agent__bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--ai-teal), #16b9c6);
  border: 0;
  border-radius: 12px 12px 5px 12px;
  box-shadow: 0 5px 14px rgba(19,160,159,.18);
}

.ai-agent__message--error .ai-agent__bubble {
  color: #9b1c1c;
  background: #fff5f5;
  border-color: #fecaca;
}

.ai-agent__booking-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.ai-agent__booking-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  color: #075f63;
  font-size: 11px;
  font-weight: 700;
  background: #e5fbfa;
  border: 1px solid #b9efec;
  border-radius: 999px;
}

.ai-agent__typing {
  display: inline-flex;
  gap: 4px;
  padding: 3px 2px;
}

.ai-agent__typing i {
  width: 6px;
  height: 6px;
  background: #98a2b3;
  border-radius: 50%;
  animation: ai-agent-typing 1.1s infinite ease-in-out;
}

.ai-agent__typing i:nth-child(2) { animation-delay: .14s; }
.ai-agent__typing i:nth-child(3) { animation-delay: .28s; }

.ai-agent__suggestions {
  display: flex;
  gap: 7px;
  padding: 10px 13px 5px;
  background: rgba(255,255,255,.94);
  border-top: 1px solid rgba(24,47,70,.06);
  overflow-x: auto;
  scrollbar-width: none;
}

.ai-agent__suggestions::-webkit-scrollbar { display: none; }

.ai-agent__suggestions button {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #475467;
  font-size: 10px;
  font-weight: 600;
  background: #f6fbfc;
  border: 1px solid rgba(25,194,193,.20);
  border-radius: 8px;
  cursor: pointer;
}

.ai-agent__suggestions button:hover {
  color: #075f63;
  background: #e8fbfa;
  border-color: var(--ai-teal);
}

.ai-agent__suggestions button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.ai-agent__composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin: 8px 12px 4px;
  padding: 7px 7px 7px 12px;
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 11px;
  box-shadow: 0 3px 12px rgba(13,16,33,.055);
}

.ai-agent__composer:focus-within {
  border-color: var(--ai-teal);
  box-shadow: 0 0 0 3px rgba(25,194,193,.13);
}

.ai-agent__composer textarea {
  width: 100%;
  min-height: 34px;
  max-height: 92px;
  padding: 7px 0 5px;
  color: #1d2939;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
}

.ai-agent__composer textarea::placeholder { color: #98a2b3; }

.ai-agent__send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  color: #fff;
  background: var(--ai-teal);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}

.ai-agent__send:hover { transform: translateY(-1px); }
.ai-agent__send:disabled { opacity: .52; cursor: wait; transform: none; }

.ai-agent__notice {
  margin: 3px 12px 9px;
  color: #98a2b3;
  font-size: 9px;
  line-height: 1.35;
  text-align: center;
}

@keyframes ai-agent-open {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ai-agent-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); }
  70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

@keyframes ai-agent-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.ai-agent__role-fit {
  display: block;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid rgba(20, 184, 166, .25);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(25,194,193,.06), rgba(118,87,246,.04));
  font-size: 12px;
  line-height: 1.45;
}

.ai-agent__role-fit-label { display: block; margin-top: 9px; font-weight: 700; color: #0f766e; }
.ai-agent__role-fit ul { margin: 4px 0 0; padding-left: 17px; }
.ai-agent__role-fit li { margin: 4px 0; }
.ai-agent__role-fit a { display: inline-block; margin: 3px 4px 0 0; font-weight: 700; color: #0f766e; }

/* The portfolio theme toggle adds/removes body.theme-dark. The assistant follows it directly. */
.ai-agent__panel,
.ai-agent__launcher,
.ai-agent__header,
.ai-agent__messages,
.ai-agent__bubble,
.ai-agent__suggestions,
.ai-agent__suggestions button,
.ai-agent__composer,
.ai-agent__composer textarea,
.ai-agent__notice,
.ai-agent__icon-button,
.ai-agent__role-fit {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

body.theme-dark .ai-agent {
  --ai-navy: #f5f7ff;
  --ai-panel: rgba(15, 23, 42, .98);
  --ai-muted: #a9b6ce;
}

body.theme-dark .ai-agent__launcher {
  background: rgba(17, 27, 48, .96);
  border-color: rgba(45, 212, 191, .35);
  box-shadow: 0 14px 34px rgba(0,0,0,.34), 0 2px 9px rgba(45,212,191,.09);
}

body.theme-dark .ai-agent__launcher-copy small,
body.theme-dark .ai-agent__identity small,
body.theme-dark .ai-agent__notice {
  color: var(--ai-muted);
}

body.theme-dark .ai-agent__online-dot { border-color: #15213a; }

body.theme-dark .ai-agent__header {
  background: radial-gradient(circle at 88% -40%, rgba(118,87,246,.27), transparent 58%), linear-gradient(135deg, #15213a, #101827 68%);
  border-bottom-color: rgba(45,212,191,.20);
}

body.theme-dark .ai-agent__icon-button {
  color: #c8d3e8;
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
}

body.theme-dark .ai-agent__icon-button:hover { color: #fff; background: rgba(255,255,255,.12); }

body.theme-dark .ai-agent__messages {
  background: radial-gradient(circle at 100% 0, rgba(25,194,193,.11), transparent 38%), radial-gradient(circle at 0 100%, rgba(118,87,246,.10), transparent 34%), #111a2c;
}

body.theme-dark .ai-agent__bubble {
  color: #e4ebf8;
  background: #18243a;
  border-color: rgba(174,196,224,.15);
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
}

body.theme-dark .ai-agent__message--error .ai-agent__bubble {
  color: #fecaca;
  background: rgba(127,29,29,.28);
  border-color: rgba(248,113,113,.42);
}

body.theme-dark .ai-agent__suggestions {
  background: #101827;
  border-top-color: rgba(255,255,255,.06);
}

body.theme-dark .ai-agent__suggestions button {
  color: #c8d3e8;
  background: rgba(255,255,255,.045);
  border-color: rgba(45,212,191,.20);
}

body.theme-dark .ai-agent__suggestions button:hover { color: #8ff5ed; background: rgba(45,212,191,.10); }

body.theme-dark .ai-agent__composer {
  background: #111a2c;
  border-color: rgba(174,196,224,.18);
  box-shadow: 0 3px 12px rgba(0,0,0,.20);
}

body.theme-dark .ai-agent__composer textarea { color: #f5f7ff; }
body.theme-dark .ai-agent__composer textarea::placeholder { color: #8290aa; }

body.theme-dark .ai-agent__role-fit {
  color: #d7e1f2;
  border-color: rgba(45,212,191,.28);
  background: linear-gradient(135deg, rgba(25,194,193,.10), rgba(118,87,246,.10));
}

body.theme-dark .ai-agent__role-fit-label,
body.theme-dark .ai-agent__role-fit a,
body.theme-dark .ai-agent__booking-links a { color: #8ff5ed; }

body.theme-dark .ai-agent__booking-links a {
  background: rgba(25,194,193,.12);
  border-color: rgba(45,212,191,.26);
}

body.theme-dark .ai-agent--expanded::before {
  background: rgba(5, 10, 22, .76);
}

@media (max-width: 600px) {
  .ai-agent {
    right: 12px;
    bottom: 12px;
  }

  .ai-agent__launcher {
    min-width: 0;
    min-height: 56px;
    padding: 7px;
  }

  .ai-agent__launcher-copy,
  .ai-agent__pulse {
    display: none;
  }

  .ai-agent__panel {
    width: calc(100vw - 24px);
    height: min(650px, calc(100dvh - 88px));
    max-height: calc(100vh - 88px);
    margin-bottom: 10px;
    border-radius: 18px;
  }

  .ai-agent--expanded {
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .ai-agent--expanded .ai-agent__panel {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 16px;
  }

  .ai-agent--expanded .ai-agent__messages { padding: 18px 14px 12px; }
  .ai-agent--expanded .ai-agent__bubble { max-width: 84%; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-agent__panel,
  .ai-agent__pulse,
  .ai-agent__typing i {
    animation: none;
  }
}
