/* CODE AGENT INSTRUCTIONS -- apps/product-ui/styles.css */

:root {
  color-scheme: light;
  --ink: #090b0f;
  --muted: #93969c;
  --blue: #096cf2;
  --panel: rgba(255, 255, 255, 0.9);
  --selected: rgba(231, 232, 234, 0.92);
  --shadow: 0 16px 48px rgba(25, 33, 48, 0.09);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, 0.98), transparent 52%),
    linear-gradient(145deg, #fbfbfc 0%, #f6f7f8 58%, #fdfdfd 100%);
  color: var(--ink);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(9, 108, 242, 0.24);
  outline-offset: 3px;
}

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

.site-filing {
  text-align: center;
  font-size: 12px;
}

.site-filing a {
  color: #72767d;
  text-decoration: none;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 920px);
  height: 100dvh;
  min-height: 560px;
  margin: 0 auto;
  padding: max(39px, 7.7dvh, env(safe-area-inset-top)) 39px max(49px, env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 100px;
  align-items: center;
  gap: 42px;
}

.brand,
.new-session {
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.brand img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: contain;
}

.new-session svg {
  width: 52px;
  height: 52px;
}

.mode-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 495px);
  margin: 0 auto;
  padding: 8px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-width: 0;
  min-height: 84px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  font-weight: 560;
  letter-spacing: -0.02em;
}

.mode-button.is-active {
  background: linear-gradient(135deg, #f0f0f1 0%, var(--selected) 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.92);
}

.mode-button svg {
  width: 40px;
  height: 40px;
}

svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.workspace {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 44px 24px 30px;
}

.conversation {
  display: grid;
  gap: 18px;
  align-content: end;
  min-height: 100%;
}

.message {
  max-width: min(76%, 620px);
  padding: 15px 19px;
  border-radius: 24px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: message-in 220ms ease both;
}

.message-user {
  justify-self: end;
  border-bottom-right-radius: 7px;
  background: var(--blue);
  color: white;
}

.message-assistant {
  justify-self: start;
  border-bottom-left-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 26px rgba(24, 32, 50, 0.08);
}

.message.is-pending .message-content::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.15em;
  background: var(--blue);
  animation: cursor-blink 900ms steps(1) infinite;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.translation-section + .translation-section {
  margin-top: 8px;
}

.pronunciation-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  white-space: normal;
}

.pronunciation-note {
  font-size: 0.9em;
}

.pronunciation-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.pronunciation-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-user .speak-button,
.message-user .audio-fallback {
  color: white;
}

.speak-button,
.audio-fallback {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.composer-region {
  position: relative;
  margin-inline: 31px;
}

.options-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  left: 0;
  display: grid;
  gap: 16px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 54px rgba(27, 35, 51, 0.13);
  backdrop-filter: blur(22px);
  animation: panel-in 160ms ease both;
}

.option-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 9px 13px;
  border: 0;
  border-radius: 15px;
  background: #f2f3f5;
  color: var(--ink);
  font-weight: 650;
}

.option-button svg {
  width: 22px;
  height: 22px;
}

.language-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.language-options label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-options select,
.language-options button {
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: #f2f3f5;
  color: var(--ink);
}

.language-options select {
  width: 100%;
  padding: 0 30px 0 12px;
}

.language-options button {
  width: 38px;
  font-size: 19px;
}

.composer {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: end;
  gap: 14px;
  min-height: 112px;
  padding: 20px 35px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 58px;
  background: var(--panel);
  box-shadow: 0 20px 58px rgba(28, 36, 53, 0.11);
  backdrop-filter: blur(24px);
}

.composer.has-primary-action {
  grid-template-columns: 56px minmax(0, 1fr) 56px 96px;
  gap: 6px;
  padding-right: 16px;
}

.app-shell[data-mode="chat"] .composer textarea {
  padding-left: 18px;
}

.composer textarea {
  width: 100%;
  max-height: 140px;
  min-height: 56px;
  padding: 15px 9px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 36px;
  line-height: 42px;
}

.composer textarea::placeholder {
  color: #96999f;
  opacity: 1;
}

.composer-action,
.primary-action {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}

.composer-action svg {
  width: 37px;
  height: 37px;
}

.primary-action {
  width: 72px;
  height: 72px;
  background: var(--blue);
  color: white;
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.primary-action svg {
  width: 40px;
  height: 40px;
}

.primary-action:active {
  transform: scale(0.94);
}

.primary-action:disabled,
.composer-action:disabled {
  cursor: default;
  opacity: 0.42;
}

.options-trigger[aria-expanded="true"] svg {
  transform: rotate(45deg);
}

.options-trigger svg {
  transition: transform 150ms ease;
}

.composer-action.is-recording,
.primary-action.is-recording {
  background: #ffebe9;
  color: #d42f20;
  animation: recording-pulse 1.3s ease-in-out infinite;
}

.status {
  min-height: 18px;
  margin: 8px 20px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.status.is-idle {
  visibility: hidden;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.99);
  }
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@keyframes recording-pulse {
  50% {
    background: #ffd8d3;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: max(64px, 7.7dvh, env(safe-area-inset-top)) 19px max(7px, env(safe-area-inset-bottom));
  }

  .topbar {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 17px;
  }

  .brand,
  .new-session {
    width: 46px;
    height: 46px;
  }

  .brand img {
    width: 44px;
    height: 44px;
  }

  .new-session svg {
    width: 32px;
    height: 32px;
  }

  .mode-switcher {
    width: min(100%, 226px);
    padding: 4px;
  }

  .mode-button {
    min-height: 38px;
    gap: 7px;
    padding: 0 9px;
    font-size: 15.5px;
  }

  .mode-button svg {
    width: 25px;
    height: 25px;
  }

  .workspace {
    padding: 28px 2px 22px;
  }

  .composer-region {
    margin-inline: 13px;
  }

  .message {
    max-width: 87%;
  }

  .composer {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 4px;
    min-height: 52px;
    padding: 7px 8px;
    border-radius: 30px;
  }

  .composer.has-primary-action {
    grid-template-columns: 38px minmax(0, 1fr) 38px 38px;
    gap: 4px;
    padding: 7px 8px;
  }

  .app-shell[data-mode="chat"] .composer textarea {
    padding-left: 6px;
  }

  .composer textarea {
    min-height: 38px;
    padding: 7px 6px;
    font-size: 19px;
    line-height: 24px;
  }

  .composer-action,
  .primary-action {
    width: 38px;
    height: 38px;
  }

  .primary-action {
    width: 36px;
    height: 36px;
  }

  .composer-action svg {
    width: 30px;
    height: 30px;
  }

  .primary-action svg {
    width: 23px;
    height: 23px;
  }

  .options-panel {
    border-radius: 24px;
  }
}

@media (max-width: 370px) {
  .mode-button span {
    display: none;
  }

  .language-options {
    grid-template-columns: 1fr;
  }

  .language-options button {
    justify-self: center;
    transform: rotate(90deg);
  }
}

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

.translation-alternative { margin-top: 8px; }
