/* Panel zuverlässig ausblenden */
[hidden] { display: none !important; }

/* ASCOMP Farben */
:root{
  --brand:#0b5cff;
  --brand-dark:#0a52e0;
  --accent:#10b981;          /* Elegantes Grün */
  --bg:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --bubble:#f9fafb;
  --bubble-user:#eff6ff;
  --shadow:0 8px 24px rgba(11,92,255,.12), 0 2px 6px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg:#18181b;
    --text:#f4f4f5;
    --muted:#a1a1aa;
    --bubble:#27272a;
    --bubble-user:#1e3a8a;
    --shadow:0 12px 40px rgba(0,0,0,.4);
  }
}

/* Floating Chat-Button mit Text */
#ascomp-chat-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: auto;
  min-width: 60px;
  height: 60px;
  padding: 0 20px 0 16px;
  border-radius: 30px;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: 0 4px 16px rgba(11, 92, 255, .28);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;  /* Icon-Größe */
  font-weight: 500;
  z-index: 9999;
  transition: transform .2s ease, box-shadow .2s ease, padding .2s ease;
}

#ascomp-chat-button span {
  font-size: 16px;  /* Text-Größe */
}

#ascomp-chat-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(11, 92, 255, .35);
}

#ascomp-chat-button:active {
  transform: translateY(0) scale(.97);
}

#ascomp-chat-button:focus {
  outline: 2px solid rgba(11, 92, 255, .4);
  outline-offset: 2px;
}

/* Online-Status mit Puls */
#ascomp-chat-button::after{
  content:""; position:absolute; bottom:4px; left:4px;
  width:12px; height:12px; border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 3px var(--brand), 0 0 8px rgba(16,185,129,.6);
  animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite;
}
@keyframes pulse{
  0%, 100%{ opacity:1; }
  50%{ opacity:.7; }
}

/* Panel – saubere Kanten */
#ascomp-chat-panel{
  position:fixed; right:24px; bottom:96px;
  width:420px; max-height:700px; display:flex; flex-direction:column;
  background:var(--bg); border:none; border-radius:16px;
  box-shadow:var(--shadow); overflow:hidden; z-index:9999;
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transform:translateY(12px) scale(.96) translateZ(0);
  opacity:0;
  transition:transform 180ms cubic-bezier(.4,0,.2,1), opacity 180ms ease;
  -webkit-backface-visibility:hidden;
  -webkit-transform:translateZ(0);
  will-change:transform, opacity;
  isolation:isolate;
}
#ascomp-chat-panel.show{
  transform:translateY(0) scale(1) translateZ(0);
  opacity:1;
}

/* Header mit elegantem Farbverlauf */
.chat-header{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:16px 18px; color:#fff;
  background:linear-gradient(135deg, #0b5cff 0%, #ec4899 100%);
}
.chat-header-left{ display:flex; align-items:center; gap:12px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden; /* NEU: Für Bild-Clipping */
  padding: 4px; /* NEU: Kleiner Abstand zum Rand */
}

/* NEU: Logo-Styling */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Logo proportional skalieren */
}

.title-wrap{ display:flex; flex-direction:column; gap:2px; line-height:1.2; }
.chat-title{ font-weight:600; font-size:15px; }
.chat-status{
  font-size:12px; opacity:.92; display:flex; align-items:center; gap:6px; font-weight:400;
}
.dot{
  width:7px; height:7px; border-radius:50%; background:var(--accent);
  box-shadow:0 0 6px rgba(16,185,129,.6);
}
.chat-close{
  background:rgba(255,255,255,.12); border:none; color:#fff;
  width:28px; height:28px; border-radius:8px; cursor:pointer;
  display:flex;
  align-items: center;
  justify-content: center;
  font-size:18px;
  transition:background .2s ease;
  padding: 0;
  line-height: 1;
}
.chat-close:hover{ background:rgba(255,255,255,.2); }

/* Messages */
.chat-messages{
  flex:1; padding:16px; overflow-y:auto; display:flex; flex-direction:column; gap:12px;
  background:var(--bg);
}

/* Bubbles – kein Border */
.msg{
  padding:11px 14px; border-radius:16px; max-width:90%;
  line-height:1.5; color:var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  box-shadow:0 1px 2px rgba(0,0,0,.04);
  font-size: 14px;
}
.msg.bot{ 
  align-self:flex-start; 
  background:var(--bubble); 
  border-radius:12px 12px 12px 4px;
}
.msg.user{
  align-self:flex-end; background:var(--bubble-user); color:#1e40af;
}
.msg.system{
  align-self:center; background:transparent; box-shadow:none;
  color:var(--muted); font-size:13px; padding:6px;
}

/* Listen in Bot-Nachrichten einrücken */
.msg.bot ul,
.msg.bot ol {
  margin: 0px 0;
  padding-left: 24px;
}

.msg.bot li {
  margin: 0px 0;
  line-height: 1.6;
}

.msg.bot ul li {
  list-style-type: disc;
}

.msg.bot ol li {
  list-style-type: decimal;
}

/* Verschachtelte Listen */
.msg.bot ul ul,
.msg.bot ol ul,
.msg.bot ul ol,
.msg.bot ol ol {
  margin: 0px 0;
  padding-left: 20px;
}

/* Absätze in Bot-Nachrichten */
.msg.bot p {
  margin: 12px 0;
}

.msg.bot p:first-child {
  margin-top: 0;
}

.msg.bot p:last-child {
  margin-bottom: 0;
}

/* Code in Bot-Nachrichten */
.msg.bot code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.9em;
}

.msg.bot pre {
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.msg.bot pre code {
  background: transparent;
  padding: 0;
}

/* Input */
.chat-form{
  display:flex; gap:10px; padding:14px 16px;
  border-top:1px solid rgba(0,0,0,.06); background:rgba(249,250,251,.5);
}
.chat-form input{
  flex:1; padding:12px 16px; border-radius:24px;
  border:1px solid rgba(0,0,0,.08); background:#fff; color:var(--text);
  font-size:14px; transition:all .2s ease;
}
.chat-form input:focus{
  outline:none; border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(11,92,255,.1);
}
.chat-form input::placeholder{ color:var(--muted); opacity:.65; }
.chat-send{
  background:linear-gradient(135deg, var(--brand), var(--brand-dark));
  color:#fff; border:none; border-radius:50%; width:44px; height:44px;
  cursor:pointer; font-size:17px; display:grid; place-items:center;
  box-shadow:0 2px 8px rgba(11,92,255,.2);
  transition:transform .15s ease, box-shadow .2s ease;
}
.chat-send:hover{
  transform:scale(1.04);
  box-shadow:0 4px 12px rgba(11,92,255,.3);
}
.chat-send:active{ transform:scale(.96); }

/* Footer */
.chat-footer{
  padding:10px 16px; color:var(--muted); font-size:11px;
  text-align:center; background:rgba(249,250,251,.7);
  border-top:1px solid rgba(0,0,0,.04);
}

/* Links im Chat */
.msg a {
  color: #0066cc;
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s;
}

.msg a:hover {
  color: #0052a3;
  text-decoration: none;
}

.msg.bot a {
  color: #0077ed;
}

.msg.bot a:hover {
  color: #005bb5;
}

/* mailto-Links */
.msg a[href^="mailto:"] {
  color: #d63384;
}

.msg a[href^="mailto:"]:hover {
  color: #b02a69;
}

/* Externe Link-Indicator (optional) */
.msg a[href^="http"]:after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.6;
}

/* Interne ASCOMP-Links ohne Indicator */
.msg a[href*="ascomp.de"]:after,
.msg a[href*="ascompsoftware.com"]:after {
  content: "";
}

/* Dark Mode Anpassungen */
@media (prefers-color-scheme: dark) {
  .msg.bot code {
    background: rgba(255, 255, 255, 0.08);
  }
  
  .msg.bot pre {
    background: rgba(255, 255, 255, 0.08);
  }
  
  /* Input-Feld im Dark Mode */
  .chat-form input {
    background: var(--bubble);
    color: var(--text);
    border-color: rgba(255,255,255,.12);
  }
  
  /* Footer im Dark Mode */
  .chat-footer {
    color: var(--muted);
    background: rgba(39,39,42,.7);
  }
  
  .chat-footer a {
    color: var(--muted);
  }
  
  .msg.user {
  background: #60a5fa;  /* Sehr helles Blau */
  color: #ffffff;
  }  
}

/* Responsive: Smartphones */
@media (max-width: 768px) {
  #ascomp-chat-panel {
    width: 90vw !important;  /* ← Auf 90% geändert */
    height: 80vh !important;
    max-width: 90vw !important;  /* ← Auf 90% geändert */
    max-height: 80vh !important;
    right: 5vw !important;  /* ← 5% Abstand rechts (zentriert) */
    bottom: 0 !important;
    border-radius: 12px 12px 0 0 !important;  /* ← Abgerundete Ecken oben */
  }
  
  #ascomp-chat-button {
    right: 16px;
    bottom: 16px;
  }
}

/* Tablets (optional - falls du zwischen Smartphone und Desktop unterscheiden willst) */
@media (min-width: 769px) and (max-width: 1024px) {
  #ascomp-chat-panel {
    width: 90vw;
    max-width: 500px;
  }
}

/* ===== FEEDBACK BUTTONS (Training Mode) ===== */
.feedback-buttons {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(0,0,0,.06);
}

.feedback-buttons p {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.feedback-btn {
  padding: 10px 20px;
  margin-right: 10px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .15s ease, box-shadow .2s ease;
  color: #fff;
}

.feedback-btn:hover {
  transform: scale(1.04);
}

.feedback-btn:active {
  transform: scale(.96);
}

.feedback-yes {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, .2);
}

.feedback-yes:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, .3);
}

.feedback-no {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 2px 8px rgba(239, 68, 68, .2);
}

.feedback-no:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, .3);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .feedback-buttons {
    border-top-color: rgba(255,255,255,.12);
  }
  
  .feedback-buttons p {
    color: var(--text);
  }
}

#ascomp-chat-panel.helpdesk-mode {
  width: 65% !important;
  height: 75% !important;
  max-width: 65% !important;
  max-height: 75% !important;
}

/* ===== CONSENT-MODAL (beim Senden) ===== */
.consent-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.consent-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.consent-modal-content {
  position: relative;
  max-width: 480px;
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.consent-modal-content .consent-icon {
  font-size: 56px;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

.consent-modal-content h3 {
  margin: 0 0 12px 0;
  font-size: 24px;
  font-weight: 700;
}

.consent-modal-content p {
  margin: 0 0 16px 0;
  line-height: 1.6;
  font-size: 15px;
}

.consent-modal-content .consent-details {
  font-size: 14px;
  opacity: 0.95;
}

.consent-modal-content .consent-legal {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 20px;
}

.consent-modal-content .consent-legal a {
  color: white;
  text-decoration: underline;
  font-weight: 600;
}

.consent-modal-content .consent-info-box {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 16px;
  margin: 20px 0;
  text-align: left;
  font-size: 13px;
}

.consent-modal-content .consent-info-box strong {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}

.consent-modal-content .consent-info-box ul {
  margin: 0;
  padding-left: 20px;
}

.consent-modal-content .consent-info-box li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.consent-modal-content .consent-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.consent-modal-content .btn-accept {
  background: white;
  color: #667eea;
  border: none;
  padding: 16px 24px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.consent-modal-content .btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.consent-modal-content .btn-decline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.6);
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.consent-modal-content .btn-decline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
}

@media (max-width: 480px) {
  .consent-modal-content {
    padding: 24px 20px;
  }
  
  .consent-modal-content h3 {
    font-size: 20px;
  }
  
  .consent-modal-content p {
    font-size: 14px;
  }
}

/* Consent Banner Links */
#ascomp-consent-banner a {
  color: white;
  text-decoration: underline;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

#ascomp-consent-banner a:hover {
  opacity: 0.8;
}

/* Consent Banner Hover-Effekte */
#ascomp-consent-banner #consent-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

#ascomp-consent-banner #consent-decline:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.7);
}

/* Mobile Anpassung */
@media (max-width: 480px) {
  #ascomp-consent-banner {
    width: calc(100vw - 32px) !important;
    right: 16px !important;
    bottom: 16px !important;
    padding: 20px !important;
  }
  
  #ascomp-consent-banner strong:first-child {
    font-size: 17px !important;
  }
  
  #ascomp-consent-banner p {
    font-size: 13px !important;
  }
}

/* ===== CONSENT WIDERRUFEN LINK ===== */
.revoke-link {
  color: var(--muted);
  text-decoration: underline;
  font-size: 10px;         /* ← HIER Schriftgröße ändern */
  margin-left: 5px;
  transition: color 0.2s ease;
}

.revoke-link:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  .revoke-link {
    color: var(--muted);
  }
  
  .revoke-link:hover {
    color: #60a5fa;
  }
}