:root {
  --om-ai-bg: #f3f6fb;
  --om-ai-card: #ffffff;
  --om-ai-border: #d7e0ee;
  --om-ai-accent: #1f5fbf;
  --om-ai-accent-soft: #e5eefc;
  --om-ai-accent-dark: #174b95;
  --om-ai-text: #0f1a2b;
  --om-ai-muted: #5b677a;
  --om-ai-user: #e8f1ff;
  --om-ai-bot: #f7f8fb;
}

.om-ai {
  --om-ai-bg: #f3f6fb;
  --om-ai-card: #ffffff;
  --om-ai-border: #d7e0ee;
  --om-ai-accent: #1f5fbf;
  --om-ai-accent-soft: #e5eefc;
  --om-ai-accent-dark: #174b95;
  --om-ai-text: #0f1a2b;
  --om-ai-muted: #5b677a;
  --om-ai-user: #e8f1ff;
  --om-ai-bot: #f7f8fb;

  background: var(--om-ai-card);
  border: 1px solid var(--om-ai-border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 30, 60, 0.08);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.om-ai__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: linear-gradient(135deg, #eef4ff 0%, #f8fbff 100%);
  border-radius: 10px;
}

.om-ai__title {
  font-weight: 700;
  color: var(--om-ai-text);
  letter-spacing: 0.01em;
}

.om-ai__badge {
  background: var(--om-ai-accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.om-ai__messages {
  background: var(--om-ai-bg);
  border: 1px solid var(--om-ai-border);
  border-radius: 12px;
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.om-ai__message {
  background: var(--om-ai-bot);
  color: var(--om-ai-text);
  border: 1px solid var(--om-ai-border);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
}

.om-ai__message--user {
  align-self: flex-end;
  background: var(--om-ai-user);
  border-color: #c9dcff;
}

.om-ai__message--meta {
  font-size: 12px;
  color: var(--om-ai-muted);
  border: none;
  background: transparent;
  padding: 0;
}

.om-ai__input {
  display: flex;
  gap: 8px;
  align-items: center;
}

.om-ai__input input {
  flex: 1;
  border: 1px solid var(--om-ai-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--om-ai-text);
  background: #ffffff;
}

.om-ai__input input:focus {
  outline: 2px solid rgba(31, 95, 191, 0.2);
  border-color: var(--om-ai-accent);
}

.om-ai__send {
  all: unset;
  background: var(--om-ai-accent);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.om-ai__send:hover {
  background: var(--om-ai-accent-dark);
  transform: translateY(-1px);
}

.om-ai__send:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.om-ai__hint {
  font-size: 12px;
  color: var(--om-ai-muted);
}

.om-ai__admin-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
}

.om-ai__label {
  font-size: 12px;
  color: var(--om-ai-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.om-ai__select {
  border: 1px solid var(--om-ai-border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  background: #ffffff;
  color: var(--om-ai-text);
}

.om-ai-bubble {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999998;
  --om-ai-bubble-offset: 0px;
}

.om-ai-bubble__button {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid #c7d7f4 !important;
  background: #e8f1ff !important;
  color: #1f2b4e !important;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 30, 60, 0.18);
}

.om-ai-bubble__button:hover {
  background: #dbe9ff !important;
}

@keyframes om-ai-bubble-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 10px 24px rgba(15, 30, 60, 0.18);
  }

  45% {
    transform: scale(1.06);
    box-shadow: 0 14px 30px rgba(15, 30, 60, 0.24);
  }

  70% {
    transform: scale(0.985);
  }
}

.om-ai-bubble__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.om-ai-bubble__overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 30, 0.35);
  z-index: 999998;
}

.om-ai-bubble__drawer {
  position: fixed;
  right: 18px;
  bottom: 90px;
  width: min(420px, 92vw);
  height: min(640px, 85vh);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 30, 60, 0.25);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.om-ai-bubble__overlay[hidden],
.om-ai-bubble__drawer[hidden] {
  display: none !important;
}

.om-ai-bubble__header {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--om-ai-border);
  background: linear-gradient(135deg, #eef4ff 0%, #f8fbff 100%);
  position: sticky;
  top: 0;
  z-index: 2;
}

.om-ai-bubble__title {
  font-weight: 700;
  color: var(--om-ai-text);
}

.om-ai-bubble__close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--om-ai-muted);
}

.om-ai-bubble__drawer .om-ai {
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 12px;
  flex: 1;
}

.om-ai-bubble__drawer .om-ai__header {
  display: none;
}

.om-ai-bubble__drawer .om-ai__input {
  margin-top: 14px;
}

@media (max-width: 768px) {
  .om-ai-bubble__drawer .om-ai__messages {
    min-height: 220px;
  }
}

body.om-ai-bubble-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .om-ai {
    padding: 12px;
  }

  .om-ai__messages {
    max-height: 260px;
  }

  .om-ai__send {
    padding: 10px 12px;
  }

  .om-ai__admin-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .om-ai-bubble__drawer {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding-top: 56px;
  }

  .om-ai-bubble__header {
    padding-top: calc(12px + env(safe-area-inset-top));
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    right: 0;
    z-index: 1000000;
    background: #ffffff;
  }

  .om-ai-bubble__button {
    right: 16px;
    bottom: 16px;
  }

  .om-ai-bubble {
    position: fixed !important;
    inset: auto -8px calc(16px + env(safe-area-inset-bottom) + var(--om-ai-bubble-offset)) auto !important;
    display: block !important;
    width: auto !important;
    max-width: none !important;
    left: auto !important;
    right: -8px !important;
    bottom: calc(16px + env(safe-area-inset-bottom) + var(--om-ai-bubble-offset)) !important;
    transform: none !important;
    margin: 0 !important;
  }

}

@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  .om-ai-bubble__button {
    animation: om-ai-bubble-pulse 1.7s ease-out 0.35s 2;
  }
}
