/**
 * Steward Chat Widget Styles
 * Matches GiftMatch360 navy/gold theme
 */

/* Widget Container */
#steward-widget {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Toggle Button (Steward Avatar) */
.steward-toggle {
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.steward-toggle:hover {
  transform: scale(1.1);
}

.steward-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.steward-avatar {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #1E3A5F 0%, #2a5298 100%);
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(30, 58, 95, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 3px solid #C5A572;
  transition: all 0.3s ease;
}

.steward-toggle:hover .steward-avatar {
  box-shadow: 0 6px 30px rgba(197, 165, 114, 0.6);
  border-color: #E8DCC8;
}

.steward-avatar svg {
  width: 100%;
  height: 100%;
  padding: 8px;
}

/* Pupil animation */
@keyframes look-around {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1px, -0.5px); }
  50% { transform: translate(1px, 0.5px); }
  75% { transform: translate(0, -1px); }
}

.steward-pupil-left,
.steward-pupil-right {
  animation: look-around 6s ease-in-out infinite;
}

.steward-pupil-right {
  animation-delay: 0.2s;
}

/* Pulse effect */
.steward-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #C5A572;
  animation: pulse 2s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

/* Name Badge */
.steward-badge {
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: #C5A572;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(197, 165, 114, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.steward-toggle:hover .steward-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

/* Chat Window */
.steward-chat {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  height: 600px;
  max-height: 80vh;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.steward-chat.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Header */
.steward-header {
  background: linear-gradient(135deg, #1E3A5F 0%, #2a5298 100%);
  color: white;
  padding: 20px;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.steward-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.steward-avatar-small {
  width: 45px;
  height: 45px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.steward-avatar-small svg {
  width: 40px;
  height: 40px;
}

.steward-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.steward-title p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

.steward-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.steward-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Messages Container */
.steward-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.steward-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

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

.steward-messages::-webkit-scrollbar-thumb:hover {
  background: #1E3A5F;
}

/* Individual Messages */
.steward-message {
  display: flex;
  gap: 10px;
  animation: slide-in 0.3s ease;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.steward-message-bot {
  align-items: flex-start;
}

.steward-message-user {
  justify-content: flex-end;
}

.steward-message-avatar {
  width: 35px;
  height: 35px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.steward-message-avatar svg {
  width: 30px;
  height: 30px;
}

.steward-message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
}

.steward-message-bot .steward-message-bubble {
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.steward-message-user .steward-message-bubble {
  background: linear-gradient(135deg, #1E3A5F 0%, #2a5298 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(30, 58, 95, 0.2);
}

/* Escalated Message */
.steward-message-bubble.escalated {
  border: 2px solid #C5A572;
  background: #FFF9F0;
}

/* Critical Message */
.steward-message-bubble.critical {
  background: #FFF4E6;
  border: 2px solid #C5A572;
}

/* Escalation Notice */
.steward-escalation-notice,
.steward-critical-notice {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(197, 165, 114, 0.1);
  border-left: 3px solid #C5A572;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1E3A5F;
  font-weight: 600;
}

.steward-critical-notice {
  background: rgba(197, 165, 114, 0.15);
}

/* Typing Indicator */
.steward-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 16px;
}

.steward-typing-indicator span {
  width: 8px;
  height: 8px;
  background: #C5A572;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.steward-typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.steward-typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Input Container */
.steward-input-container {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
  align-items: flex-end;
}

.steward-input {
  flex: 1;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.steward-input:focus {
  outline: none;
  border-color: #C5A572;
}

.steward-send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1E3A5F 0%, #2a5298 100%);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.steward-send-btn:hover {
  background: linear-gradient(135deg, #2a5298 0%, #1E3A5F 100%);
  transform: scale(1.1);
}

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

/* Footer */
.steward-footer {
  padding: 10px 20px;
  background: #f8f9fa;
  border-radius: 0 0 20px 20px;
  text-align: center;
  color: #999;
  font-size: 11px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #steward-widget {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  .steward-chat {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    bottom: 0;
    right: 0;
    left: 0;
  }

  .steward-chat.open {
    position: fixed;
  }

  .steward-header {
    border-radius: 0;
  }

  .steward-footer {
    border-radius: 0;
  }

  .steward-message-bubble {
    max-width: 85%;
  }
}

@media (max-width: 768px) {
  .steward-chat {
    width: 100%;
    max-width: 400px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .steward-toggle,
  .steward-chat,
  .steward-message,
  .steward-send-btn,
  .steward-close-btn {
    animation: none;
    transition: none;
  }

  .steward-pulse,
  .steward-pupil-left,
  .steward-pupil-right,
  .steward-typing-indicator span {
    animation: none;
  }
}
