:root {
  /* Colors */
  --chat--color-primary: #e74266;
  --chat--color-primary-shade-50: #db4061;
  /* Calculated or same for now */
  --chat--color-primary-shade-100: #cf3c5c;
  --chat--color-secondary: #20b69e;
  --chat--color-secondary-shade-50: #1ca08a;

  --chat--color-white: #ffffff;

  --chat--color-light: #f2f4f8;
  --chat--color-light-shade-50: #e6e9f1;
  --chat--color-light-shade-100: #c2c5cc;

  --chat--color-medium: #d2d4d9;
  --chat--color-dark: #101330;
  --chat--color-disabled: #d2d4d9;
  --chat--color-typing: #404040;

  /* Base Layout */
  --chat--spacing: 1rem;
  --chat--border-radius: 12px;
  /* Default updated */
  --chat--transition-duration: 0.25s;
  /* Smoother */
  --chat--font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;

  /* Window Dimensions */
  --chat--window--width: 380px;
  --chat--window--height: 550px;
  --chat--window--bottom: 20px;
  --chat--window--right: 20px;
  --chat--window--z-index: 99999;
  --chat--window--border: 1px solid rgba(0, 0, 0, 0.05);
  /* Subtler border */
  --chat--window--border-radius: var(--chat--border-radius);
  --chat--window--margin-bottom: 20px;
  --chat--window--shadow: 0 5px 20px rgba(0, 0, 0, 0.15);

  /* Message Styles */
  --chat--message--font-size: 0.95rem;
  --chat--message--padding: 12px 16px;
  --chat--message--border-radius: var(--chat--border-radius);
  --chat--message-line-height: 1.5;
  --chat--message--margin-bottom: 10px;
  --chat--message--bot--background: var(--chat--color-white);
  --chat--message--bot--color: var(--chat--color-dark);
  --chat--message--bot--border: none;
  --chat--message--user--background: var(--chat--color-secondary);
  --chat--message--user--color: var(--chat--color-white);
  --chat--message--user--border: none;

  /* Bubble / Toggle */
  --chat--toggle--size: 60px;
  --chat--toggle--background: var(--chat--color-primary);
  --chat--toggle--color: var(--chat--color-white);
}

/* === Admin Layout === */
.univ-chat-admin-wrap {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background: #f0f0f1;
  padding: 20px;
}

.univ-chat-container {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.univ-chat-settings {
  flex: 1;
  min-width: 400px;
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.univ-chat-preview-area {
  flex: 0 0 400px;
}

/* Slightly wider for new dimensions */
.sticky-preview {
  position: sticky;
  top: 40px;
}

.univ-settings-section {
  margin-bottom: 30px;
  border-bottom: 1px solid #eee;
  padding-bottom: 20px;
}

.univ-settings-section h3 {
  margin-top: 0;
  color: #1e293b;
  font-size: 1.25em;
  font-weight: 600;
  border-left: 5px solid var(--chat--color-primary);
  padding-left: 15px;
  margin-bottom: 20px;
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked+.slider {
  background-color: var(--chat--color-primary);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* === Chat Styles (Shared) === */
.univ-chat-wrapper {
  position: fixed;
  z-index: var(--chat--window--z-index);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* Allow clicking through wrapper space */
}
.univ-chat-wrapper > * {
    pointer-events: auto;
}

.univ-chat-wrapper.left {
  left: var(--chat--spacing);
  align-items: flex-start;
  bottom: var(--chat--spacing);
}

.univ-chat-wrapper.right {
  right: var(--chat--window--right);
  bottom: var(--chat--window--bottom);
}

/* Window */
.univ-chat-window,
.preview-window {
  width: var(--chat--window--width);
  height: var(--chat--window--height);
  background: var(--chat--color-light);
  border: var(--chat--window--border);
  border-radius: var(--chat--window--border-radius);
  box-shadow: var(--chat--window--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--chat--font-family);
  margin-bottom: var(--chat--window--margin-bottom);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom right;
}

.univ-chat-wrapper.left .univ-chat-window {
    transform-origin: bottom left;
}

/* Glass Effect */
.glass-effect {
  background: rgba(255, 255, 255, 0.75) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Header */
.chat-header,
.preview-header {
  background: var(--chat--color-dark);
  color: var(--chat--header--color, #fff);
  /* Fallback */
  padding: var(--chat--spacing);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.chat-title,
.preview-title {
  font-size: 1.25em;
  font-weight: 600;
}

/* Body */
.chat-body,
.preview-body {
  flex: 1;
  padding: var(--chat--messages-list--padding);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--chat--color-light);
}

/* Messages */
.msg-row {
  display: flex;
  width: 100%;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-bubble {
  padding: var(--chat--message--padding);
  border-radius: var(--chat--message--border-radius);
  max-width: 80%;
  line-height: var(--chat--message-line-height);
  font-size: var(--chat--message--font-size);
}

.bot-msg {
  background: var(--chat--message--bot--background);
  color: var(--chat--message--bot--color);
  border-top-left-radius: 0;
}

.user-msg {
  background: var(--chat--message--user--background);
  color: var(--chat--message--user--color);
  border-bottom-right-radius: 0;
}

/* Footer / Input */
.chat-footer,
.preview-footer {
  padding: var(--chat--spacing);
  background: var(--chat--color-white);
  border-top: 1px solid var(--chat--color-light-shade-50);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-footer input,
.preview-footer input {
  flex: 1;
  border: none;
  padding: 0.8rem;
  background: var(--chat--color-light);
  border-radius: 4px;
  outline: none;
  color: var(--chat--color-dark);
}

.chat-footer button,
.preview-footer button {
  background: var(--chat--color-primary);
  color: var(--chat--color-white);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s;
}

.chat-footer button:hover {
  background: var(--chat--color-primary-shade-50);
}

/* Bubble / Toggle Button */
.univ-chat-bubble,
.preview-bubble {
  width: var(--chat--toggle--size);
  height: var(--chat--toggle--size);
  background: var(--chat--toggle--background);
  color: var(--chat--toggle--color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  font-size: 24px;
  transition: transform 0.2s;
}

.univ-chat-bubble:hover,
.preview-bubble:hover {
  transform: scale(1.05);
}

/* Animations */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 66, 102, 0.7);
  }

  /* approximated color */
  70% {
    box-shadow: 0 0 0 10px rgba(231, 66, 102, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(231, 66, 102, 0);
  }
}

.effect-pulse {
  animation: pulse 2s infinite;
}

.effect-bounce {
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-10px);
  }

  60% {
    transform: translateY(-5px);
  }
}

/* Logic Hidden */
.univ-chat-window {
  display: none;
}

.univ-chat-window.open {
  display: flex;
}

/* Preview specific positioning */
#chat-preview-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* right align by default for preview */
  position: relative;
  min-height: 500px;
  /* enough space for window */
}

.preview-window {
  display: flex !important;
  position: relative;
  z-index: 10;
}

.preview-bubble {
  z-index: 11;
}