/* CreateMIWill Chat Widget Styles */
.cmw-widget * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Floating toggle button */
.cmw-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #1B365D;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(27, 54, 93, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  z-index: 99999;
  outline: none;
}

.cmw-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(27, 54, 93, 0.45);
}

.cmw-toggle:active {
  transform: scale(0.95);
}

.cmw-toggle svg {
  width: 28px;
  height: 28px;
  fill: none;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.cmw-toggle .cmw-icon-chat,
.cmw-toggle .cmw-icon-close {
  position: absolute;
}

.cmw-toggle .cmw-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.cmw-toggle.cmw-open .cmw-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.cmw-toggle.cmw-open .cmw-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Gold ring accent on button */
.cmw-toggle::before {
  content: '';
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid #C4973B;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: scale(0.9);
}

.cmw-toggle:hover::before {
  opacity: 0.6;
  transform: scale(1);
}

/* Chat panel */
.cmw-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  height: 550px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cmw-panel.cmw-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.cmw-header {
  background: #1B365D;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cmw-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cmw-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(196, 151, 59, 0.2);
  border: 2px solid #C4973B;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cmw-header-avatar svg {
  width: 18px;
  height: 18px;
}

.cmw-header-info h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.cmw-header-info span {
  font-size: 12px;
  opacity: 0.7;
  font-weight: 400;
}

.cmw-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  outline: none;
}

.cmw-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.cmw-close svg {
  width: 20px;
  height: 20px;
}

/* Messages area */
.cmw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.cmw-messages::-webkit-scrollbar {
  width: 5px;
}

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

.cmw-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

/* Message bubbles */
.cmw-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  animation: cmw-fadeIn 0.3s ease;
  word-wrap: break-word;
}

.cmw-msg a {
  color: #C4973B;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cmw-msg a:hover {
  color: #a37b2c;
}

.cmw-msg strong {
  font-weight: 600;
}

.cmw-msg-bot {
  align-self: flex-start;
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

.cmw-msg-user {
  align-self: flex-end;
  background: #1B365D;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cmw-msg-user a {
  color: #e8c86e;
}

/* Product cards */
.cmw-product-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cmw-product-card:hover {
  border-color: #C4973B;
  box-shadow: 0 2px 12px rgba(196, 151, 59, 0.12);
}

.cmw-product-card-name {
  font-weight: 600;
  font-size: 14px;
  color: #1B365D;
  margin-bottom: 4px;
}

.cmw-product-card-price {
  font-size: 18px;
  font-weight: 700;
  color: #C4973B;
  margin-bottom: 10px;
}

.cmw-product-card-btn {
  display: inline-block;
  background: #C4973B;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease;
  border: none;
  cursor: pointer;
}

.cmw-product-card-btn:hover {
  background: #a37b2c;
  transform: translateY(-1px);
}

/* Quick action buttons */
.cmw-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  animation: cmw-fadeIn 0.4s ease 0.2s both;
}

.cmw-quick-btn {
  background: #fff;
  border: 1.5px solid #d1d5db;
  color: #1B365D;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.cmw-quick-btn:hover {
  border-color: #C4973B;
  color: #C4973B;
  background: #fdf8ef;
}

/* Typing indicator */
.cmw-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #f3f4f6;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  animation: cmw-fadeIn 0.3s ease;
}

.cmw-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: cmw-bounce 1.4s ease-in-out infinite;
}

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

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

/* Input area */
.cmw-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: #fff;
}

.cmw-input {
  flex: 1;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 42px;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
  color: #1f2937;
}

.cmw-input::placeholder {
  color: #9ca3af;
}

.cmw-input:focus {
  border-color: #1B365D;
}

.cmw-send {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #1B365D;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
  outline: none;
}

.cmw-send:hover {
  background: #142848;
  transform: scale(1.05);
}

.cmw-send:active {
  transform: scale(0.95);
}

.cmw-send:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.cmw-send svg {
  width: 18px;
  height: 18px;
}

/* Powered by */
.cmw-powered {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: #9ca3af;
  background: #fafafa;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.cmw-powered a {
  color: #1B365D;
  text-decoration: none;
  font-weight: 600;
}

.cmw-powered a:hover {
  color: #C4973B;
}

/* Animations */
@keyframes cmw-fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cmw-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Mobile responsive — full screen */
@media (max-width: 480px) {
  .cmw-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform: translateY(100%);
  }

  .cmw-panel.cmw-visible {
    transform: translateY(0);
  }

  .cmw-toggle {
    bottom: 16px;
    right: 16px;
  }
}
