/* PEC Chat – εμφάνιση. Όλοι οι κανόνες περιορίζονται στο #pec-chat για να μην επηρεάζουν το θέμα. */

#pec-chat {
  --pecc-ink: #000000;
  --pecc-paper: #ffffff;
  --pecc-ground: #f4f5f5;
  --pecc-line: #d4d4d4;
  --pecc-muted: #595959;
  --pecc-field: #8a8a8a;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--pecc-ink);
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

#pec-chat *,
#pec-chat *::before,
#pec-chat *::after { box-sizing: border-box; }

#pec-chat [hidden] { display: none !important; }

#pec-chat p { margin: 0; }

#pec-chat button,
#pec-chat input,
#pec-chat select {
  font-family: inherit;
  color: inherit;
  margin: 0;
  letter-spacing: normal;
  text-transform: none;
  box-shadow: none;
}

#pec-chat button { cursor: pointer; }
#pec-chat button:disabled { cursor: default; opacity: 0.5; }

#pec-chat a { color: var(--pecc-ink); text-underline-offset: 2px; }
#pec-chat a:hover { color: #3a3a3a; }

#pec-chat :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

#pec-chat .pecc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- σήμα «P» ---------- */

#pec-chat .pecc-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 2px;
  background: var(--pecc-paper);
  color: var(--pecc-ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

#pec-chat .pecc-mark-lg { width: 38px; height: 38px; }

#pec-chat .pecc-mark-sm {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
  font-size: 13px;
}

/* ---------- κουμπί και μήνυμα στη σελίδα ---------- */

#pec-chat .pecc-launcher {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px 0 8px;
  border: 0;
  border-radius: 4px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  font-size: 15px;
  font-weight: 600;
}

#pec-chat .pecc-launcher-close { display: none; }

#pec-chat.is-open .pecc-launcher {
  width: 56px;
  padding: 0;
  justify-content: center;
}

#pec-chat.is-open .pecc-launcher > .pecc-mark,
#pec-chat.is-open .pecc-launcher-label { display: none; }

#pec-chat.is-open .pecc-launcher-close { display: inline-flex; }

#pec-chat .pecc-teaser {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  width: 280px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--pecc-ink);
  border-radius: 4px;
  background: var(--pecc-paper);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

#pec-chat .pecc-teaser-text {
  flex: 1;
  padding: 10px 0;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.45;
  text-align: left;
}

#pec-chat .pecc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
}

#pec-chat .pecc-teaser-close { color: var(--pecc-muted); }

/* ---------- παράθυρο ---------- */

#pec-chat .pecc-panel {
  display: flex;
  flex-direction: column;
  width: 380px;
  height: 648px;
  max-height: calc(100vh - 116px);
  max-height: calc(100dvh - 116px);
  overflow: hidden;
  border: 1px solid var(--pecc-ink);
  border-radius: 4px;
  background: var(--pecc-paper);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

#pec-chat .pecc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px 10px 14px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
}

#pec-chat .pecc-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

#pec-chat .pecc-title { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.3; }
#pec-chat .pecc-sub { font-size: 12.5px; color: #d6d6d6; line-height: 1.3; }
#pec-chat .pecc-close { color: var(--pecc-paper); }

/* λωρίδα «πινακίδα σχεδίου» */
#pec-chat .pecc-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--pecc-ink);
}

#pec-chat .pecc-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 44px;
  padding: 8px 10px;
  border-right: 1px solid var(--pecc-ink);
  line-height: 1.25;
}

#pec-chat .pecc-cell:last-child { border-right: 0; }
#pec-chat .pecc-cell-label { font-size: 11.5px; color: var(--pecc-muted); }
#pec-chat .pecc-cell-value { font-size: 13px; font-weight: 600; }
#pec-chat .pecc-cell-link { text-decoration: none; color: var(--pecc-ink); }
#pec-chat .pecc-cell-link .pecc-cell-value { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- μηνύματα ---------- */

#pec-chat .pecc-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  padding: 18px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--pecc-ground);
}

#pec-chat .pecc-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#pec-chat .pecc-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--pecc-line);
  border-radius: 2px;
  background: var(--pecc-paper);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

#pec-chat .pecc-bubble.pecc-error { border-color: var(--pecc-ink); }
#pec-chat .pecc-strong { font-weight: 600; }

#pec-chat .pecc-user {
  align-self: flex-end;
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 2px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

#pec-chat .pecc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 34px;
}

#pec-chat .pecc-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#pec-chat .pecc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--pecc-ink);
  border-radius: 2px;
  background: var(--pecc-paper);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
}

#pec-chat .pecc-chip:hover { background: #ececec; }

#pec-chat .pecc-chip.is-primary {
  background: var(--pecc-ink);
  color: var(--pecc-paper);
  font-weight: 600;
}

#pec-chat .pecc-chip.is-primary:hover { background: #2b2b2b; }

#pec-chat .pecc-typing {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 14px 14px;
}

#pec-chat .pecc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pecc-ink);
  animation: pecc-blink 1.2s infinite ease-in-out;
}

#pec-chat .pecc-dot:nth-child(3) { animation-delay: 0.2s; }
#pec-chat .pecc-dot:nth-child(4) { animation-delay: 0.4s; }

@keyframes pecc-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ---------- κάρτες: φόρμα και επιβεβαίωση ---------- */

#pec-chat .pecc-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--pecc-ink);
  border-radius: 2px;
  background: var(--pecc-paper);
}

#pec-chat .pecc-card-title {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pecc-ink);
  letter-spacing: normal;
  text-transform: none;
}

#pec-chat .pecc-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--pecc-line);
  border-radius: 2px;
  background: var(--pecc-ground);
}

#pec-chat .pecc-summary-label { font-size: 11.5px; color: var(--pecc-muted); }
#pec-chat .pecc-summary-value { font-size: 13.5px; font-weight: 500; line-height: 1.4; }

#pec-chat .pecc-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#pec-chat .pecc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#pec-chat .pecc-field label,
#pec-chat .pecc-fieldset legend {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

#pec-chat .pecc-field input,
#pec-chat .pecc-field select,
#pec-chat .pecc-input {
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--pecc-field);
  border-radius: 2px;
  background: var(--pecc-paper);
  color: var(--pecc-ink);
  font-size: 16px; /* 16px: το iPhone δεν κάνει ζουμ στο πεδίο */
  line-height: normal;
}

#pec-chat input::placeholder { color: #6b6b6b; opacity: 1; }

#pec-chat .pecc-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#pec-chat .pecc-fieldset legend { padding: 0; margin-bottom: 4px; }
#pec-chat .pecc-optional { font-weight: 400; color: var(--pecc-muted); }

#pec-chat .pecc-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#pec-chat .pecc-consent input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--pecc-ink);
}

#pec-chat .pecc-consent label { font-size: 12.5px; line-height: 1.45; }

#pec-chat .pecc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

#pec-chat .pecc-form-error { font-size: 12.5px; font-weight: 600; line-height: 1.45; }

#pec-chat .pecc-submit {
  height: 44px;
  border: 0;
  border-radius: 2px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
  font-size: 14px;
  font-weight: 600;
}

#pec-chat .pecc-done-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

#pec-chat .pecc-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 2px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
}

#pec-chat .pecc-done-text { font-size: 14px; line-height: 1.5; }

#pec-chat .pecc-call {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--pecc-ink);
  border-radius: 2px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- κάτω μέρος ---------- */

#pec-chat .pecc-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 10px;
  border-top: 1px solid var(--pecc-ink);
  background: var(--pecc-paper);
}

#pec-chat .pecc-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

#pec-chat .pecc-input { flex: 1; min-width: 0; padding: 0 12px; }

#pec-chat .pecc-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--pecc-ink);
  color: var(--pecc-paper);
}

#pec-chat .pecc-note { font-size: 11.5px; line-height: 1.45; color: var(--pecc-muted); }

/* ---------- κινητό: πλήρης οθόνη ---------- */

@media (max-width: 600px) {
  #pec-chat {
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  #pec-chat .pecc-teaser { width: min(280px, calc(100vw - 32px)); }

  #pec-chat.is-open {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: stretch;
    gap: 0;
  }

  #pec-chat.is-open .pecc-panel {
    flex: 1;
    width: 100%;
    height: auto;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  #pec-chat.is-open .pecc-launcher { display: none; }

  #pec-chat .pecc-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  #pec-chat .pecc-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

html.pecc-lock,
html.pecc-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  #pec-chat .pecc-dot { animation: none; opacity: 0.6; }
}

@media print {
  #pec-chat { display: none !important; }
}
