/* ============================================= */
/* ==   WESLEY'S WITGOED - AICHAT STYLING v2.0   == */
/* ============================================= */

/* AANGEPAST: Huisstijl Variabelen */
:root {
  --aichat-brand-primary: #F36F21;
  --aichat-brand-dark: #e0651e;
  --aichat-brand-secondary: #333333;
  --aichat-bg-panel: #FFFFFF;
  --aichat-bg-body: #F8F9FA;
  --aichat-text-light: #FFFFFF;
  --aichat-text-dark: #333333;
  --aichat-border-color: #E5E7EB;
  --aichat-shadow: rgba(0, 0, 0, 0.1);
  --aichat-border-radius: 8px;
}

.aichat-root {
  position: fixed;
  right: var(--aichat-x, 20px);
  bottom: 83px;
  z-index: 88;
  /* AANGEPAST: Neemt nu het lettertype van je website over */
  font-family: inherit; 
  font-size: 16px;
}

/* Toggle button */
.aichat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.2rem;
  box-shadow: 0 8px 24px var(--aichat-shadow);
  cursor: pointer;
  /* AANGEPAST: Gebruikt nu de merkkleur */
  background: linear-gradient(135deg, #333, #646464) !important;
  color: var(--aichat-text-light);
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid gray;

}

.aichat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Panel */
.aichat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px); /* AANGEPAST: Startpositie net boven de knop */
  width: min(400px, calc(100vw - 32px));
  max-height: min(75vh, 700px);
  background: var(--aichat-bg-panel);
  border-radius: var(--aichat-border-radius);
  box-shadow: 0 16px 48px var(--aichat-shadow);
  overflow: hidden;
  display: none; /* Wordt 'flex' bij .open */
  flex-direction: column;
  border: 1px solid var(--aichat-border-color);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.aichat-panel.open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Header */
.aichat-header {
  padding: 14px 16px;
  /* AANGEPAST: Vaste kleur ipv gradient voor strakkere look */
  background: var(--aichat-brand-secondary);
  color: var(--aichat-text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.aichat-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.aichat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--aichat-brand-primary);
}

.aichat-dot { display: none; } /* Dot weggehaald, avatar is duidelijker */

/* AANGEPAST: Stijl voor de sluitknop (x-knop) in de header */
.aichat-xbtn {
  background-color: #FFFFFF!important; /* Witte achtergrond */
  border: 2px solid var(--aichat-brand-primary); /* Oranje rand */
  border-radius: 50%; /* Rond maken */
  width: 30px; /* Grootte aanpassen */
  height: 30px; /* Grootte aanpassen */
  display: flex; /* Voor centreren van de X */
  align-items: center;
  justify-content: center;
  font-size: 20px; /* Grootte van de X */
  line-height: 1;
  cursor: pointer;
  color: #404040!important; /* Oranje X */
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  padding: 0; /* Padding resetten */
  margin-top:0px;
  padding-bottom:3px;
}

.aichat-xbtn:hover {
  background-color: #fff!important; /* Oranje achtergrond bij hover */
  color: #FFFFFF; /* Witte X bij hover */
  border-color: var(--aichat-brand-primary); /* Oranje rand blijft */
  transform:scale(1.2);
}

/* Messages Body */
.aichat-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  background: var(--aichat-bg-body);
}

.aichat-msg {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.aichat-msg .bubble {
  padding: 10px 14px;
  border-radius: var(--aichat-border-radius);
  max-width: 85%;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.aichat-msg.user { align-items: flex-end; }
.aichat-msg.assistant { align-items: flex-start; } /* LET OP: class is .assistant, niet .ai */

/* AANGEPAST: Kleuren omgedraaid voor betere UX */
.aichat-msg.user .bubble {
  background: var(--aichat-brand-secondary);
  color: var(--aichat-text-light);
}

.aichat-msg.assistant .bubble {
  background: var(--aichat-bg-panel);
  color: var(--aichat-text-dark);
  border: 1px solid var(--aichat-border-color);
}

.aichat-msg.assistant .bubble a {
    color: var(--aichat-brand-primary);
    text-decoration: underline;
    font-weight: 600;
}

.aichat-time { display: none; } /* Tijdstip is vaak overbodig en maakt het druk */

/* Quick Replies */
.aichat-quick-replies {
    padding: 0 12px 8px;
    background-color: var(--aichat-bg-body);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.aichat-quick-btn {
    background-color: transparent;
    padding: 8px 12px;
    border-radius: 99px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.aichat-quick-btn:hover {
    background-color: var(--aichat-brand-primary);
    color: var(--aichat-text-light);
}


/* Footer */
.aichat-footer {
  border-top: 1px solid var(--aichat-border-color);
  background: var(--aichat-bg-panel);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.aichat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--aichat-border-color);
  border-radius: var(--aichat-border-radius);
  padding: 10px 14px;
  min-height: 44px;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aichat-input:focus {
  outline: none;
  border-color: var(--aichat-brand-primary);
  box-shadow: 0 0 0 3px rgba(243, 111, 33, 0.15);
}

.aichat-send {
  border: none;
  border-radius: var(--aichat-border-radius);
  padding: 10px 16px;
  background: var(--aichat-brand-primary);
  color: var(--aichat-text-light);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.aichat-send:hover {
  background: var(--aichat-brand-dark);
}


/* Typing Indicator */
.aichat-typing span {
  background: var(--aichat-brand-secondary);
}




/* === FIX 1: Bubble-styling laten werken voor zowel .assistant als .ai === */
.aichat-msg.user .bubble {
  background: #ff6b29;
  color: var(--aichat-text-light);
}
.aichat-msg.assistant .bubble,
.aichat-msg.ai .bubble {              /* <— extra selector */
  background: var(--aichat-bg-panel);
  color: var(--aichat-text-dark);
  border: 1px solid var(--aichat-border-color);
}
.aichat-msg.assistant .bubble a,
.aichat-msg.ai .bubble a {
  color: var(--aichat-brand-primary);
  text-decoration: underline;
  font-weight: 600;
}

/* === FIX 2: Typing-indicator compleet === */
.aichat-typing { 
  display: inline-block; 
  min-width: 30px; 
}
.aichat-typing span {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 3px;
  background: var(--aichat-brand-secondary);
  border-radius: 999px;
  animation: aichatBlink 1.2s infinite;
}
.aichat-typing span:nth-child(2) { animation-delay: .2s; }
.aichat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aichatBlink { 
  0%, 80%, 100% { opacity: .25 } 
  40% { opacity: 1 } 
}


/* Minder “zwevend” gevoel */
.aichat-panel{ border:1px solid #eaeaea; box-shadow:0 12px 28px rgba(0,0,0,.08); }
.aichat-msg .bubble{ box-shadow:0 1px 2px rgba(0,0,0,.04); }


/* === FIX 3: Headermeta (naam + tagline) stapelen, mocht het thema er tussendoor komen === */
.aichat-header .aichat-title { display:flex; align-items:center; gap:.75rem; }
.aichat-header .aichat-meta { display:flex; flex-direction:column; line-height:1.2; white-space:normal; }
.aichat-header .aichat-name { font-weight:700; font-size:14px; color: var(--aichat-text-light); }
.aichat-header .aichat-tagline { font-size:12px; color:#D6D6D6; }

/* (optioneel) iets subtielere schaduw op bubbles */
.aichat-msg .bubble { box-shadow: 0 1px 2px rgba(0,0,0,.04); }


#chatbotTooltip {
  position: fixed;
  right: 48px;
  bottom: 83px;
  max-width: 260px;
  background: #f4f4f4;
  color: #404040;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  pointer-events: none;
  z-index: 99999;
}

/* Panel klikt niet mee als 'ie dicht is */
.aichat-panel{ pointer-events:none; }
.aichat-panel.open{ pointer-events:auto; }

/* DESKTOP default (paneel rechts-onder, geen fullscreen) */
@media (min-width:601px){
  .aichat-panel{
    position:absolute;
    right:0;
    bottom:calc(100% + 12px);
    width:min(400px, calc(100vw - 32px));
    max-height:min(75vh, 700px);
  }
}


/* Tooltip blokkeert niets */
#chatbotTooltip{ pointer-events:none; }


.aichat-cta { margin-top:.75rem; text-align:center; }
.aichat-btn {
  display:inline-block;
  background:var(--aichat-brand,#111827);
  color:#fff;
  font-weight:600;
  text-decoration:none;
  padding:.6rem 1rem;
  border-radius:.5rem;
}
/* 1) Zet de chat in een eigen 'kooi' zodat hij z'n z-index (88) niet overschrijdt */
#aichat-root { isolation: isolate; }

/* 2) Als het mobiele menu actief is, chat verbergen en klikbaar maken = uit */
body:has(#hnav.menu_nav.active) #aichat-root {
  opacity: 0;
  pointer-events: none;
}


/* Overlay */
.chatbot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7); /* Zwarte overlay met 70% transparantie */
  z-index: 9998;
  display: none; /* begin verborgen */
}

/* Paneel boven de overlay */
.aichat-panel { z-index: 9999; }

/* Toon overlay zodra de chat open is (toggle deze state op je wrapper) */
#aichat-root.is-open .chatbot-overlay { display: block; }









































/* -- AICHAT MOBILE OVERRIDE (wins over template.css) -- */
@media (max-width: 600px) {
  /* Paneel = scroller, geen transforms/animaties die sticky breken */
  #aichat-root .aichat-panel.open {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;       /* paneel scrolt */
    -webkit-overflow-scrolling: touch !important;
    transform: none !important;
    animation: none !important;
    background: var(--aichat-bg-panel) !important;
  }

  /* Header blijft bovenin van de panel-scroller */
  #aichat-root .aichat-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
    background: var(--aichat-brand-secondary) !important;
  }

  /* Footer blijft onderin van de panel-scroller */
  #aichat-root .aichat-footer {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background: var(--aichat-bg-panel) !important;
    border-top: 1px solid var(--aichat-border-color) !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
  }

  /* Midden hoeft niet zelf te scrollen; ruimte maken voor header/footer */
  #aichat-root .aichat-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-top: 60px !important;      /* hoogte header */
    padding-bottom: 70px !important;   /* hoogte footer */
    background: var(--aichat-bg-body) !important;
  }

  /* Thema dat per ongeluk transform op root zet? Uitschakelen. */
  #aichat-root { transform: none !important; }
}



