/* ДГ 112 – ИСОДЗ Асистент | chatbot.css */

:root {
  --dg-accent:       #1a73e8;
  --dg-accent-dark:  #0d47a1;
  --dg-accent-light: #d2e3fc;
  --dg-surface:      #ffffff;
  --dg-bg:           #f0f4f8;
  --dg-border:       #d0dcea;
  --dg-text:         #1d2c3c;
  --dg-muted:        #5a6a7a;
  --dg-user-bg:      #1a73e8;
  --dg-radius:       18px;
  --dg-shadow:       0 8px 40px rgba(26,115,232,.18), 0 2px 8px rgba(0,0,0,.08);
}

/* ── Launcher button ── */
#dg112-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dg-accent), var(--dg-accent-dark));
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26,115,232,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  z-index: 99999;
}
#dg112-launcher:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(26,115,232,.55); }
#dg112-launcher svg  { width: 28px; height: 28px; fill: #fff; pointer-events: none; }

/* unread badge */
#dg112-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: #e53935;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: sans-serif;
  opacity: 0;
  transition: opacity .2s;
}
#dg112-badge.show { opacity: 1; }

/* ── Chat window ── */
#dg112-window {
  position: fixed;
  bottom: 102px;
  right: 28px;
  width: 390px;
  max-width: calc(100vw - 40px);
  height: 580px;
  max-height: calc(100vh - 140px);
  background: var(--dg-surface);
  border-radius: var(--dg-radius);
  box-shadow: var(--dg-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  transform-origin: bottom right;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
}
#dg112-window.dg-hidden {
  transform: scale(.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
}

/* ── Header ── */
.dg-header {
  background: linear-gradient(135deg, #1a73e8, #0d47a1);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.dg-hav {
  width: 42px; height: 42px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.dg-hinfo      { flex: 1; }
.dg-htitle     { color: #fff; font-weight: 800; font-size: 14.5px; line-height: 1.2; }
.dg-hsub       { color: rgba(255,255,255,.72); font-size: 11.5px; margin-top: 2px; }
.dg-online     { width: 8px; height: 8px; background: #4cff91; border-radius: 50%;
                  box-shadow: 0 0 6px #4cff91; flex-shrink: 0; }
.dg-close-btn  { background: none; border: none; cursor: pointer; padding: 4px;
                  color: rgba(255,255,255,.7); font-size: 20px; line-height: 1;
                  transition: color .15s; }
.dg-close-btn:hover { color: #fff; }

/* ── Messages ── */
#dg112-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}
#dg112-messages::-webkit-scrollbar { width: 4px; }
#dg112-messages::-webkit-scrollbar-thumb { background: #c8d8f0; border-radius: 4px; }

.dg-row        { display: flex; align-items: flex-end; gap: 7px; }
.dg-row.dg-usr { flex-direction: row-reverse; }

@keyframes dg-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dg-row { animation: dg-pop .28s ease forwards; }

.dg-av {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--dg-accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.dg-row.dg-usr .dg-av { background: var(--dg-accent); }

.dg-bubble {
  max-width: 83%;
  padding: 9px 13px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--dg-text);
  background: var(--dg-surface);
  border: 1px solid var(--dg-border);
  word-break: break-word;
}
.dg-bubble strong { color: var(--dg-accent-dark); }
.dg-bubble ul  { padding-left: 17px; margin: 5px 0; }
.dg-bubble li  { margin: 2px 0; }
.dg-bubble a   { color: var(--dg-accent); }

.dg-row.dg-bot .dg-bubble { border-bottom-left-radius: 4px; }
.dg-row.dg-usr .dg-bubble {
  background: var(--dg-user-bg);
  color: #fff;
  border-color: var(--dg-user-bg);
  border-bottom-right-radius: 4px;
}

/* typing */
.dg-typing {
  display: flex; gap: 5px;
  padding: 11px 15px;
  background: var(--dg-surface);
  border: 1px solid var(--dg-border);
  border-radius: 15px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.dg-typing span {
  width: 7px; height: 7px;
  background: #93a8c4; border-radius: 50%;
  animation: dg-bounce 1.2s infinite;
}
.dg-typing span:nth-child(2) { animation-delay: .2s; }
.dg-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dg-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* chips */
.dg-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 3px 0 5px;
}
.dg-chip {
  padding: 5px 12px;
  background: var(--dg-accent-light);
  color: var(--dg-accent-dark);
  border: 1px solid #b3cef6;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  font-family: inherit;
}
.dg-chip:hover { background: #c2d8fb; transform: translateY(-1px); }

/* ── Input area ── */
.dg-inputarea {
  padding: 10px 12px 13px;
  border-top: 1px solid var(--dg-border);
  background: var(--dg-surface);
  flex-shrink: 0;
}
.dg-inputrow { display: flex; gap: 8px; align-items: flex-end; }

#dg112-input {
  flex: 1;
  border: 1.5px solid var(--dg-border);
  border-radius: 20px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--dg-text);
  background: var(--dg-bg);
  outline: none;
  resize: none;
  max-height: 90px;
  transition: border-color .2s;
  line-height: 1.4;
}
#dg112-input:focus { border-color: var(--dg-accent); background: #fff; }

#dg112-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--dg-accent);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .15s;
}
#dg112-send:hover   { background: var(--dg-accent-dark); transform: scale(1.06); }
#dg112-send:disabled{ background: #c5d5ea; cursor: not-allowed; transform: none; }
#dg112-send svg     { width: 17px; height: 17px; fill: #fff; }

.dg-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--dg-muted);
  padding: 0 0 4px;
  margin-top: 6px;
}
.dg-footer a { color: var(--dg-muted); }
