/* ===== 14. AI-ПОМОЩНИК (виджет) ===== */

.ai-widget-root {
  position: fixed;
  right: var(--space-24);
  bottom: var(--space-24);
  z-index: 900;
}

.ai-widget-toggle {
  height: 56px;
  padding: 0 20px 0 16px;
  border-radius: 28px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  cursor: pointer;
  box-shadow: var(--shadow-elevated);
  transition: background 0.15s ease;
}
.ai-widget-toggle:hover { background: var(--color-primary-dark); }
.ai-widget-open .ai-widget-toggle { display: none; }

.ai-widget-toggle-label {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.ai-widget-panel {
  position: fixed;
  right: var(--space-24);
  bottom: 96px;
  width: 380px;
  max-width: calc(100vw - var(--space-32));
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-widget-panel[hidden] {
  display: none;
}

.ai-widget-header {
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-12) var(--space-16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.ai-widget-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 var(--space-4);
}

.ai-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  background: var(--color-bg);
}

.ai-widget-message {
  max-width: 85%;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
}
.ai-widget-message--bot {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-ink);
}
.ai-widget-message--user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
}
.ai-widget-typing {
  font-style: italic;
  color: var(--color-ink-secondary);
  background: transparent;
  border: none;
  padding: 0 var(--space-4);
}

.ai-widget-cta {
  display: inline-block;
  margin-top: var(--space-8);
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: underline;
}
.ai-widget-message--bot .ai-widget-cta { color: var(--color-primary); }

.ai-widget-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}
.ai-widget-chip {
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  border-radius: 999px;
  padding: var(--space-4) var(--space-12);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  color: var(--color-ink);
  transition: border-color 0.15s ease;
}
.ai-widget-chip:hover { border-color: var(--color-primary); }

.ai-widget-footer {
  display: flex;
  gap: var(--space-8);
  padding: var(--space-12);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.ai-widget-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: var(--space-8) var(--space-12);
  font-family: var(--font-body);
  font-size: 14px;
  max-height: 80px;
}
.ai-widget-send {
  border: none;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 0 var(--space-16);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.ai-widget-send:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 640px) {
  .ai-widget-toggle {
    width: 56px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .ai-widget-toggle-label {
    display: none;
  }
  .ai-widget-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 75vh;
    max-height: 75vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .ai-widget-root { right: var(--space-16); bottom: var(--space-16); }
}
