/* ============================================
   SD ASSISTANT - INTELLIGENT CHATBOT CSS
   ============================================
   
   Features:
   - Nur 2 Quick Actions (mehr Message-Platz)
   - Automatisches Umschalten bei Login
   - Technisch-professionelles Design
   - Mobile-optimiert
   ============================================ */

:root {
  --jade-primary: #0d9488;
  --jade-secondary: #0f766e;
  --jade-accent: #14b8a6;
  --jade-light: #5eead4;
  --jade-dark: #134e4a;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --bg-dark: #1e293b;
  --bg-darker: #0f172a;
}

/* === FLOATING BUTTON === */
.sd-chat-float-button {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 65px;
  height: 65px;
  background: rgba(15, 118, 110, 0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--jade-accent);
  transition: all 0.3s ease;
  z-index: 999;
}

.sd-chat-float-button:hover {
  transform: translateY(-4px);
  background: rgba(15, 118, 110, 0.25);
  border-color: rgba(20, 184, 166, 0.4);
  box-shadow: 0 12px 32px rgba(13, 148, 136, 0.3);
}

.sd-chat-float-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* === CHAT CONTAINER === */
#sd-chat-container {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 400px;
  height: 580px;
  display: none;
  pointer-events: none;
  z-index: 1000;
}

#sd-chat-container.visible {
  display: block;
  pointer-events: auto;
}

/* === CHAT BOX === */
#sd-chat-box {
  width: 100%;
  height: 100%;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(30px);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(71, 85, 105, 0.3);
}

/* === CHAT HEADER === */
#sd-chat-header {
  background: rgba(15, 118, 110, 0.12);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(71, 85, 105, 0.3);
  color: white;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#sd-chat-header .title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}

#sd-chat-header .icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sd-chat-header .icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

#sd-chat-close-btn {
  background: rgba(71, 85, 105, 0.3);
  border: 1px solid rgba(100, 116, 139, 0.4);
  color: var(--text-secondary);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#sd-chat-close-btn:hover {
  background: rgba(71, 85, 105, 0.5);
  border-color: rgba(100, 116, 139, 0.6);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* === WELCOME MESSAGE === */
.sd-chat-welcome-section {
  padding: 18px 20px;
  background: rgba(15, 118, 110, 0.05);
  border-bottom: 1px solid rgba(71, 85, 105, 0.25);
}

.sd-chat-welcome-label {
  color: var(--jade-accent);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
}

.sd-chat-welcome-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.6;
  font-weight: 400;
}

/* === QUICK ACTIONS - NUR 2! === */
.sd-chat-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.sd-chat-quick-action {
  background: rgba(71, 85, 105, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 12px;
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.sd-chat-quick-action:hover {
  background: rgba(15, 118, 110, 0.2);
  border-color: rgba(20, 184, 166, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.2);
}

.sd-chat-quick-action-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sd-chat-quick-action-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--jade-accent);
  stroke-width: 2;
}

/* === MESSAGES - MEHR PLATZ! === */
#sd-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: rgba(15, 23, 42, 0.5);
}

.sd-chat-message {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
}

.sd-chat-message.user {
  align-items: flex-end;
}

.sd-chat-message.bot {
  align-items: flex-start;
}

.sd-chat-message-label {
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sd-chat-message.user .sd-chat-message-label {
  color: var(--jade-accent);
}

.sd-chat-message.bot .sd-chat-message-label {
  color: var(--jade-primary);
}

.sd-chat-bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 12px;
  line-height: 1.6;
  word-wrap: break-word;
  font-size: 0.88rem;
}

.sd-chat-message.user .sd-chat-bubble {
  background: rgba(13, 148, 136, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(20, 184, 166, 0.3);
  color: var(--text-primary);
  border-radius: 12px 12px 3px 12px;
}

.sd-chat-message.bot .sd-chat-bubble {
  background: rgba(71, 85, 105, 0.2);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 1px solid rgba(100, 116, 139, 0.25);
  border-radius: 12px 12px 12px 3px;
}

/* === TYPING INDICATOR === */
.sd-chat-typing-indicator {
  display: none;
  padding: 11px 14px;
  background: rgba(71, 85, 105, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(100, 116, 139, 0.25);
  border-radius: 12px;
  width: fit-content;
}

.sd-chat-typing-indicator.active {
  display: block;
}

.sd-chat-typing-dots {
  display: flex;
  gap: 5px;
}

.sd-chat-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--jade-accent);
  border-radius: 50%;
  animation: sd-typing 1.4s infinite;
}

.sd-chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.sd-chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sd-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* === INPUT AREA === */
#sd-chat-input {
  display: flex;
  padding: 14px 16px;
  gap: 10px;
  background: rgba(30, 41, 59, 0.8);
  border-top: 1px solid rgba(71, 85, 105, 0.3);
}

#sd-chat-msg-input {
  flex: 1;
  padding: 11px 14px;
  background: rgba(71, 85, 105, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(100, 116, 139, 0.35);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.3s;
}

#sd-chat-msg-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

#sd-chat-msg-input:focus {
  outline: none;
  background: rgba(71, 85, 105, 0.35);
  border-color: var(--jade-accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

#sd-chat-mic-btn {
  width: 40px;
  height: 40px;
  background: rgba(71, 85, 105, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(100, 116, 139, 0.4);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#sd-chat-mic-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

#sd-chat-mic-btn:hover {
  background: rgba(13, 148, 136, 0.2);
  border-color: var(--jade-accent);
  color: var(--jade-accent);
  transform: translateY(-2px);
}

#sd-chat-mic-btn.recording {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  animation: sd-pulse-mic 1s infinite;
}

@keyframes sd-pulse-mic {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { transform: translateY(-2px); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

#sd-chat-send-btn {
  width: 40px;
  height: 40px;
  background: rgba(13, 148, 136, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(20, 184, 166, 0.4);
  border-radius: 10px;
  color: var(--jade-accent);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#sd-chat-send-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

#sd-chat-send-btn:hover {
  background: rgba(13, 148, 136, 0.3);
  border-color: var(--jade-accent);
  transform: translateY(-2px);
}

/* === PRIVACY FOOTER === */
#sd-chat-privacy-footer {
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid rgba(71, 85, 105, 0.2);
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

#sd-chat-privacy-footer a {
  color: var(--jade-accent);
  text-decoration: none;
  transition: color 0.2s;
}

#sd-chat-privacy-footer a:hover {
  color: var(--jade-light);
  text-decoration: underline;
}

/* === MIC INDICATOR === */
#sd-chat-mic-indicator {
  position: fixed;
  bottom: 690px;
  right: 40px;
  background: rgba(239, 68, 68, 0.2);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #ef4444;
  padding: 9px 15px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 1001;
}

#sd-chat-mic-indicator.active {
  display: flex;
}

#sd-chat-mic-indicator .pulse-dot {
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  animation: sd-pulse-dot 1.5s infinite;
}

@keyframes sd-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* === HINT === */
.sd-chat-hint {
  position: fixed;
  bottom: 170px;
  right: 40px;
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(71, 85, 105, 0.4);
  color: var(--text-secondary);
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  display: none;
  z-index: 1001;
  max-width: 220px;
  text-align: center;
  line-height: 1.6;
  letter-spacing: 0.3px;
}

.sd-chat-hint.visible {
  display: block;
  animation: sd-fadeInUp 0.3s ease;
}

@keyframes sd-fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === SCROLLBAR === */
#sd-chat-messages::-webkit-scrollbar {
  width: 6px;
}

#sd-chat-messages::-webkit-scrollbar-track {
  background: rgba(71, 85, 105, 0.15);
}

#sd-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 10px;
}

#sd-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.6);
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 767px) {
  .sd-chat-float-button {
    width: 56px;
    height: 56px;
    bottom: 80px;
    right: 20px;
    border-radius: 14px;
  }

  .sd-chat-float-button svg {
    width: 24px;
    height: 24px;
  }

  #sd-chat-container {
    width: calc(100vw - 32px);
    height: 70vh;
    max-height: 500px;
    bottom: 16px;
    right: 16px;
  }

  #sd-chat-mic-indicator {
    bottom: auto;
    top: 80px;
    right: 20px;
    font-size: 12px;
    padding: 8px 14px;
  }

  .sd-chat-hint {
    bottom: 90px;
    right: 20px;
    font-size: 10px;
  }
}