/**
 * chatbot.css — το widget στο front-end.
 *
 * Σκόπιμα χωρίς reset και χωρίς global selectors: το plugin μπαίνει πάνω σε
 * ξένο θέμα και δεν πρέπει να του αλλάξει τίποτα. Όλα τα στυλ κρέμονται από
 * το .xlc-root.
 */

.xlc-root {
  --xlc-color: #00a884;
  --xlc-bg:    #ffffff;
  --xlc-text:  #1f2328;
  --xlc-dim:   #6b7280;
  --xlc-line:  #e5e7eb;
  --xlc-user:  #eef2ff;

  position: fixed;
  bottom: 20px;
  z-index: 99998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--xlc-text);
}

.xlc-root.xlc-right { right: 20px; }
.xlc-root.xlc-left  { left: 20px; }

.xlc-root *,
.xlc-root *::before,
.xlc-root *::after { box-sizing: border-box; }

/* ── Κουμπί ──────────────────────────────────────────────────────────── */

.xlc-launcher {
  width: 58px; height: 58px;
  border: 0; border-radius: 50%;
  background: var(--xlc-color);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
  padding: 0;
}

.xlc-launcher:hover  { transform: scale(1.06); box-shadow: 0 8px 26px rgba(0, 0, 0, .28); }
.xlc-launcher:active { transform: scale(.97); }
.xlc-launcher:focus-visible { outline: 3px solid var(--xlc-color); outline-offset: 3px; }

.xlc-launcher svg { width: 26px; height: 26px; fill: #fff; }
.xlc-launcher .xlc-ic-close { display: none; }

.xlc-root.xlc-open .xlc-launcher .xlc-ic-chat  { display: none; }
.xlc-root.xlc-open .xlc-launcher .xlc-ic-close { display: block; }

/* ── Πλαίσιο ─────────────────────────────────────────────────────────── */

.xlc-panel {
  position: absolute;
  bottom: 72px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--xlc-bg);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .24);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Κλειστό: δεν πιάνει κλικ και δεν διαβάζεται από screen reader. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.98);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.xlc-root.xlc-right .xlc-panel { right: 0; }
.xlc-root.xlc-left  .xlc-panel { left: 0; }

.xlc-root.xlc-open .xlc-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── Κεφαλίδα ────────────────────────────────────────────────────────── */

.xlc-head {
  background: var(--xlc-color);
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  flex: none;
}

.xlc-head-av {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
  overflow: hidden;
}
.xlc-head-av img { width: 100%; height: 100%; object-fit: cover; }

.xlc-head-txt { flex: 1; min-width: 0; }
.xlc-head-title { font-weight: 600; font-size: 15px; }
.xlc-head-sub   { font-size: 12.5px; opacity: .85; }

.xlc-head-x {
  background: none; border: 0; color: #fff;
  font-size: 26px; line-height: 1;
  cursor: pointer; opacity: .8; padding: 0 2px;
}
.xlc-head-x:hover { opacity: 1; }

/* ── Σώμα ────────────────────────────────────────────────────────────── */

.xlc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 6px;
  background: #f7f8fa;
  -webkit-overflow-scrolling: touch;
}

.xlc-m { display: flex; margin-bottom: 10px; }
.xlc-m-user { justify-content: flex-end; }

.xlc-bub {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14.5px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.xlc-m-bot .xlc-bub {
  background: #fff;
  border: 1px solid var(--xlc-line);
  border-bottom-left-radius: 5px;
}

.xlc-m-user .xlc-bub {
  background: var(--xlc-color);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.xlc-bub b { font-weight: 600; }
.xlc-bub a { color: var(--xlc-color); }
.xlc-m-user .xlc-bub a { color: #fff; text-decoration: underline; }

.xlc-bub ul { margin: 8px 0 2px; padding-left: 20px; }
.xlc-bub li { margin-bottom: 5px; }

/* Τελείες «γράφει…» */
.xlc-typing .xlc-bub { display: flex; gap: 4px; padding: 14px 14px; }
.xlc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #b5bac4;
  animation: xlc-dot 1.3s infinite ease-in-out;
}
.xlc-typing span:nth-child(2) { animation-delay: .18s; }
.xlc-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes xlc-dot {
  0%, 60%, 100% { transform: translateY(0);    opacity: .45; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Προτάσεις ───────────────────────────────────────────────────────── */

.xlc-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 14px 10px;
  background: #f7f8fa;
  flex: none;
}

.xlc-chip {
  background: #fff;
  border: 1px solid var(--xlc-color);
  color: var(--xlc-color);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, color .15s ease;
}
.xlc-chip:hover { background: var(--xlc-color); color: #fff; }

/* ── Πεδίο εισόδου ───────────────────────────────────────────────────── */

.xlc-input {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--xlc-line);
  background: #fff;
  flex: none;
}

.xlc-input input {
  flex: 1;
  border: 1px solid var(--xlc-line);
  border-radius: 22px;
  padding: 10px 15px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--xlc-text);
  background: #fff;
  min-width: 0;
}
.xlc-input input:focus { outline: none; border-color: var(--xlc-color); }

.xlc-input button {
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 50%;
  background: var(--xlc-color);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.xlc-input button svg { width: 19px; height: 19px; fill: #fff; }
.xlc-input button:hover { filter: brightness(1.08); }

/* ── Φόρμα στοιχείων ─────────────────────────────────────────────────── */

.xlc-bub.xlc-form { max-width: 100%; width: 100%; }

.xlc-form-t { font-weight: 600; margin-bottom: 10px; }

.xlc-form input[type="text"],
.xlc-form input[type="email"],
.xlc-form input[type="tel"] {
  width: 100%;
  border: 1px solid var(--xlc-line);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 7px;
  font-size: 14px;
  font-family: inherit;
  color: var(--xlc-text);
  background: #fff;
}
.xlc-form input:focus { outline: none; border-color: var(--xlc-color); }

.xlc-consent {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; color: var(--xlc-dim);
  margin: 8px 0 4px;
  cursor: pointer;
  line-height: 1.45;
}
.xlc-consent input { margin-top: 2px; flex: none; }
.xlc-consent a { color: var(--xlc-color); }

.xlc-form-err {
  color: #d63638;
  font-size: 12.5px;
  min-height: 17px;
  margin-bottom: 4px;
}

.xlc-f-send, .xlc-f-skip {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.xlc-f-send {
  background: var(--xlc-color);
  color: #fff;
  width: 100%;
  margin-bottom: 5px;
}
.xlc-f-send:disabled { opacity: .6; cursor: default; }
.xlc-f-skip {
  background: none;
  color: var(--xlc-dim);
  width: 100%;
  font-weight: 400;
}
.xlc-f-skip:hover { color: var(--xlc-text); }

/* ── Ενσωματωμένο σε σελίδα (shortcode) ──────────────────────────────── */

.xlc-root.xlc-inline-mode {
  position: static;
  z-index: auto;
}
.xlc-root.xlc-inline-mode .xlc-panel {
  position: static;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 520px;
  max-height: none;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .09);
  border: 1px solid var(--xlc-line);
}
.xlc-inline { width: 100%; }

/* ── Κινητά ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .xlc-root { bottom: 14px; }
  .xlc-root.xlc-right { right: 14px; }
  .xlc-root.xlc-left  { left: 14px; }

  .xlc-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    bottom: 0;
  }

  .xlc-root.xlc-inline-mode .xlc-panel { position: static; height: auto; }
}

/* ── Προσβασιμότητα ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .xlc-panel, .xlc-launcher, .xlc-chip { transition: none; }
  .xlc-typing span { animation: none; opacity: .6; }
}

/* Σκούρα θέματα: μόνο αν ο επισκέπτης το έχει ζητήσει από το σύστημά του. */
@media (prefers-color-scheme: dark) {
  .xlc-root:not([data-xlc-theme="light"]) {
    --xlc-bg:   #1b1f27;
    --xlc-text: #e8eaf0;
    --xlc-dim:  #9aa1b2;
    --xlc-line: #2f3542;
  }
  .xlc-root:not([data-xlc-theme="light"]) .xlc-body,
  .xlc-root:not([data-xlc-theme="light"]) .xlc-chips { background: #151821; }
  .xlc-root:not([data-xlc-theme="light"]) .xlc-m-bot .xlc-bub,
  .xlc-root:not([data-xlc-theme="light"]) .xlc-input,
  .xlc-root:not([data-xlc-theme="light"]) .xlc-input input,
  .xlc-root:not([data-xlc-theme="light"]) .xlc-chip,
  .xlc-root:not([data-xlc-theme="light"]) .xlc-form input { background: var(--xlc-bg); color: var(--xlc-text); }
}
