/* Character Chat Styles - Clean implementation with proper theme support */
.character-chat-container {
  max-width: 800px;
  margin: 30px auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue",
    sans-serif;
  background: #ffffff;
  color: #333333;
}

.character-chat-header {
  background-color: #f9f9f9;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 8px 8px 0 0;
}

.character-chat-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.character-chat-registration {
  padding: 20px;
  background: #ffffff;
}

.character-chat-form-group {
  margin-bottom: 15px;
}

.character-chat-form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

.character-chat-form-group input,
.character-chat-form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px; /* Prevents zoom on iOS */
  background: #ffffff;
  color: #333;
  box-sizing: border-box;
}

.character-chat-form-group input:focus,
.character-chat-form-group select:focus {
  outline: none;
  border-color: #f00a71;
  box-shadow: 0 0 0 2px rgba(240, 10, 113, 0.2);
}

/* Buttons always #f00a71 regardless of theme */
.character-chat-button {
  background-color: #f00a71;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s;
  width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none; /* Remove iOS styling */
}

.character-chat-button:hover {
  background-color: #d00960;
}

.character-chat-button:disabled {
  background-color: #cccccc !important;
  cursor: not-allowed;
  opacity: 0.7;
}

.character-chat-conversation {
  padding: 0;
}

.character-chat-messages {
  height: 350px;
  overflow-y: auto;
  padding: 15px;
  background-color: #ffffff;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.character-chat-message {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  position: relative;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* User messages always #f00a71 regardless of theme */
.character-chat-message.user {
  background-color: #f00a71;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.character-chat-message.character {
  background-color: #f0f0f0;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.character-chat-message-name {
  font-size: 12px;
  margin-bottom: 4px;
  font-weight: 500;
  opacity: 0.8;
}

.character-chat-message-text {
  font-size: 14px;
  line-height: 1.4;
}

.character-chat-input-container {
  display: flex;
  padding: 15px;
  border-top: 1px solid #e0e0e0;
  background: #ffffff;
  gap: 10px;
}

.character-chat-input-container input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px; /* Prevents zoom on iOS */
  background: #ffffff;
  color: #333;
  box-sizing: border-box;
}

.character-chat-input-container input:focus {
  outline: none;
  border-color: #f00a71;
  box-shadow: 0 0 0 2px rgba(240, 10, 113, 0.2);
}

.character-chat-input-container .character-chat-button {
  width: auto;
  min-width: 80px;
  padding: 12px 16px;
}

/* Typing indicator */
.character-chat-typing-indicator {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  background-color: #f0f0f0;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.character-chat-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}

/* Typing dots always #f00a71 regardless of theme */
.character-chat-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #f00a71;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.character-chat-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.character-chat-typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

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

/* Development mode notices */
.character-chat-dev-notice {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 10px 15px;
  margin-bottom: 15px;
  border-radius: 4px;
  font-size: 14px;
}

/* DARK MODE STYLES - Only apply when ashe-dark-mode class is present */
body.ashe-dark-mode .character-chat-container {
  background: #1a1a1a;
  color: #ffffff;
  border-color: #333333;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.ashe-dark-mode .character-chat-header {
  background-color: #2a2a2a;
  color: #ffffff;
  border-color: #333333;
}

body.ashe-dark-mode .character-chat-header h3 {
  color: #ffffff;
}

body.ashe-dark-mode .character-chat-registration {
  background: #1a1a1a;
}

body.ashe-dark-mode .character-chat-form-group label {
  color: #cccccc;
}

body.ashe-dark-mode .character-chat-form-group input,
body.ashe-dark-mode .character-chat-form-group select {
  background: #2a2a2a;
  color: #ffffff;
  border-color: #444444;
}

body.ashe-dark-mode .character-chat-messages {
  background-color: #1a1a1a;
}

body.ashe-dark-mode .character-chat-message.character {
  background-color: #2a2a2a;
  color: #ffffff;
}

body.ashe-dark-mode .character-chat-input-container {
  background: #1a1a1a;
  border-color: #333333;
}

body.ashe-dark-mode .character-chat-input-container input {
  background: #2a2a2a;
  color: #ffffff;
  border-color: #444444;
}

body.ashe-dark-mode .character-chat-typing-indicator {
  background-color: #2a2a2a;
  color: #ffffff;
}

body.ashe-dark-mode .character-chat-dev-notice {
  background-color: #3a3a2a;
  border-color: #5a5a4a;
  color: #cccc88;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
  .character-chat-container {
    margin: 10px;
    border-radius: 8px;
    max-width: calc(100% - 20px);
  }

  .character-chat-header {
    padding: 12px 15px;
  }

  .character-chat-header h3 {
    font-size: 16px;
  }

  .character-chat-registration {
    padding: 15px;
  }

  .character-chat-messages {
    height: 300px;
    padding: 12px;
  }

  .character-chat-message {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 14px;
  }

  .character-chat-message-text {
    font-size: 14px;
  }

  .character-chat-input-container {
    padding: 12px;
    flex-direction: column;
    gap: 8px;
  }

  .character-chat-input-container input {
    margin-right: 0;
    margin-bottom: 0;
  }

  .character-chat-input-container .character-chat-button {
    width: 100%;
    min-width: auto;
  }

  .character-chat-form-group input,
  .character-chat-form-group select {
    padding: 14px;
    font-size: 16px;
  }

  .character-chat-button {
    padding: 14px 20px;
    font-size: 16px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .character-chat-container {
    margin: 5px;
    border-radius: 4px;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
  }

  .character-chat-messages {
    height: 250px;
    padding: 10px;
  }

  .character-chat-message {
    max-width: 95%;
    padding: 8px 12px;
  }

  .character-chat-input-container {
    padding: 10px;
  }

  body.ashe-dark-mode .character-chat-container {
    border-left: 1px solid #333333;
    border-right: 1px solid #333333;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .character-chat-button {
    min-height: 44px; /* iOS recommended touch target */
  }

  .character-chat-form-group input,
  .character-chat-form-group select {
    min-height: 44px;
  }

  .character-chat-input-container input {
    min-height: 44px;
  }
}
