/* Container unten RECHTS */
.dsc-container {
  position: fixed;
  bottom: 24px;
  right: 24px; /* RECHTS positioniert */
  left: auto;  /* Links zurücksetzen */
  z-index: 99999;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  flex-direction: column-reverse; /* Button unten, Chat drüber */
  align-items: flex-end; /* Rechtsbündig ausrichten */
  gap: 16px;
}

/* --- Launcher Button (Rund) --- */
.dsc-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #f5d671; /* Theme Gold */
  color: #0b1220;     /* Theme Dark BG */
  border: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s;
  position: relative;
}

.dsc-launcher:hover {
  transform: scale(1.1);
  background: #ffe082;
}

/* --- Chat Widget Box --- */
.dsc-widget {
  width: 350px;
  max-width: calc(100vw - 48px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: #121e38; /* Surface Color */
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  
  /* Animation State: Hidden */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right; /* Animation von der Ecke aus */
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  
  position: absolute;
  bottom: 80px; /* Über dem Button */
  right: 0;     /* Rechtsbündig mit dem Container */
  left: auto;
}

/* State: Open */
.dsc-container.is-open .dsc-widget {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Icon Tausch beim Öffnen */
.dsc-container.is-open .dsc-icon-chat { display: none; }
.dsc-container.is-open .dsc-icon-close { display: block !important; }

/* --- Header --- */
.dsc-header {
  background: #0b1220;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dsc-title {
  font-weight: 800;
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dsc-indicator {
  width: 8px;
  height: 8px;
  background: #10b981; /* Green dot */
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}
.dsc-indicator.closed {
  background: #ef4444; /* Rot wenn geschlossen */
  box-shadow: none;
}

/* Header Buttons (Minimize / Close) */
.dsc-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dsc-btn-icon {
  background: none; 
  border: none; 
  color: rgba(255,255,255,0.5);
  display: flex; 
  align-items: center; 
  justify-content: center;
  padding: 4px; 
  border-radius: 4px;
  cursor: pointer; 
  transition: all 0.2s;
}
.dsc-btn-icon:hover { 
  color: #fff; 
  background: rgba(255,255,255,0.1); 
}
.dsc-btn-icon.danger:hover { 
  color: #ef4444; 
  background: rgba(239, 68, 68, 0.1); 
}

/* --- Body --- */
.dsc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #121e38;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Messages */
.dsc-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  font-size: 14px;
}

.dsc-msg.visitor { align-self: flex-end; align-items: flex-end; }
.dsc-msg.admin { align-self: flex-start; align-items: flex-start; }
.dsc-msg.system { align-self: center; align-items: center; max-width: 100%; margin: 10px 0; }

.dsc-msg .meta {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 4px;
  padding: 0 4px;
}

.dsc-msg .bubble {
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  color: #e2e8f0;
  word-break: break-word;
}

.dsc-msg.visitor .bubble {
  background: #38bdf8; /* Accent Blue */
  color: #0b1220;
  border-radius: 12px 12px 0 12px;
}

.dsc-msg.admin .bubble {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px 12px 12px 0;
}

.dsc-msg.system .bubble { 
  background: transparent; 
  border: 1px dashed rgba(255,255,255,0.2); 
  font-size: 12px; 
  color: rgba(255,255,255,0.5); 
  text-align: center; 
}

/* --- Footer / Input --- */
.dsc-footer {
  padding: 12px;
  background: #0b1220;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.dsc-auth {
  margin-bottom: 8px;
  font-size: 12px;
  text-align: center;
}
.dsc-auth a { color: #5865F2; text-decoration: none; font-weight: 700; }

.dsc-form {
  display: flex;
  gap: 8px;
  position: relative;
}

.dsc-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}
.dsc-input:focus {
  border-color: #f5d671;
}
.dsc-input:disabled { 
  opacity: 0.5; 
  cursor: not-allowed; 
}

.dsc-send {
  background: #f5d671;
  color: #0b1220;
  border: none;
  border-radius: 8px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.dsc-send:hover { background: #ffe082; }

/* Restart Button (wird eingeblendet wenn Chat zu) */
.dsc-restart-btn {
  width: 100%; 
  padding: 12px; 
  border-radius: 8px; 
  background: rgba(255,255,255,0.1); 
  color: #fff; 
  border: 1px solid rgba(255,255,255,0.2); 
  cursor: pointer; 
  font-weight: 600;
  transition: all 0.2s;
}
.dsc-restart-btn:hover { 
  background: rgba(255,255,255,0.15); 
  border-color: #fff; 
}

/* Scrollbar */
.dsc-body::-webkit-scrollbar { width: 6px; }
.dsc-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* Login Button (neu) */
.dsc-login-btn {
  display: flex;
  width: 100%;
  padding: 12px;
  background: #5865F2; /* Discord Blurple */
  color: #fff;
  border-radius: 8px;
  text-align: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.2s;
  cursor: pointer;
}
.dsc-login-btn:hover {
  background: #4752c4;
}

/* Restart Button (Style Update falls noch nicht drin) */
.dsc-restart-btn {
  width: 100%; 
  padding: 12px; 
  border-radius: 8px; 
  background: rgba(255,255,255,0.1); 
  color: #fff; 
  border: 1px solid rgba(255,255,255,0.2); 
  cursor: pointer; 
  font-weight: 600;
  transition: all 0.2s;
}
.dsc-restart-btn:hover { 
  background: rgba(255,255,255,0.15); 
  border-color: #fff; 
}

/* Typing Indicator Animation */
.dsc-msg.typing .bubble {
    background: rgba(255,255,255,0.05);
    padding: 12px 16px;
    border-radius: 12px 12px 12px 0;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dsc-typing-dots {
    display: flex;
    gap: 4px;
}

.dsc-typing-dots span {
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    animation: dscBounce 1.4s infinite ease-in-out both;
}

.dsc-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.dsc-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dscBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}