/* Synnio Customer Chat Widget Styles
   Version: 2.1.1
   Save as UTF-8 (without BOM)
*/

/* ===== Base / Reset (im Shadow DOM) ===== */
:host{ all: initial; contain: content; font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif; }
:host, *{ box-sizing: border-box; }
[hidden]{ display:none !important; }

/* ===== Position / Container ===== */
.wrapper{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147483647; /* ganz oben */
}

/* ===== Launcher (runde Sprechblase) ===== */
.launcher{ display: grid; place-items: end; }
.launcher-btn{
  width:65px; height:65px; border-radius:50%; border:0; cursor:pointer;
  display:flex; align-items:center; justify-content:center; color:#fff;
  background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  box-shadow: 0 10px 30px rgba(102,126,234,0.4);
  transition: transform .25s ease, box-shadow .25s ease;
}
.launcher-btn:hover{ transform: scale(1.06); box-shadow:0 15px 40px rgba(102,126,234,0.6); }

/* ===== Panel (Start + Chat) ===== */
.chat{
  width: var(--chat-width, 380px);
  height: var(--chat-height, 600px);
  border-radius: 20px; overflow: hidden;
  display:flex; flex-direction:column;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.30);
}

/* Startscreen dezenter Verlauf */
.chat.start-mode{
  background:
    linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%),
    rgba(255,255,255,0.95);
  backdrop-filter: blur(18px);
}

/* ===== Header (Start & Chat) ===== */
.header,
.chat-header{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 12px 14px;
  color:#fff;
  background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.header .title{ font-weight:700; }
.header .close,
.chat-header .close{
  width:32px; height:32px; border-radius:50%; border:0;
  background:rgba(0,0,0,.15); color:#fff;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.header .close:hover,
.chat-header .close:hover{ background: rgba(0,0,0,.25); }

/* Chat-Header (Logo + Name + Status) */
.chat-header{ gap:12px; }
.chat-header .avatar{
  width:45px; height:45px; border-radius:50%;
  background: rgba(255,255,255,.25);
  display:grid; place-items:center; font-weight:700;
  overflow:hidden;
}
.chat-header .avatar img{ width:100%; height:100%; object-fit:cover; border-radius:50%; }
.chat-header .c-name{ font-size: var(--cname-size,16px); color: var(--cname-color,#fff); font-weight:700; line-height:1.15; }
.chat-header .status{
  font-size: var(--status-size,12px);
  color: var(--status-color,rgba(255,255,255,.92));
  display:flex; align-items:center; gap:6px; margin-top:2px;
}
.chat-header .status .dot{ width:8px; height:8px; border-radius:50%; background:#4ade80; }

/* ===== Startscreen Inhalte ===== */
.start{
  padding: 38px 28px;
  display:flex; flex-direction:column; gap:18px;
}
.start .start-logo{ max-height:64px; max-width:100%; object-fit:contain; margin:0 auto; }
.start .title{ font-size: var(--start-title-size,24px); color: var(--start-title-color,#333); font-weight:700; text-align:center; }
.start .subtitle{ font-size: var(--start-subtitle-size,14px); color: var(--start-subtitle-color,#666); text-align:center; line-height:1.6; }

.name-label{ font-size: var(--name-label-size,13px); color: var(--name-label-color,#555); margin-top: 6px; }
.name-input{
  width:100%; padding:15px; border:2px solid var(--name-border,transparent);
  background: var(--name-bg,rgba(255,255,255,.85)); border-radius:12px;
  color: var(--name-text,#333); font-size: var(--name-size,15px);
}
.name-input::placeholder{ color:#6b7280; }

.start-btn{
  width:100%; padding:15px; margin-top:10px;
  border-radius:12px; border:0; cursor:pointer; font-weight:600;
  background: var(--btn-bg,linear-gradient(135deg,#667eea 0%,#764ba2 100%));
  color: var(--btn-text,#fff); font-size: var(--btn-size,16px);
  transition: transform .15s ease, box-shadow .15s ease;
}
.start-btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 25px rgba(102,126,234,0.35); }

/* ===== Messages ===== */
.messages{
  flex:1; overflow:auto; padding: 20px;
  background: linear-gradient(to bottom, rgba(102,126,234,0.02), rgba(118,75,162,0.02));
}

/* Zeile */
.msg{ margin:12px 0; display:flex; }
.msg.me{ justify-content:flex-end; }     /* eigene Nachrichten rechts */
.msg.sys{ justify-content:center; }      /* Systemmeldungen mittig */

/* Bubble */
.bubble{
  max-width:70%;
  padding:12px 16px;
  border-radius:18px;
  font-size:14px; line-height:1.45;
  background:#fff; color:#333;
  box-shadow: 0 2px 5px rgba(0,0,0,.05);
  border-bottom-left-radius:4px;       /* kleine Ecke unten links -> wie bekannte Chats */
}

/* rechte Seite (eigene Nachricht) */
.msg.me .bubble{
  background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  color:#fff;
  border-bottom-left-radius:18px;
  border-bottom-right-radius:4px;
}

/* Systemmeldungen dezent */
.msg.sys .bubble{
  background:#eef2f7 !important;
  color:#475569 !important;
  border-radius:12px;
  padding:6px 10px;
  font-size:13px;
  box-shadow:none;
}

/* ===== Composer ===== */
.composer{
  padding: 16px; background:#fff; border-top: 1px solid rgba(0,0,0,.06);
  position:relative;
}
.input-row{
  display:flex; gap:10px; align-items:center;
  background:#f5f5f5; border-radius:25px; padding:5px 5px 5px 15px;
}
.input-row:focus-within{ background:#fff; box-shadow:0 0 0 2px #667eea; }

.msg-input{
  flex:1; border:0; background:transparent; font-size:14px; padding:8px 0; color:#333; resize:none; max-height:140px;
}
.msg-input:focus{ outline:none; }

.actions{ display:flex; gap:6px; align-items:center; }
.icon-btn{
  width:32px; height:32px; border:0; background:transparent; color:#666;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%; cursor:pointer;
}
.icon-btn:hover{ background: rgba(102,126,234,0.10); color:#667eea; }

.send{
  width:36px; height:36px; border-radius:50%; border:0; color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  transition: transform .15s ease;
}
.send:hover{ transform: scale(1.06); }

/* Emoji-Popover */
.emoji-pop{
  position:absolute; bottom:90px; right:24px;
  background:#fff; border:1px solid rgba(0,0,0,.08); border-radius:12px; padding:8px;
  box-shadow:0 10px 24px rgba(0,0,0,.12); display:none;
}
.emoji-grid{ display:grid; grid-template-columns:repeat(10, 28px); gap:6px; }
.emoji-grid button{
  width:28px; height:28px; border-radius:6px; border:0; background:#fff; cursor:pointer;
}
.emoji-grid button:hover{ background:#f0f0f6; }

/* ===== Scrollbars (WebKit) ===== */
.messages::-webkit-scrollbar{ width:8px; height:8px }
.messages::-webkit-scrollbar-thumb{ background:#cbd5e1; border-radius:4px }
.messages::-webkit-scrollbar-thumb:hover{ background:#94a3b8 }

/* ===== Responsive ===== */
@media (max-width: 420px){
  .chat{ width: calc(100vw - 20px); height: 70vh; }
  .emoji-pop{ right:10px; }
}

/* ===== High-Contrast/Prefers-Reduced-Motion (optional) ===== */
@media (prefers-reduced-motion: reduce){
  .launcher-btn, .send, .start-btn{ transition: none; }
}
