/* ==========================================================================
   Bleemeo Chat Widget — Scoped Styles
   All selectors under .cw-widget to avoid conflicts
   ========================================================================== */

/* ---------- Design Tokens ---------- */
.cw-widget {
  --cw-primary: #467fcf;
  --cw-primary-hover: #3a6db5;
  --cw-secondary: #7aa5db;
  --cw-light: #d5e5ff;
  --cw-dark: #333333;
  --cw-bg: #f5f5f5;
  --cw-white: #ffffff;
  --cw-border: #e0e0e0;
  --cw-text: #333333;
  --cw-text-muted: #888888;
  --cw-shadow: rgba(0, 0, 0, 0.15);
  --cw-bubble-size: 56px;
  --cw-panel-width: 400px;
  --cw-panel-height: 600px;
  --cw-radius: 16px;
  --cw-radius-sm: 10px;
  --cw-font: 'Ubuntu', system-ui, -apple-system, sans-serif;
  --cw-z: 1003;
  --cw-agent-bg: #ffffff;
  --cw-user-bg: #467fcf;
  --cw-user-text: #ffffff;
  --cw-input-bg: #ffffff;
  --cw-panel-bg: #ffffff;
  --cw-messages-bg: #ffffff;
}

/* ---------- Dark Mode Tokens ---------- */
html.dark .cw-widget {
  --cw-bg: #1a1a1a;
  --cw-border: #3a3a3a;
  --cw-text: #e5e5e5;
  --cw-text-muted: #999999;
  --cw-shadow: rgba(0, 0, 0, 0.4);
  --cw-agent-bg: #2a2a2a;
  --cw-user-bg: #3a6db5;
  --cw-input-bg: #2a2a2a;
  --cw-panel-bg: #1e1e1e;
  --cw-messages-bg: #1e1e1e;
}

/* ---------- Base ---------- */
.cw-widget {
  font-family: var(--cw-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--cw-text);
  z-index: var(--cw-z);
}

.cw-widget *,
.cw-widget *::before,
.cw-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Bubble ---------- */
.cw-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: var(--cw-bubble-size);
  height: var(--cw-bubble-size);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cw-primary), var(--cw-secondary));
  color: var(--cw-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--cw-shadow);
  z-index: var(--cw-z);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: cw-bubble-enter 0.4s ease-out;
}

.cw-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px var(--cw-shadow);
}

.cw-bubble:active {
  transform: scale(0.95);
}

.cw-bubble svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cw-bubble .cw-icon-close {
  position: absolute;
}

.cw-bubble[data-open="true"] .cw-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.cw-bubble[data-open="true"] .cw-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.cw-bubble[data-open="false"] .cw-icon-chat {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.cw-bubble[data-open="false"] .cw-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

/* Badge */
.cw-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #e53e3e;
  color: var(--cw-white);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  animation: cw-badge-pulse 2s ease-in-out infinite;
}

.cw-badge:empty {
  display: none;
}

/* ---------- Panel ---------- */
.cw-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: var(--cw-panel-width);
  height: var(--cw-panel-height);
  max-height: calc(100vh - 110px);
  background: var(--cw-panel-bg);
  border-radius: var(--cw-radius);
  box-shadow: 0 10px 40px var(--cw-shadow), 0 0 0 1px var(--cw-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--cw-z);
  transform: translateY(16px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.cw-panel[data-open="true"] {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Top Bar ---------- */
.cw-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px;
  flex-shrink: 0;
  background: var(--cw-panel-bg);
}

.cw-topbar-close {
  background: none;
  border: none;
  color: var(--cw-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.cw-topbar-close:hover {
  background: var(--cw-border);
  color: var(--cw-text);
}

.cw-topbar-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- Messages Area ---------- */
.cw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--cw-messages-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

.cw-messages::-webkit-scrollbar {
  width: 6px;
}

.cw-messages::-webkit-scrollbar-track {
  background: transparent;
}

.cw-messages::-webkit-scrollbar-thumb {
  background: var(--cw-border);
  border-radius: 3px;
}

/* ---------- Message Bubbles ---------- */
.cw-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--cw-radius-sm);
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: cw-msg-in 0.25s ease-out;
  position: relative;
}

.cw-msg a {
  color: inherit;
  text-decoration: underline;
}

.cw-msg-agent {
  align-self: flex-start;
  background: var(--cw-agent-bg);
  color: var(--cw-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cw-msg-user {
  align-self: flex-end;
  background: var(--cw-user-bg);
  color: var(--cw-user-text);
  border-bottom-right-radius: 4px;
}

.cw-msg-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
}

.cw-msg-user .cw-msg-time {
  text-align: right;
}

.cw-msg-sending {
  opacity: 0.7;
}

.cw-msg-content p {
  margin: 0 0 6px 0;
}

.cw-msg-content p:last-child {
  margin-bottom: 0;
}

/* ---------- Typing Indicator ---------- */
.cw-typing {
  align-self: flex-start;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--cw-agent-bg);
  border-radius: var(--cw-radius-sm);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cw-typing[data-visible="true"] {
  display: flex;
}

.cw-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--cw-text-muted);
  border-radius: 50%;
  animation: cw-typing-bounce 1.4s ease-in-out infinite;
}

.cw-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.cw-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ---------- Input Area ---------- */
.cw-input-area {
  padding: 12px 16px;
  background: var(--cw-panel-bg);
  flex-shrink: 0;
}

.cw-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: var(--cw-input-bg);
  border: 1px solid var(--cw-border);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cw-input-wrap:focus-within {
  border-color: var(--cw-primary);
  box-shadow: 0 0 0 3px rgba(70, 127, 207, 0.1);
}

.cw-textarea {
  flex: 1;
  resize: none;
  border: none;
  padding: 8px 0;
  font-family: var(--cw-font);
  font-size: 14px;
  line-height: 1.4;
  color: var(--cw-text);
  background: transparent;
  max-height: 100px;
  min-height: 20px;
  outline: none;
}

.cw-textarea::placeholder {
  color: var(--cw-text-muted);
}

.cw-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cw-primary);
  color: var(--cw-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.cw-send-btn:hover {
  background: var(--cw-primary-hover);
}

.cw-send-btn:active {
  transform: scale(0.9);
}

.cw-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cw-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---------- Attach Button ---------- */
.cw-attach-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  color: var(--cw-text-muted);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.cw-attach-btn:hover {
  color: var(--cw-primary);
  background: rgba(70, 127, 207, 0.08);
}

.cw-attach-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- File Preview ---------- */
.cw-file-preview {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--cw-input-bg);
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  animation: cw-msg-in 0.15s ease-out;
}

.cw-file-preview[data-visible="true"] {
  display: flex;
}

.cw-file-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.cw-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cw-file-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--cw-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html.dark .cw-file-icon {
  background: rgba(70, 127, 207, 0.15);
}

.cw-file-icon svg {
  width: 20px;
  height: 20px;
  fill: var(--cw-primary);
}

.cw-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cw-file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--cw-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-file-size {
  font-size: 11px;
  color: var(--cw-text-muted);
}

.cw-file-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cw-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.cw-file-remove:hover {
  background: rgba(229, 62, 62, 0.1);
  color: #e53e3e;
}

.cw-file-remove svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.cw-file-error {
  color: #e53e3e;
  font-size: 13px;
}

/* ---------- Message Attachments ---------- */
.cw-att-image {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
  max-width: 240px;
  cursor: pointer;
}

.cw-att-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  transition: opacity 0.2s ease;
}

.cw-att-image:hover img {
  opacity: 0.9;
}

.cw-att-sending {
  opacity: 0.6;
}

.cw-att-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  margin-bottom: 4px;
  text-decoration: none;
  color: var(--cw-text);
  transition: background 0.15s ease;
}

.cw-att-file:hover {
  background: rgba(0, 0, 0, 0.08);
}

.cw-att-file-user {
  background: rgba(255, 255, 255, 0.15);
  color: var(--cw-user-text);
}

.cw-att-file-user:hover {
  background: rgba(255, 255, 255, 0.25);
}

.cw-att-file-icon {
  flex-shrink: 0;
}

.cw-att-file-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: 0.7;
}

.cw-att-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cw-att-file-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-att-file-size {
  font-size: 10px;
  opacity: 0.7;
}

.cw-att-file-dl {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.cw-att-file:hover .cw-att-file-dl {
  opacity: 1;
}

.cw-att-file-dl svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ---------- Emoji Button ---------- */
.cw-emoji-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  color: var(--cw-text-muted);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.cw-emoji-btn:hover,
.cw-emoji-btn-active {
  color: var(--cw-primary);
  background: rgba(70, 127, 207, 0.08);
}

.cw-emoji-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ---------- Emoji Picker ---------- */
.cw-emoji-picker {
  display: none;
  flex-direction: column;
  background: var(--cw-panel-bg);
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  margin-top: 8px;
  overflow: hidden;
  height: 260px;
  animation: cw-msg-in 0.15s ease-out;
}

.cw-emoji-picker[data-visible="true"] {
  display: flex;
}

.cw-emoji-search-wrap {
  padding: 8px 8px 4px;
  flex-shrink: 0;
}

.cw-emoji-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--cw-border);
  border-radius: 8px;
  font-family: var(--cw-font);
  font-size: 13px;
  color: var(--cw-text);
  background: var(--cw-input-bg);
  outline: none;
  transition: border-color 0.15s ease;
}

.cw-emoji-search:focus {
  border-color: var(--cw-primary);
}

.cw-emoji-search::placeholder {
  color: var(--cw-text-muted);
}

.cw-emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--cw-border);
  flex-shrink: 0;
  overflow-x: auto;
}

.cw-emoji-tab {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.cw-emoji-tab:hover {
  background: rgba(70, 127, 207, 0.08);
}

.cw-emoji-tab-active {
  background: var(--cw-light);
}

html.dark .cw-emoji-tab-active {
  background: rgba(70, 127, 207, 0.15);
}

.cw-emoji-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
}

.cw-emoji-grid-container::-webkit-scrollbar {
  width: 4px;
}

.cw-emoji-grid-container::-webkit-scrollbar-thumb {
  background: var(--cw-border);
  border-radius: 2px;
}

.cw-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.cw-emoji-item {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.1s ease, transform 0.1s ease;
  text-align: center;
}

.cw-emoji-item:hover {
  background: rgba(70, 127, 207, 0.1);
  transform: scale(1.15);
}

.cw-emoji-empty {
  text-align: center;
  padding: 24px 8px;
  color: var(--cw-text-muted);
  font-size: 13px;
}

/* ---------- Welcome View ---------- */
.cw-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  background: var(--cw-messages-bg);
  gap: 16px;
}

.cw-welcome-emoji {
  font-size: 36px;
  line-height: 1;
}

.cw-welcome-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--cw-text);
  font-family: 'Montserrat', system-ui, sans-serif;
}

.cw-welcome-subtitle {
  font-size: 15px;
  color: var(--cw-text-muted);
  line-height: 1.5;
}

.cw-welcome-agents {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
}

.cw-welcome-agent {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--cw-panel-bg);
  object-fit: cover;
  margin-left: -10px;
  background: var(--cw-light);
  flex-shrink: 0;
}

.cw-welcome-agent:first-child {
  margin-left: 0;
}

.cw-welcome-agent-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--cw-panel-bg);
  margin-left: -10px;
  background: linear-gradient(135deg, var(--cw-primary), var(--cw-secondary));
  color: var(--cw-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.cw-welcome-agent-placeholder:first-child {
  margin-left: 0;
}

.cw-welcome-online {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--cw-text-muted);
}

.cw-welcome-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38a169;
  flex-shrink: 0;
  animation: cw-online-pulse 2s ease-in-out infinite;
}

@keyframes cw-online-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cw-start-conv-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  margin-top: 8px;
  background: var(--cw-primary);
  color: var(--cw-white);
  border: none;
  border-radius: 12px;
  font-family: var(--cw-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.cw-start-conv-btn:hover {
  background: var(--cw-primary-hover);
}

.cw-start-conv-btn:active {
  transform: scale(0.97);
}

.cw-start-conv-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.cw-welcome[data-visible="false"] {
  display: none;
}

/* ---------- Status Banner ---------- */
.cw-status {
  padding: 8px 16px;
  font-size: 12px;
  text-align: center;
  background: var(--cw-light);
  color: var(--cw-primary);
  display: none;
  flex-shrink: 0;
}

html.dark .cw-status {
  background: #2c3e50;
  color: var(--cw-secondary);
}

.cw-status[data-visible="true"] {
  display: block;
}

/* ---------- New Conversation Button ---------- */
.cw-new-conv {
  display: none;
  padding: 12px 16px;
  flex-shrink: 0;
}

.cw-new-conv[data-visible="true"] {
  display: block;
}

.cw-new-conv-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--cw-primary);
  color: var(--cw-white);
  border: none;
  border-radius: 12px;
  font-family: var(--cw-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.cw-new-conv-btn:hover {
  background: var(--cw-primary-hover);
}

.cw-new-conv-btn:active {
  transform: scale(0.98);
}

.cw-new-conv-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- Special Inputs (Email, CSAT) ---------- */
.cw-special-input {
  align-self: stretch;
  padding: 14px 16px;
  background: var(--cw-agent-bg);
  border-radius: var(--cw-radius-sm);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  animation: cw-msg-in 0.25s ease-out;
}

.cw-special-label {
  font-size: 14px;
  color: var(--cw-text);
  margin-bottom: 10px;
  font-weight: 500;
}

.cw-special-submitted {
  font-size: 13px;
  color: var(--cw-text-muted);
  font-style: italic;
}

/* Email form */
.cw-email-form {
  display: flex;
  gap: 6px;
}

.cw-email-field {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--cw-border);
  border-radius: 8px;
  font-family: var(--cw-font);
  font-size: 13px;
  color: var(--cw-text);
  background: var(--cw-input-bg);
  outline: none;
  transition: border-color 0.15s ease;
}

.cw-email-field:focus {
  border-color: var(--cw-primary);
}

.cw-email-field-error {
  border-color: #e53e3e;
}

.cw-email-field::placeholder {
  color: var(--cw-text-muted);
}

.cw-email-submit {
  padding: 8px 16px;
  background: var(--cw-primary);
  color: var(--cw-white);
  border: none;
  border-radius: 8px;
  font-family: var(--cw-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.cw-email-submit:hover {
  background: var(--cw-primary-hover);
}

.cw-email-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* CSAT Rating */
.cw-csat-emojis {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}

.cw-csat-emoji {
  font-size: 28px;
  line-height: 1;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.cw-csat-emoji:hover {
  transform: scale(1.2);
  background: rgba(70, 127, 207, 0.06);
}

.cw-csat-emoji-selected {
  border-color: var(--cw-primary);
  background: rgba(70, 127, 207, 0.1);
  transform: scale(1.15);
}

.cw-csat-feedback {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  animation: cw-msg-in 0.2s ease-out;
}

.cw-csat-feedback-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--cw-border);
  border-radius: 8px;
  font-family: var(--cw-font);
  font-size: 13px;
  color: var(--cw-text);
  background: var(--cw-input-bg);
  outline: none;
  transition: border-color 0.15s ease;
}

.cw-csat-feedback-input:focus {
  border-color: var(--cw-primary);
}

.cw-csat-feedback-input::placeholder {
  color: var(--cw-text-muted);
}

.cw-csat-submit {
  padding: 8px 16px;
  background: var(--cw-primary);
  color: var(--cw-white);
  border: none;
  border-radius: 8px;
  font-family: var(--cw-font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.cw-csat-submit:hover {
  background: var(--cw-primary-hover);
}

.cw-csat-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Powered By ---------- */
.cw-powered {
  padding: 6px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--cw-text-muted);
  background: var(--cw-panel-bg);
  border-top: 1px solid var(--cw-border);
  flex-shrink: 0;
}

.cw-powered a {
  color: var(--cw-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cw-powered a:hover {
  color: var(--cw-primary);
}

/* ---------- Animations ---------- */
@keyframes cw-bubble-enter {
  0% {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.1) rotate(0deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes cw-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cw-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

@keyframes cw-badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cw-widget *,
  .cw-widget *::before,
  .cw-widget *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Mobile (full-screen overlay) ---------- */
@media (max-width: 767px) {
  .cw-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .cw-panel[data-open="true"] {
    transform: translateY(0) scale(1);
  }

  .cw-bubble {
    bottom: 16px;
    right: 16px;
  }
}
