/**
 * Aldersbach Chatbot Widget Styles
 * Farben: Dunkelrot #8B0000, Gold #D4AF37
 */

/* ===== Chat Bubble ===== */
.alderspach-chat-bubble {
  position: fixed;
  bottom: 20px; /* Bottom position (3rd button) */
  right: 20px;
  width: 60px;
  height: 60px;
  background: #8B0000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
  z-index: 9998;
  transition: all 0.3s ease;
  color: white;
}

.alderspach-chat-bubble:hover {
  background: #A52A2A;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(139, 0, 0, 0.5);
}

.alderspach-chat-bubble-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
}

/* ===== Chat Container ===== */
.alderspach-chat-container {
  position: fixed;
  bottom: 20px; /* Stays at bottom when open */
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: all 0.3s ease;
}

.alderspach-chat-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

/* ===== Header ===== */
.alderspach-chat-header {
  background: linear-gradient(135deg, #8B0000 0%, #A52A2A 100%);
  color: white;
  padding: 20px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alderspach-chat-header-content h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.alderspach-chat-header-content p {
  margin: 4px 0 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.alderspach-chat-header-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.alderspach-chat-clear-button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.alderspach-chat-clear-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.alderspach-chat-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.alderspach-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Messages Area ===== */
.alderspach-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.alderspach-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.alderspach-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ===== Message Bubbles ===== */
.alderspach-chat-message {
  max-width: 80%;
  animation: fadeIn 0.3s ease;
}

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

.alderspach-bot-message {
  align-self: flex-start;
}

.alderspach-user-message {
  align-self: flex-end;
}

.alderspach-message-content {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
}

.alderspach-bot-message .alderspach-message-content {
  background: white;
  border: 1px solid #e0e0e0;
  color: #333;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.alderspach-user-message .alderspach-message-content {
  background: #8B0000;
  color: white;
}

/* ===== Sources ===== */
.alderspach-message-sources {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 12px;
}

.alderspach-message-sources small {
  color: #666;
}

.alderspach-message-sources a {
  color: #8B0000;
  text-decoration: none;
  font-weight: 500;
}

.alderspach-message-sources a:hover {
  text-decoration: underline;
}

/* ===== Typing Indicator ===== */
.alderspach-typing .alderspach-message-content {
  padding: 16px;
}

.alderspach-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.alderspach-typing-dots span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

.alderspach-typing-dots 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 ===== */
.alderspach-chat-input-container {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 12px;
  align-items: center;
}

#alderspach-chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}

#alderspach-chat-input:focus {
  border-color: #8B0000;
  box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.alderspach-chat-send-button {
  background: #8B0000;
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.alderspach-chat-send-button:hover:not(:disabled) {
  background: #A52A2A;
  transform: scale(1.05);
}

.alderspach-chat-send-button:active:not(:disabled) {
  transform: scale(0.95);
}

.alderspach-chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 480px) {
  .alderspach-chat-bubble {
    bottom: 16px; /* Adjusted for mobile (3rd position) */
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .alderspach-chat-container {
    width: calc(100vw - 20px);
    height: calc(100vh - 80px);
    bottom: 10px;
    right: 10px;
    border-radius: 12px;
  }

  .alderspach-chat-header {
    padding: 16px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

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

  .alderspach-chat-header-content p {
    font-size: 12px;
  }

  .alderspach-chat-messages {
    padding: 16px;
  }

  .alderspach-chat-input-container {
    padding: 12px 16px;
  }

  #alderspach-chat-input {
    padding: 10px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .alderspach-chat-send-button {
    width: 40px;
    height: 40px;
  }
}

/* ===== Animations ===== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(139, 0, 0, 0.6);
  }
}