/* ==========================================================================
   Base CSS Variables for Theming
   ========================================================================== */
:root {
    --chatbot-primary-color: #1a6f87;
    --chatbot-secondary-color: #ffffff;
    --chatbot-header-bg: var(--chatbot-primary-color);
    --chatbot-header-text: var(--chatbot-secondary-color);
    --chatbot-bg-color: var(--chatbot-secondary-color);
    --chatbot-user-bubble-bg: #e9f2ff;
    --chatbot-ai-bubble-bg: #f5f7f9;
    --chatbot-border-radius: 18px;
    --chatbot-button-size: 64px;
    --chatbot-icon-size: 38px;
    --chatbot-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
    --chatbot-transition-duration: .25s;
    --chatbot-font-family: system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}

/* ==========================================================================
   Container & Toggle Button (collapsed)
   ========================================================================== */
#wc-ai-chatbot-container {
    position: fixed;
    z-index: 9999;
    padding: 18px;
    font-family: var(--chatbot-font-family);
}
#wc-ai-chatbot-toggle.wc-ai-chatbot-button{
    width: var(--chatbot-button-size);
    height: var(--chatbot-button-size);
    border: 0;
    cursor: pointer;
    display: grid; place-items: center;
    background: var(--chatbot-primary-color);
    color: var(--chatbot-secondary-color);
    box-shadow: var(--chatbot-shadow);
    transition: transform var(--chatbot-transition-duration) ease, box-shadow var(--chatbot-transition-duration) ease;
}
#wc-ai-chatbot-toggle.circle{ border-radius: 9999px; }
#wc-ai-chatbot-toggle.square{ border-radius: 16px; }
#wc-ai-chatbot-toggle:hover{ transform: translateY(-1px); }
#wc-ai-chatbot-toggle:active{ transform: translateY(0); }

.wc-ai-chatbot-logo-icon{
    width: var(--chatbot-icon-size);
    height: var(--chatbot-icon-size);
    border-radius: 50%;
    overflow: hidden;
    background: var(--chatbot-secondary-color);
    display: block;
}
#wc-ai-chatbot-logo{ width:100%; height:100%; object-fit: cover; display:block; }

/* Soft pulse (optional) */
.wc-ai-chatbot-pulse{ position:absolute; inset:0; border-radius:inherit; pointer-events:none; }
#wc-ai-chatbot-toggle .wc-ai-chatbot-pulse{ animation: wc-ai-pulse 2.1s ease-out infinite; }
@keyframes wc-ai-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,0,0,.10); }
  70%{ box-shadow: 0 0 0 16px rgba(0,0,0,0); }
 100%{ box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* ==========================================================================
   Chat Panel (expanded)
   ========================================================================== */
#wc-ai-chatbot-frame-wrapper{
    position: fixed;
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: var(--chatbot-border-radius);
    box-shadow: var(--chatbot-shadow);
    overflow: hidden;
    transform: scale(.96);
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, opacity .2s ease;
}
#wc-ai-chatbot-frame-wrapper.is-open{
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.wc-ai-chatbot-header{
    height: 54px;
    background: var(--chatbot-header-bg);
    color: var(--chatbot-header-text);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 0 12px 0 16px;
}
.wc-ai-chatbot-header h4{
    margin: 0; font-size: 16px; font-weight: 700; letter-spacing:.2px;
}
.wc-ai-chatbot-close{
    background: transparent; border: 0; color: var(--chatbot-secondary-color);
    font-size: 26px; line-height: 1; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
}
.wc-ai-chatbot-close:hover{ background: rgba(255,255,255,.12); }

/* Body */
.wc-ai-chatbot-body{
    background:#fff;
    padding: 12px 12px 0;
    height: calc(100% - 54px - 62px);
    overflow-y:auto;
    display:flex; flex-direction:column; gap:10px;
}
.wc-ai-chatbot-message{
    max-width: 86%; margin: 4px 0; padding: 10px 12px;
    border-radius:14px; box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.wc-ai-chatbot-message.user{ background: var(--chatbot-user-bubble-bg); margin-left:auto; border-bottom-right-radius:6px; }
.wc-ai-chatbot-message.bot{  background: var(--chatbot-ai-bubble-bg);   margin-right:auto; border-bottom-left-radius:6px; }
.wc-ai-chatbot-message a{ color: var(--chatbot-primary-color); text-decoration: underline; }

/* Footer */
.wc-ai-chatbot-footer{
    display:grid; grid-template-columns: 1fr auto; gap: 8px;
    padding: 10px 12px 12px; background:#fff; border-top: 1px solid #eef1f4;
}
.wc-ai-chatbot-input{
    width:100%; height: 42px; border-radius: 12px; border:1px solid #e1e5ea; padding: 0 12px; outline:none;
    font: 16px/1.2 var(--chatbot-font-family);
}
.wc-ai-chatbot-send-btn{
    height: 42px; border-radius: 12px; border:0; padding: 0 14px;
    background: var(--chatbot-primary-color); color: var(--chatbot-secondary-color); font-weight: 600; cursor: pointer;
}

/* ==========================================================================
   Positioning classes
   ========================================================================== */
#wc-ai-chatbot-container.position-bottom-right { bottom: 0; right: 0; }
#wc-ai-chatbot-container.position-bottom-left  { bottom: 0; left: 0; }
#wc-ai-chatbot-container.position-bottom-center{ bottom: 0; left: 50%; transform: translateX(-50%); }

#wc-ai-chatbot-frame-wrapper.position-bottom-right{ right: 18px; bottom: calc(18px + var(--chatbot-button-size) + 16px); }
#wc-ai-chatbot-frame-wrapper.position-bottom-left { left: 18px;  bottom: calc(18px + var(--chatbot-button-size) + 16px); }
#wc-ai-chatbot-frame-wrapper.position-bottom-center{ left:50%; transform: translate(-50%, 0) scale(.96); }
#wc-ai-chatbot-frame-wrapper.position-bottom-center.is-open{ transform: translate(-50%, 0) scale(1); }

/* Mobile: fullscreen panel */
@media (max-width: 768px){
  #wc-ai-chatbot-container{ padding: 12px; }
  #wc-ai-chatbot-frame-wrapper{
      right: 0; left: 0; bottom: 0; top: 0;
      width: 100%; height: 100%; max-width:none; max-height:none; border-radius:0;
  }
}

/* ===== FIX: normalize the floating toggle button ===== */
#wc-ai-chatbot-toggle.wc-ai-chatbot-button{
  /* wipe theme button defaults */
  all: unset;                 /* reset everything (safe for a dedicated control) */
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: var(--chatbot-button-size);
  height: var(--chatbot-button-size);
  background: var(--chatbot-primary-color);
  color: var(--chatbot-secondary-color);
  border-radius: 50% !important;   /* force a perfect circle by default */
  box-shadow: var(--chatbot-shadow);
  cursor: pointer;
  transition: transform var(--chatbot-transition-duration) ease, box-shadow var(--chatbot-transition-duration) ease;
}
#wc-ai-chatbot-toggle.wc-ai-chatbot-button.square{
  border-radius: 16px !important;  /* only if you pick "square" in settings */
}
#wc-ai-chatbot-toggle.wc-ai-chatbot-button:hover{ transform: translateY(-1px); }

/* The logo pill inside the button */
#wc-ai-chatbot-toggle .wc-ai-chatbot-logo-icon{
  width: var(--chatbot-icon-size);
  height: var(--chatbot-icon-size);
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  display: block;
}
#wc-ai-chatbot-toggle .wc-ai-chatbot-logo-icon img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
