/* AI-консультант OpticTrend — ч/б/серый стиль */

.assistant-widget {
  --assistant-bg: #ffffff;
  --assistant-border: #e6e6e6;
  --assistant-primary: #1d1d1b;
  --assistant-secondary: #f4f4f4;
  --assistant-text: #1d1d1b;
  --assistant-muted: #6b6b6b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
}

.assistant-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: 48px;
  border-radius: 999px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.assistant-toggle:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.assistant-toggle__label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.3;
}
.assistant-toggle__line1 {
  font-weight: 600;
}
.assistant-toggle__line2 {
  font-size: 0.85em;
  font-weight: 500;
  opacity: 0.95;
}
.assistant-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.assistant-toggle__icon svg {
  flex-shrink: 0;
}

.assistant-panel {
  position: absolute;
  bottom: 78px;
  right: 0;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--assistant-bg);
  border: 1px solid var(--assistant-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.assistant-panel.is-mobile {
  bottom: 0;
  right: 0;
  left: 0;
  width: 100%;
  max-width: none;
  height: 90vh;
  max-height: 90vh;
  border-radius: 16px 16px 0 0;
}

.assistant-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--assistant-border);
  background: var(--assistant-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.assistant-header__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--assistant-text);
}
.assistant-close {
  width: 40px;
  height: 40px;
  min-height: 44px;
  min-width: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  color: var(--assistant-muted);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.assistant-close:hover { background: var(--assistant-secondary); color: var(--assistant-text); }

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.assistant-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
}
.assistant-msg--user {
  align-self: flex-end;
  background: var(--assistant-primary);
  color: #fff;
}
.assistant-msg--bot {
  align-self: flex-start;
  background: var(--assistant-secondary);
  color: var(--assistant-text);
  border: 1px solid var(--assistant-border);
}
.assistant-msg--bot p { margin: 0 0 0.5em; }
.assistant-msg--bot p:last-child { margin-bottom: 0; }

.assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.assistant-chip {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--assistant-border);
  background: var(--assistant-bg);
  color: var(--assistant-text);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.assistant-chip:hover {
  background: var(--assistant-secondary);
  border-color: #d0d0d0;
}

.assistant-products {
  margin-top: 12px;
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.assistant-product {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: 160px;
  min-width: 160px;
  padding: 10px;
  border: 1px solid var(--assistant-border);
  border-radius: 10px;
  background: #fafafa;
  scroll-snap-align: start;
}
.assistant-product__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}
.assistant-product__img--placeholder {
  background: var(--assistant-border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px;
  aspect-ratio: 1;
}
.assistant-product__main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-top: 8px; }
.assistant-product__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--assistant-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.assistant-product__title--link {
  color: var(--assistant-primary);
  text-decoration: none;
}
.assistant-product__title--link:hover {
  text-decoration: underline;
}
.assistant-product__price { font-size: 14px; font-weight: 700; color: var(--assistant-primary); margin-bottom: 6px; }
.assistant-product__meta { font-size: 11px; color: var(--assistant-muted); margin-bottom: 6px; }
.assistant-product__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}
.assistant-product__btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--assistant-border);
  background: var(--assistant-bg);
  color: var(--assistant-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s;
}
.assistant-product__btn:hover { background: var(--assistant-secondary); }
.assistant-product__btn--primary {
  background: var(--assistant-primary);
  color: #fff;
  border-color: var(--assistant-primary);
}
.assistant-product__btn--primary:hover { background: #2b2b2b; }

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.assistant-suggestion {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--assistant-border);
  background: var(--assistant-bg);
  color: var(--assistant-text);
  border-radius: 16px;
  cursor: pointer;
}
.assistant-suggestion:hover { background: var(--assistant-secondary); }

.assistant-input-row {
  padding: 12px 16px;
  border-top: 1px solid var(--assistant-border);
  background: var(--assistant-bg);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.assistant-input {
  flex: 1;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--assistant-border);
  border-radius: 10px;
  resize: none;
  font-family: inherit;
}
.assistant-input:focus {
  outline: none;
  border-color: var(--assistant-primary);
}
.assistant-send {
  min-width: 48px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--assistant-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.assistant-send:hover { background: #2b2b2b; }
.assistant-send:disabled { opacity: 0.6; cursor: not-allowed; }

.assistant-loader {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--assistant-muted);
}
.assistant-loader::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--assistant-border);
  border-top-color: var(--assistant-primary);
  border-radius: 50%;
  animation: assistant-spin 0.7s linear infinite;
}
@keyframes assistant-spin { to { transform: rotate(360deg); } }

@media (max-width: 767px) {
  .assistant-widget { bottom: 12px; right: 12px; }
  .assistant-toggle { padding: 10px 16px; font-size: 14px; min-height: 44px; }
  .assistant-toggle__icon svg { width: 18px; height: 18px; }
  .assistant-product__btn { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .assistant-chip { min-height: 44px; padding: 10px 14px; font-size: 14px; }
}
