/**
 * VibeBot Enhanced Frontend Styles
 * Version: 1.1 (Added GDPR Banner Styles)
 */

/* === 0. Alap Változók === */
:root {
  --vibebot-primary-color: #2a9d8f; /* Türkiz */
  --vibebot-secondary-color: #e9c46a; /* Sárgás (opcionális) */
  --vibebot-bg-color: #ffffff;
  --vibebot-container-bg: #f9fafa;
  --vibebot-text-dark: #1e2a38;
  --vibebot-text-light: #555;
  --vibebot-user-msg-bg: #e6f5f3; /* Világos türkiz a user üzenetekhez */
  --vibebot-bot-msg-bg: #ffffff;
  --vibebot-border-color: #e8e8e8;
  --vibebot-shadow-light: rgba(0, 0, 0, 0.05);
  --vibebot-shadow-medium: rgba(0, 0, 0, 0.1);
  --vibebot-shadow-heavy: rgba(0, 0, 0, 0.15);
  --vibebot-font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --vibebot-border-radius: 12px;
  --vibebot-border-radius-large: 24px;
  --vibebot-focus-ring-color: rgba(42, 157, 143, 0.3); /* Fókusz jelzés színe */
}

/* === 1. Lebegő Gomb === */
.vibebot-floating-button {
  position: fixed;
  bottom: 25px;
  right: calc(env(safe-area-inset-right, 0px) + 25px);
  width: 60px;
  height: 60px;
  background-color: var(--vibebot-bg-color);
  border-radius: 50%;
  cursor: pointer;
  z-index: 9998; /* Chat ablak alatt */
  box-shadow: 0 8px 20px var(--vibebot-shadow-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease;
  border: 1px solid var(--vibebot-border-color);
}

.vibebot-floating-button:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 25px var(--vibebot-shadow-heavy);
}

/* Fókusz jelzés billentyűzetnavigációhoz */
.vibebot-floating-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--vibebot-focus-ring-color), 0 8px 20px var(--vibebot-shadow-medium);
}

.vibebot-floating-button img.chat-logo {
  width: 50px; /* Kisebb logo, több padding */
  height: 50px;
  object-fit: contain;
  border-radius: 50%;
}

/* === 2. Chat Konténer === */
#vibebot-container {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 370px;
  max-height: calc(100vh - 120px);
  min-height: 450px;
  display: none; /* Kezdetben rejtett, JS kezeli */
  z-index: 9999;
  box-shadow: 0 15px 40px var(--vibebot-shadow-heavy);
  border-radius: var(--vibebot-border-radius-large);
  background-color: var(--vibebot-container-bg);
  font-family: var(--vibebot-font-family);
  border: 1px solid var(--vibebot-border-color);
  overflow: hidden; /* Fontos a belső elemek (pl. radius) miatt */
  flex-direction: column;
}

/* Nyitó/záró animációk (JS adja hozzá/veszi el az osztályokat) */
#vibebot-container.fade-in {
  animation: vibebot-fadeInUp 0.35s ease-out forwards;
}
#vibebot-container.fade-out {
  animation: vibebot-fadeOutDown 0.3s ease-in forwards;
}
@keyframes vibebot-fadeInUp {
  from { opacity: 0; transform: translateY(15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes vibebot-fadeOutDown {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(15px) scale(0.98); }
}

/* === 3. Chatbox Belső Szerkezet === */
#vibebot-chatbox {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background-color: var(--vibebot-bg-color);
  position: relative;
  border-radius: var(--vibebot-border-radius-large);
  overflow: hidden; /* Biztosítja, hogy a sarkok le legyenek kerekítve */
}

/* === 4. Fejléc (Header) === */
#vibebot-header {
  padding: 20px 25px 15px 25px;
  background: linear-gradient(135deg, var(--vibebot-bg-color) 0%, #fdfdfd 100%);
  border-bottom: 1px solid var(--vibebot-border-color);
  text-align: center;
  position: relative; /* Bezárás gomb pozicionálásához */
  cursor: default; /* JS állítja 'move'-ra, ha nyitva van */
  border-top-left-radius: var(--vibebot-border-radius-large);
  border-top-right-radius: var(--vibebot-border-radius-large);
  user-select: none; /* Ne jelölje ki a szöveget húzás közben */
}

#vibebot-header h3 {
  margin: 0 0 5px 0;
  font-size: 1.3em;
  font-weight: 600;
  color: var(--vibebot-primary-color);
}

#vibebot-header .vibebot-subtitle {
  margin: 0;
  font-size: 0.85em;
  color: var(--vibebot-text-light);
  line-height: 1.4;
}

/* Bezárás Gomb (SVG) */
.vibebot-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}
.vibebot-close-btn:hover {
  background-color: rgba(0,0,0,0.05);
}
.vibebot-close-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--vibebot-text-light);
  stroke-width: 2.5;
}
.vibebot-close-btn:focus-visible {
  outline: none;
  background-color: rgba(0,0,0,0.05);
  box-shadow: 0 0 0 3px var(--vibebot-focus-ring-color);
}


/* === 5. Üzenet Lista === */
#vibebot-messages {
  flex: 1; /* Kitölti a rendelkezésre álló helyet a fejléc és input között */
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 12px;
  overflow-y: auto; /* Csak ez az elem görgethető */
  background-color: var(--vibebot-bg-color);
  scroll-behavior: smooth;
  box-sizing: border-box;
  min-height: 100px; /* Minimális magasság */
}

/* Scrollbar stílus (Webkit - Chrome, Safari, Edge) */
#vibebot-messages::-webkit-scrollbar {
  width: 6px;
}
#vibebot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}
#vibebot-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}
#vibebot-messages::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}
/* Opcionális: Firefox scrollbar stílus (egyszerűbb) */
/*
#vibebot-messages {
  scrollbar-width: thin;
  scrollbar-color: #ccc #f1f1f1;
}
*/


/* === 6. Üzenet Buborékok === */
.vibebot-message {
  max-width: 85%;
  font-size: 0.95em;
  line-height: 1.55;
  padding: 10px 15px;
  border-radius: var(--vibebot-border-radius);
  white-space: pre-wrap; /* Megőrzi a sortöréseket és szóközöket */
  word-wrap: break-word; /* Régebbi böngészők */
  overflow-wrap: break-word; /* Szavak törése, ha túl hosszúak */
  box-shadow: 0 1px 3px var(--vibebot-shadow-light);
  position: relative;
  /* Animáció új üzenetekhez */
  opacity: 0;
  transform: translateY(5px);
  animation: vibebot-messageFadeIn 0.4s ease forwards;
}
@keyframes vibebot-messageFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

.vibebot-message.user {
  align-self: flex-end;
  background-color: var(--vibebot-user-msg-bg);
  color: var(--vibebot-text-dark);
  margin-left: auto;
  border-bottom-right-radius: 4px; /* Kissé eltérő sarok */
}

.vibebot-message.bot {
  align-self: flex-start;
  background-color: var(--vibebot-bot-msg-bg);
  color: var(--vibebot-text-dark);
  margin-right: auto;
  border: 1px solid var(--vibebot-border-color);
  border-bottom-left-radius: 4px; /* Kissé eltérő sarok */
}

/* Markdown stílusok az üzeneteken belül */
.vibebot-message strong, .vibebot-message b {
  font-weight: 600;
  color: inherit;
}
.vibebot-message em, .vibebot-message i {
  font-style: italic;
  color: #444;
}
.vibebot-message a {
  color: var(--vibebot-primary-color);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.vibebot-message a:hover {
  border-bottom-color: var(--vibebot-primary-color);
}
.vibebot-message a::after { /* Kis külső link jelzés */
  content: ' \2197'; /* Unicode külső link ikon (jobb escape)*/
  font-size: 0.8em;
  display: inline-block;
  margin-left: 3px;
  opacity: 0.6;
  text-decoration: none !important;
  border-bottom: none !important;
}
.vibebot-message ul, .vibebot-message ol {
    padding-left: 20px;
    margin-top: 5px;
    margin-bottom: 5px;
}
.vibebot-message li {
    margin-bottom: 3px;
}

/* Hibaüzenet Stílus */
.vibebot-message.error {
  background-color: #fff0f0;
  color: #c00;
  border: 1px solid #fcc;
}

/* === 7. Gépelési Animáció === */
#vibebot-typing-indicator {
  padding: 10px 20px;
  align-self: flex-start;
  margin-right: auto;
  display: none; /* JS kezeli a megjelenítést */
}
.vibebot-message.typing-bubble {
  background-color: var(--vibebot-bot-msg-bg);
  border: 1px solid var(--vibebot-border-color);
  border-bottom-left-radius: 4px;
  padding: 10px 15px;
  display: inline-block;
  box-shadow: 0 1px 3px var(--vibebot-shadow-light);
  border-radius: var(--vibebot-border-radius);
  opacity: 1;
  transform: none;
  animation: none;
  white-space: nowrap !important;/* <--- EZ AZ ÚJ SOR */
}
.vibebot-message.typing-bubble span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #ccc;
  border-radius: 50%;
  margin: 0 2px;
  animation: vibebot-typingAnim 1.2s infinite ease-in-out;
}
.vibebot-message.typing-bubble span:nth-child(1) { animation-delay: -0.30s; }
.vibebot-message.typing-bubble span:nth-child(2) { animation-delay: -0.15s; }
.vibebot-message.typing-bubble span:nth-child(3) { animation-delay: 0s; }

@keyframes vibebot-typingAnim {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.0); opacity: 1; }
}

/* === 8. Gyors Válaszok (Quick Replies) === */
#vibebot-quick-replies-container { /* A konténer, amit a JS kezel */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px 5px 20px; /* Input fölé, kis alsó padding */
    justify-content: flex-start;
}
.vibebot-quick-reply-btn {
  background-color: #f0f2f5;
  color: var(--vibebot-primary-color);
  border: 1px solid var(--vibebot-border-color);
  padding: 6px 12px;
  border-radius: 15px; /* Oválisabb */
  font-size: 0.85em;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-weight: 500;
  appearance: none; /* Eltávolítja az alapértelmezett OS stílusokat */
}
.vibebot-quick-reply-btn:hover {
  background-color: var(--vibebot-user-msg-bg);
  border-color: var(--vibebot-primary-color);
  color: #1e7b72;
  box-shadow: 0 2px 5px var(--vibebot-shadow-light);
}
.vibebot-quick-reply-btn:focus-visible {
  outline: none;
  border-color: var(--vibebot-primary-color);
  box-shadow: 0 0 0 3px var(--vibebot-focus-ring-color);
}

/* === 9. Beviteli Terület === */
#vibebot-input-area {
  /* position: sticky; volt eredetileg, lehetnek vele gondok overflow mellett */
  bottom: 0;
  left: 0;
  right: 0;
  background: #fdfdfd;
  padding: 15px 20px;
  /* Biztonsági terület figyelembevétele mobilokon */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 15px);
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--vibebot-border-color);
  box-shadow: 0 -4px 15px var(--vibebot-shadow-light);
  border-bottom-left-radius: var(--vibebot-border-radius-large);
  border-bottom-right-radius: var(--vibebot-border-radius-large);
  z-index: 10; /* Legyen más elemek fölött a chatboxon belül */
}

/* Chat törlése gomb */
.vibebot-clear-chat-btn {
  background: none;
  border: none;
  padding: 5px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  display: flex; /* SVG igazításához */
  border-radius: 50%; /* Kerek háttér hover/focus esetén */
}
.vibebot-clear-chat-btn:hover {
  opacity: 1;
  background-color: rgba(0,0,0,0.03);
}
.vibebot-clear-chat-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--vibebot-text-light);
}
.vibebot-clear-chat-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: transparent;
}
.vibebot-clear-chat-btn:focus-visible {
  opacity: 1;
  outline: none;
  box-shadow: 0 0 0 3px var(--vibebot-focus-ring-color);
  background-color: rgba(0,0,0,0.03);
}

#vibebot-input {
  flex: 1; /* Kitölti a maradék helyet */
  padding: 10px 15px;
  font-size: 0.95em;
  border: 1px solid #ccc;
  border-radius: var(--vibebot-border-radius);
  outline: none;
  background-color: var(--vibebot-bg-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: none; /* Ha textarea lenne, ne legyen átméretezhető */
}
#vibebot-input:focus {
  border-color: var(--vibebot-primary-color);
  box-shadow: 0 0 0 3px var(--vibebot-focus-ring-color);
}
#vibebot-input::placeholder {
  color: #aaa;
  transition: color 0.2s ease;
}
#vibebot-input:focus::placeholder {
  color: #ccc;
}
#vibebot-input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

#vibebot-send {
  background-color: var(--vibebot-primary-color);
  color: #ffffff;
  border: none;
  width: 40px; /* Négyzetes gomb */
  height: 40px;
  border-radius: var(--vibebot-border-radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.15s ease;
  flex-shrink: 0; /* Ne zsugorodjon */
}
#vibebot-send svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}
#vibebot-send:hover {
  background-color: #21867a; /* Kicsit sötétebb türkiz */
  transform: scale(1.05);
}
#vibebot-send:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: scale(1);
}
#vibebot-send:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--vibebot-focus-ring-color);
  background-color: #21867a;
}


/* === 10. Reszponzivitás === */
/* Fontos, hogy a media query a végén legyen, hogy felülírja az alapstílusokat */
@media screen and (max-width: 480px) {
  #vibebot-container {
    right: 10px;
    left: 10px; /* Középre igazítás helyett inkább foglalja el a szélességet */
    width: auto; /* Felülírja a fix szélességet */
    bottom: 85px; /* Gomb fölé */
    max-height: calc(100vh - 100px); /* Kicsit több hely */
    min-height: 0; /* Engedjük zsugorodni */
    border-radius: var(--vibebot-border-radius); /* Kisebb radius mobilon */
  }
  #vibebot-chatbox {
    border-radius: var(--vibebot-border-radius);
  }
  #vibebot-header {
    padding: 15px 45px 12px 15px; /* Hely a bezárás gombnak jobbra */
    border-top-left-radius: var(--vibebot-border-radius);
    border-top-right-radius: var(--vibebot-border-radius);
  }
  #vibebot-header h3 { font-size: 1.1em; }
  #vibebot-header .vibebot-subtitle { font-size: 0.8em; }
  .vibebot-close-btn { top: 10px; right: 10px; width: 32px; height: 32px; } /* Kicsit nagyobb érintési felület */
  #vibebot-messages { padding: 15px; gap: 10px; }
  .vibebot-message { font-size: 0.9em; padding: 8px 12px; max-width: 90%; }

  #vibebot-quick-replies-container { padding: 10px 15px 5px 15px; }

  #vibebot-input-area {
    padding: 10px 15px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    gap: 8px;
    border-bottom-left-radius: var(--vibebot-border-radius);
    border-bottom-right-radius: var(--vibebot-border-radius);
  }
  #vibebot-input { padding: 8px 12px; font-size: 0.9em;}
  #vibebot-send { width: 36px; height: 36px; }
  #vibebot-send svg { width: 16px; height: 16px; }
  .vibebot-clear-chat-btn svg { width: 16px; height: 16px; }

  .vibebot-floating-button {
    bottom: 20px;
    right: calc(env(safe-area-inset-right, 0px) + 20px);
    width: 55px;
    height: 55px;
  }
  .vibebot-floating-button img.chat-logo {
    width: 45px;
    height: 45px;
  }
}

/* === 11. GDPR Banner Styles === */
/* ============================== */

.vibebot-gdpr-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(44, 62, 80, 0.95); /* Sötétebb, enyhén áttetsző */
  color: #ecf0f1;
  padding: 18px 22px;
  z-index: 10000; /* Legyen minden felett, még a chat ikon felett is, ha az alacsonyabb z-indexű */
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-wrap: wrap; /* Tördelés kisebb képernyőn */
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  font-family: var(--vibebot-font-family); /* Használjuk az alap fontot */
  font-size: 13px; /* Kicsit kisebb alap betűméret */
  line-height: 1.45;
  border-top: 1px solid rgba(236, 240, 241, 0.2);
}

.vibebot-gdpr-banner[hidden] {
  display: none; /* JS kezeli a 'hidden' attribútumot */
}

.vibebot-gdpr-banner.show {
  opacity: 1;
  transform: translateY(0); /* Becsúszik alulról */
}

.vibebot-gdpr-content {
  flex-grow: 1; /* Kitölti a rendelkezésre álló helyet a gombok mellett */
  margin-right: 20px; /* Kis távolság a gomboktól */
}

.vibebot-gdpr-heading {
  margin: 0 0 6px 0;
  font-size: 1.15em; /* Kicsit nagyobb cím */
  font-weight: 600;
  color: #ffffff;
}

.vibebot-gdpr-text {
  margin: 0;
  color: #bdc3c7; /* Halványabb szürke a leíráshoz */
}

.vibebot-gdpr-link {
  color: #5dade2; /* Világosabb kék link */
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
  background: none; /* Ne legyen háttere */
  border: none; /* Ne legyen kerete */
  padding: 0; /* Ne legyen paddingja */
  cursor: pointer; /* Mutasson kéz kurzort */
  font-size: inherit; /* Örökölje a betűméretet */
  font-family: inherit; /* Örökölje a fontot */
}

.vibebot-gdpr-link:hover,
.vibebot-gdpr-link:focus {
  color: #8ecff0; /* Világosabb kék hoverkor */
  outline: none; /* Alapértelmezett focus outline eltüntetése (ha van :focus-visible) */
}
/* Ajánlott egy focus-visible stílus a linkhez is */
.vibebot-gdpr-link:focus-visible {
    outline: 1px dotted #5dade2;
    outline-offset: 2px;
}

.vibebot-gdpr-actions {
  display: flex;
  gap: 12px; /* Távolság a gombok között */
  flex-shrink: 0; /* Ne zsugorodjanak a gombok */
}

.vibebot-gdpr-button {
  padding: 9px 16px;
  border: none;
  border-radius: 6px; /* Enyhén lekerekített sarkok */
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600; /* Kicsit vastagabb */
  transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  white-space: nowrap; /* Ne törjenek a gombok szövegei */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.vibebot-gdpr-button.accept {
  background-color: var(--vibebot-primary-color); /* Használjuk a fő türkiz színt */
  color: #ffffff;
}
.vibebot-gdpr-button.accept:hover { background-color: #21867a; /* Kicsit sötétebb türkiz */ }

.vibebot-gdpr-button.secondary {
  background-color: #3498db; /* Kék a 'csak szükséges'-hez */
  color: #ffffff;
}
.vibebot-gdpr-button.secondary:hover { background-color: #2980b9; }

.vibebot-gdpr-button.decline {
  background-color: #bdc3c7; /* Világosabb szürke */
  color: #2c3e50; /* Sötét szöveg */
}
.vibebot-gdpr-button.decline:hover { background-color: #dde1e2; }

/* Focus styles for accessibility */
.vibebot-gdpr-button:focus-visible {
   outline: 2px solid #ffffff;
   outline-offset: 2px;
}
.vibebot-gdpr-button.accept:focus-visible { outline-color: var(--vibebot-primary-color); } /* Türkiz fókusz */
.vibebot-gdpr-button.secondary:focus-visible { outline-color: #2980b9; }
.vibebot-gdpr-button.decline:focus-visible { outline-color: #95a5a6; }


.vibebot-gdpr-button:active {
    transform: scale(0.98); /* Kisebb lenyomás effekt */
    box-shadow: none; /* Árnyék eltüntetése lenyomáskor */
}

/* Responsive adjustments for the banner */
@media screen and (max-width: 768px) {
  .vibebot-gdpr-banner {
    flex-direction: column; /* Elemek egymás alá kerülnek */
    align-items: stretch; /* Kitöltik a rendelkezésre álló szélességet */
    text-align: center; /* Szöveg középre igazítása */
    padding: 15px; /* Kisebb padding mobilon */
  }
  .vibebot-gdpr-content {
     margin-right: 0; /* Nincs margó a tartalom mellett */
     margin-bottom: 15px; /* Térköz a szöveg és a gombok között */
  }
  .vibebot-gdpr-actions {
    width: 100%; /* Teljes szélesség */
    justify-content: center; /* Gombok középre igazítása */
    gap: 8px; /* Kisebb rés a gombok között */
  }
   .vibebot-gdpr-button {
       padding: 8px 12px; /* Kisebb gombok */
       font-size: 0.85em; /* Kisebb betűméret */
   }
}

/* === END GDPR Banner Styles === */