/* OtterN Chat Widget - Clean & Optimized */

:root {
  --primary: #2d5016;
  --primary-light: #4a7828;
  --accent: #8bc34a;
  --bg: #fff;
  --text: #333;
  --text-light: #666;
  --border: #e0e0e0;
  --user-bg: #e8f5e9;
  --bot-bg: #f5f5f5;
}

/* Widget Container */
#ottern-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

/* Chat Button */
#ottern-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

#ottern-btn:hover {
  transform: scale(1.05);
}

#ottern-btn svg {
  width: 28px;
  height: 28px;
  fill: white;
}

/* Chat Window */
#ottern-window {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 400px;
  height: 600px;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s;
}

#ottern-window.open {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
#ottern-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#ottern-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

#ottern-header span {
  font-size: 24px;
}

#ottern-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.ottern-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

#ottern-clear,
#ottern-expand,
#ottern-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
  padding: 0;
}

#ottern-close {
  font-size: 28px;
  line-height: 1;
}

#ottern-clear svg,
#ottern-expand svg {
  width: 18px;
  height: 18px;
}

#ottern-clear:hover,
#ottern-expand:hover,
#ottern-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Expanded/Fullscreen mode */
#ottern-window.expanded {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  animation: expandWindow 0.3s;
}

@keyframes expandWindow {
  from {
    width: 400px;
    height: 600px;
  }
  to {
    width: 100%;
    height: 100%;
  }
}

/* Compress icon when expanded */
#ottern-window.expanded #ottern-expand svg {
  transform: rotate(180deg);
}

/* Messages Container */
#ottern-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fafafa;
  scroll-behavior: smooth;
}

#ottern-messages::-webkit-scrollbar {
  width: 6px;
}

#ottern-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* Message */
.ottern-msg {
  margin-bottom: 16px;
  display: flex;
  animation: fadeIn 0.3s;
}

.ottern-msg.user {
  justify-content: flex-end;
}

.ottern-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  line-height: 1.5;
}

.ottern-msg.user .ottern-content {
  background: var(--user-bg);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.ottern-msg.bot .ottern-content {
  background: var(--bot-bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.ottern-content p {
  margin: 0;
}

/* Quick Reply Buttons */
.ottern-btn {
  background: white;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 20px;
  margin: 8px 4px 0 0;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  display: inline-block;
}

.ottern-btn:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.ottern-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--text-light);
}

/* Product Cards */
.ottern-product {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  gap: 12px;
}

.ottern-product img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

.ottern-product-info h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.ottern-product-info .price {
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  margin: 4px 0;
}

.ottern-product-info .desc {
  font-size: 12px;
  color: var(--text-light);
  margin: 4px 0 0;
}

/* Typing Indicator */
#ottern-typing {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bot-bg);
  border-radius: 16px;
  max-width: 60px;
}

#ottern-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-light);
  animation: typing 1.4s infinite;
}

#ottern-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

#ottern-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Input Area */
#ottern-input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

#ottern-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

#ottern-input:focus {
  border-color: var(--primary);
}

#ottern-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#ottern-send:hover {
  background: var(--primary-light);
  transform: scale(1.05);
}

#ottern-send:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

#ottern-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Mobile */
@media (max-width: 480px) {
  #ottern-widget {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  #ottern-window {
    width: 100%;
    height: 500px;
  }

  .ottern-content {
    max-width: 85%;
  }

  /* Mobile expanded mode takes full screen */
  #ottern-window.expanded {
    bottom: 0;
    border-radius: 0;
  }

  /* Hide expand button on mobile (already full width) */
  #ottern-expand {
    display: none;
  }
}
