/* Corporate blue–white UI for gp.koderon.ru */

:root {
  --gp-blue: #0057a8;
  --gp-blue-deep: #003e7e;
  --gp-blue-ink: #002a57;
  --gp-blue-soft: #e8f2fa;
  --gp-blue-line: #b7d3ea;
  --gp-paper: #f4f7fa;
  --gp-white: #ffffff;
  --gp-ink: #1a2332;
  --gp-muted: #5a6b7d;
  --gp-ok: #2f9e6b;
  --radius: 2px;
  --maxw: 920px;
  --font: "Golos Text", Arial, Helvetica, sans-serif;
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  color: var(--gp-ink);
  background: var(--gp-paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

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

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.masthead {
  flex: 0 0 auto;
  min-height: var(--header-h);
  background: linear-gradient(180deg, var(--gp-blue-deep), var(--gp-blue));
  color: var(--gp-white);
  border-bottom: 3px solid #7eb3de;
  display: flex;
  align-items: center;
}

.masthead-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  width: 100%;
}

.brand-name {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.shell {
  flex: 1 1 auto;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.15rem 1.25rem 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  animation: rise 0.45s ease both;
}

.lead {
  flex: 0 0 auto;
  max-width: 40rem;
  color: var(--gp-muted);
  font-size: 0.98rem;
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--gp-white);
  border: 1px solid var(--gp-blue-line);
  box-shadow: 0 10px 28px -18px rgba(0, 42, 87, 0.35);
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto auto;
  height: min(70vh, 720px);
}

.workspace-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.65rem 1rem;
  background: var(--gp-blue-ink);
  color: #fff;
}

.online {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #b8d9f2;
}

.online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gp-ok);
  box-shadow: 0 0 0 3px rgba(47, 158, 107, 0.25);
  animation: pulse 1.8s ease infinite;
}

.messages {
  min-height: 0;
  padding: 1rem 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: linear-gradient(180deg, #f7fbfe, var(--gp-white) 28%);
  -webkit-overflow-scrolling: touch;
}

.msg {
  max-width: min(88%, 620px);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  animation: pop 0.25s ease;
}

.msg.bot {
  align-self: flex-start;
  background: var(--gp-blue-soft);
  border: 1px solid var(--gp-blue-line);
  color: var(--gp-ink);
}

.msg.user {
  align-self: flex-end;
  background: var(--gp-blue);
  color: #fff;
}

.msg .meta {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 0.28rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0;
  border-top: 1px solid var(--gp-blue-line);
  background: #f9fbfd;
}

.actions.hidden { display: none; }

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: stretch;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--gp-blue-line);
  background: #f9fbfd;
}

.composer input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--gp-blue-line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font: inherit;
  outline: none;
  background: #fff;
  color: var(--gp-ink);
}

.composer input:focus {
  border-color: var(--gp-blue);
  box-shadow: 0 0 0 3px rgba(0, 87, 168, 0.15);
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn-primary {
  border: 0;
  background: var(--gp-blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--gp-blue-deep);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.btn-secondary {
  border: 1px solid var(--gp-blue-line);
  background: #fff;
  color: var(--gp-blue-ink);
}

.btn-secondary:hover {
  border-color: var(--gp-blue);
}

.btn-primary.hidden,
.btn-secondary.hidden { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 720px) {
  .masthead-inner,
  .shell {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .brand-name { font-size: 1.08rem; }

  .workspace {
    height: auto;
    min-height: min(62vh, 560px);
    grid-template-rows: auto minmax(180px, 1fr) auto auto;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer .btn-primary {
    width: 100%;
    min-height: 48px;
  }

  .msg { max-width: 94%; }
}

@media (min-width: 921px) {
  .workspace {
    height: calc(100dvh - var(--header-h) - 3px - 1.15rem - 1.5rem - 3.2rem);
    max-height: 760px;
  }
}
