/* InsurePilot Chat Widget Styles */
#insurepilot-chatbot {
  --ip-primary: #2563eb;
  --ip-primary-dark: #1d4ed8;
  --ip-bg: #ffffff;
  --ip-text: #1f2937;
  --ip-text-muted: #6b7280;
  --ip-border: #e5e7eb;
  --ip-user-bg: #2563eb;
  --ip-user-text: #ffffff;
  --ip-bot-bg: #f3f4f6;
  --ip-bot-text: #1f2937;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat toggle button */
.ip-chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ip-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 99999;
}

.ip-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(37, 99, 235, 0.5);
}

.ip-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.ip-chat-toggle .ip-close-icon {
  display: none;
}

.ip-chat-toggle.ip-open .ip-chat-icon {
  display: none;
}

.ip-chat-toggle.ip-open .ip-close-icon {
  display: block;
}

/* Notification badge */
.ip-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat window */
.ip-chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: var(--ip-bg);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  animation: ip-slide-up 0.3s ease;
}

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

@keyframes ip-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.ip-chat-header {
  background: var(--ip-primary);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ip-chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ip-chat-avatar svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.ip-chat-header-info {
  flex: 1;
}

.ip-chat-header-title {
  font-weight: 600;
  font-size: 16px;
}

.ip-chat-header-subtitle {
  font-size: 12px;
  opacity: 0.9;
}

.ip-status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

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

.ip-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: ip-fade-in 0.2s ease;
}

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

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

.ip-message.ip-bot {
  background: var(--ip-bot-bg);
  color: var(--ip-bot-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ip-message.ip-system {
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  text-align: center;
  align-self: center;
  border-radius: 8px;
}

/* Typing indicator */
.ip-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--ip-bot-bg);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: 60px;
}

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

.ip-typing span:nth-child(1) { animation-delay: 0s; }
.ip-typing span:nth-child(2) { animation-delay: 0.2s; }
.ip-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ip-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Quick actions */
.ip-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ip-quick-action {
  background: white;
  border: 1px solid var(--ip-primary);
  color: var(--ip-primary);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.ip-quick-action:hover {
  background: var(--ip-primary);
  color: white;
}

/* Input area */
.ip-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--ip-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ip-chat-input {
  flex: 1;
  border: 1px solid var(--ip-border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  resize: none;
  max-height: 100px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ip-chat-input:focus {
  border-color: var(--ip-primary);
}

.ip-chat-input::placeholder {
  color: var(--ip-text-muted);
}

.ip-send-btn {
  width: 40px;
  height: 40px;
  background: var(--ip-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.ip-send-btn:hover {
  background: var(--ip-primary-dark);
  transform: scale(1.05);
}

.ip-send-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
}

.ip-send-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Action buttons */
.ip-action-buttons {
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--ip-border);
}

.ip-action-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--ip-border);
  border-radius: 8px;
  background: white;
  font-size: 12px;
  color: var(--ip-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.ip-action-btn:hover {
  background: var(--ip-bot-bg);
  border-color: var(--ip-primary);
  color: var(--ip-primary);
}

.ip-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Schedule form */
.ip-schedule-form {
  padding: 16px;
  background: #f9fafb;
  border-top: 1px solid var(--ip-border);
}

.ip-schedule-form h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ip-text);
}

.ip-form-group {
  margin-bottom: 10px;
}

.ip-form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ip-border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.ip-form-input:focus {
  border-color: var(--ip-primary);
}

.ip-form-row {
  display: flex;
  gap: 8px;
}

.ip-schedule-submit {
  width: 100%;
  padding: 12px;
  background: var(--ip-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.ip-schedule-submit:hover {
  background: var(--ip-primary-dark);
}

.ip-schedule-cancel {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: var(--ip-text-muted);
  border: none;
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
}

/* AI transparency label */
.ip-ai-label {
  padding: 6px 16px;
  background: #f0f9ff;
  border-top: 1px solid #bae6fd;
  font-size: 11px;
  color: #0369a1;
  text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
  .ip-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .ip-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}
