/* ============================================================================
   LiveAgents Webchat Widget — Skin
   ----------------------------------------------------------------------------
   This file is intentionally self-contained so it can be themed per-site.
   To re-skin: override the CSS variables in the `.la-widget` block below.
   All colours/sizing are driven by these variables.
   ========================================================================== */

.la-widget {
  /* ---- Brand / theme tokens (Fast Fix: navy + orange, see assets/css/style1.css) ---- */
  --la-primary:        #f6a730;   /* brand orange: buttons, launcher, send */
  --la-primary-hover:  #e09621;
  --la-on-primary:     #12184b;   /* navy text on orange, matches site CTAs */
  --la-header-bg:      #12184b;   /* brand navy header, like the site header/footer */
  --la-header-accent:  #f6a730;   /* thin orange line under the header */
  --la-on-header:      #ffffff;

  --la-panel-bg:       #ffffff;
  --la-log-bg:         #f5f6f8;
  --la-agent-bg:       #ffffff;
  --la-agent-text:     #1f2937;
  --la-agent-border:   #e5e7eb;
  --la-customer-bg:    #12184b;   /* visitor bubbles in brand navy */
  --la-customer-text:  #ffffff;
  --la-link:           #12184b;   /* links inside agent messages */
  --la-meta:           #9aa3ad;
  --la-status-online:  #22c55e;

  /* ---- Layout tokens ---- */
  --la-offset-right:   20px;
  --la-offset-bottom:  20px;      /* nudge up if it clashes with a sticky bar */
  --la-panel-width:    360px;
  --la-panel-height:   520px;
  --la-radius:         12px;
  --la-z:              2147483000;
  --la-font:           system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------------------
   Launcher bubble (a floating chat bubble, bottom-right)
   ----------------------------------------------------------------------------
   Visible on this site — nothing in the page calls window.toggleLiveChat(),
   so the floating bubble is the only way to open the chat (same behaviour as
   the previous widget). To hide it on a site with its own chat buttons, add
   `.la-launcher { display: none; }` back here.
   ------------------------------------------------------------------------- */
.la-launcher {
  display: inline-flex;
  position: fixed;
  right: var(--la-offset-right);
  bottom: var(--la-offset-bottom);
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 22px 0 18px;
  border: none;
  border-radius: 999px;
  background: var(--la-primary);
  color: var(--la-on-primary);
  font-family: var(--la-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  z-index: var(--la-z);
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.la-launcher:hover {
  background: var(--la-primary-hover);
  transform: translateY(-2px);
}
.la-launcher-icon { flex: 0 0 auto; }

/* Hide the launcher while the panel is open */
.la-widget[data-open="true"] .la-launcher {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

/* ---------------------------------------------------------------------------
   Panel
   ------------------------------------------------------------------------- */
.la-panel {
  position: fixed;
  right: var(--la-offset-right);
  bottom: var(--la-offset-bottom);
  width: var(--la-panel-width);
  max-width: calc(100vw - 32px);
  height: var(--la-panel-height);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  background: var(--la-panel-bg);
  border-radius: var(--la-radius);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  font-family: var(--la-font);
  z-index: var(--la-z);

  /* hidden by default; animated in when open */
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.la-widget[data-open="true"] .la-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---- Header ---- */
.la-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--la-header-bg);
  border-bottom: 3px solid var(--la-header-accent);
  color: var(--la-on-header);
}
.la-head-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.la-head-logo {
  /* Wide logo (logo.png, same as the site header) sits straight on the navy header */
  width: 56px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}
.la-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.la-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.la-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.3;
}
.la-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--la-status-online);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  flex: 0 0 auto;
}

.la-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--la-on-header);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}
.la-icon-btn:hover { background: rgba(255, 255, 255, 0.24); }

/* ---- Message log ---- */
.la-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--la-log-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.la-msg {
  position: relative;
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.42;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  margin: 4px 0;
}
.la-msg .la-meta {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--la-meta);
}

.la-msg.la-customer {
  margin-left: auto;
  background: var(--la-customer-bg);
  color: var(--la-customer-text);
  border-bottom-right-radius: 4px;
}
.la-msg.la-customer .la-meta { color: rgba(255, 255, 255, 0.75); }

.la-msg.la-agent {
  margin-right: auto;
  background: var(--la-agent-bg);
  color: var(--la-agent-text);
  border: 1px solid var(--la-agent-border);
  border-bottom-left-radius: 4px;
}

/* Links inside agent messages */
.la-msg a {
  color: inherit;
  text-decoration: underline;
}
.la-msg.la-agent a { color: var(--la-link); font-weight: 600; }

/* Empty / connecting hint */
.la-hint {
  margin: auto;
  padding: 8px 14px;
  color: var(--la-meta);
  font-size: 13px;
  text-align: center;
}

/* ---- Composer ---- */
.la-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  flex: 0 0 auto;        /* never let the composer get squeezed */
  width: 100%;
  box-sizing: border-box;
  border-top: 1px solid var(--la-agent-border);
  background: var(--la-panel-bg);
}
.la-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 1px solid var(--la-agent-border);
  border-radius: 999px;
  padding: 11px 16px;
  font-family: var(--la-font);
  font-weight: 400;
  color: #1f2937;
  outline: none;
  background: #fff;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  transition: border-color 0.15s ease;
  /* MUST be >= 16px (and !important to beat any inherited cascade). iOS Safari
     auto-zooms the page whenever you focus an input smaller than 16px, which
     shifts the whole panel and pushes the send button off-screen. */
  font-size: 16px !important;
}
.la-input:focus { border-color: var(--la-primary); }

.la-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: none;
  border-radius: 50%;
  background: var(--la-primary);
  color: var(--la-on-primary);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.la-send:hover:not(:disabled) { background: var(--la-primary-hover); }
.la-send:active:not(:disabled) { transform: scale(0.92); }
.la-send:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---- Typing indicator ---- */
.la-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.la-typing .la-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--la-primary);
  opacity: 0.5;
  animation: la-bounce 1.2s infinite ease-in-out;
}
.la-typing .la-dot:nth-child(2) { animation-delay: 0.15s; }
.la-typing .la-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes la-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .la-panel {
    right: 0;
    left: 0;
    bottom: 0;
    top: auto;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .la-launcher-label { display: none; }
  .la-launcher { padding: 0; width: 56px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .la-panel, .la-launcher, .la-send { transition: none; }
  .la-typing .la-dot { animation: none; }
}
