/* =============================================================
   Foxco Chat Widget - Frontend Styles  v1.0.2
   https://foxco.net
   ============================================================= */

:root {
  --fcw-primary:  #1a1a2e;
  --fcw-accent:   #e63946;
  --fcw-text:     #ffffff;
  --fcw-bubble:   #f0f2f5;
  --fcw-font:     "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fcw-radius:   16px;
  --fcw-shadow:   0 20px 60px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.12);
  --fcw-z:        9999;
  --fcw-anim:     cubic-bezier(.34,1.56,.64,1);
}

#fcw-widget, #fcw-widget * {
  box-sizing: border-box; margin: 0; padding: 0;
  font-family: var(--fcw-font); -webkit-font-smoothing: antialiased;
}
#fcw-widget { position: fixed; z-index: var(--fcw-z); }
#fcw-widget.fcw-bottom-right { bottom: 24px; right: 24px; }
#fcw-widget.fcw-bottom-left  { bottom: 24px; left: 24px; }
#fcw-widget.fcw-top-right    { top: 24px; right: 24px; }
#fcw-widget.fcw-top-left     { top: 24px; left: 24px; }

/* LAUNCHER — always a circle FAB, no label */
.fcw-launcher {
  display: flex; align-items: center; justify-content: center;
  background: var(--fcw-accent); color: #fff; border: none;
  border-radius: 50%; width: 60px; height: 60px; padding: 0;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(0,0,0,.25),
    0 1px 4px rgba(0,0,0,.15),
    inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .2s var(--fcw-anim), box-shadow .2s ease;
  position: relative; animation: fcw-pulse 3s infinite 2s;
}
.fcw-launcher:hover { transform: translateY(-2px) scale(1.07); box-shadow: 0 8px 28px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.15); }
.fcw-launcher:active { transform: scale(.95); }
.fcw-launcher-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.fcw-launcher-icon svg { width: 28px; height: 28px; }
.fcw-launcher-label { display: none; }
.fcw-icon-close { display: none; }
.fcw-window--open .fcw-icon-chat  { display: none; }
.fcw-window--open .fcw-icon-close { display: block; }
.fcw-launcher-badge {
  position: absolute; top: -4px; right: -4px;
  background: #fff; color: var(--fcw-accent); border-radius: 50%;
  width: 20px; height: 20px; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.2); animation: fcw-badge-in .3s var(--fcw-anim);
}
.fcw-launcher-badge.visible { display: flex; }

/* CHAT WINDOW */
.fcw-window {
  position: absolute; bottom: calc(100% + 16px); right: 0;
  width: 370px; height: 560px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 22px; border: none;
  box-shadow: 0 24px 64px rgba(0,0,0,.16), 0 6px 20px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.04);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(20px) scale(.95); pointer-events: none;
  transition: opacity .25s ease, transform .3s var(--fcw-anim);
}
.fcw-bottom-left .fcw-window { right: auto; left: 0; }
.fcw-top-right   .fcw-window { bottom: auto; top: calc(100% + 16px); }
.fcw-top-left    .fcw-window { bottom: auto; top: calc(100% + 16px); right: auto; left: 0; }
.fcw-window--open .fcw-window { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

/* HEADER */
.fcw-header {
  background: var(--fcw-primary); color: var(--fcw-text);
  padding: 18px 16px 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; position: relative; overflow: hidden;
}
.fcw-header::before {
  content: ''; position: absolute; top: -55px; right: -45px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255,255,255,.08); pointer-events: none;
}
.fcw-header::after {
  content: ''; position: absolute; bottom: -35px; left: -15px;
  width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,.05); pointer-events: none;
}
.fcw-header-info { display: flex; align-items: center; gap: 12px; }
.fcw-avatar {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  position: relative; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.22); box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.fcw-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fcw-avatar-default { background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; }
.fcw-avatar-default svg { width: 26px; height: 26px; color: rgba(255,255,255,.7); }
.fcw-status-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 11px; height: 11px; border-radius: 50%; background: #2ecc71;
  border: 2px solid var(--fcw-primary); box-shadow: 0 0 0 1px rgba(0,0,0,.08);
  animation: fcw-status-pulse 2s infinite;
}
.fcw-title { display: block; font-size: 15px; font-weight: 800; line-height: 1.2; letter-spacing: -0.015em; }
.fcw-subtitle { display: block; font-size: 12px; opacity: .68; margin-top: 3px; }
.fcw-header-actions { display: flex; gap: 6px; }
.fcw-btn-icon {
  background: rgba(255,255,255,.12); border: none; border-radius: 9px;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(255,255,255,.8); transition: background .2s, color .2s;
}
.fcw-btn-icon:hover { background: rgba(255,255,255,.22); color: #fff; }
.fcw-btn-icon svg { width: 16px; height: 16px; }

/* SCREENS */
.fcw-screen { display: none; flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
.fcw-screen--active { display: flex; }

/* PRE-CHAT FORM */
#fcw-screen-prechat {
  padding: 24px 24px 28px; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; justify-content: center;
}
.fcw-prechat-hero { text-align: center; padding: 0 0 20px; }
.fcw-hero-icon { font-size: 48px; line-height: 1; margin-bottom: 12px; display: block; animation: fcw-bounce 2s ease infinite; }
.fcw-prechat-intro { font-size: 15px; color: #666; line-height: 1.55; }
.fcw-field { margin-bottom: 16px; }
.fcw-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #999; margin-bottom: 7px; }
.fcw-input {
  width: 100%; border: 2px solid #eaecf0; border-radius: 16px;
  padding: 14px 18px; font-size: 15px; color: #1a1a2e; background: #f8f9fb;
  transition: border-color .2s, box-shadow .2s, background .2s; outline: none;
  line-height: 1.4;
}
.fcw-input:focus { border-color: var(--fcw-accent); box-shadow: 0 0 0 4px rgba(230,57,70,.08); background: #fff; }
.fcw-input::placeholder { color: #c5c8d0; }
.fcw-error { font-size: 12px; color: #e63946; min-height: 16px; margin-bottom: 6px; font-weight: 500; }
.fcw-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: 16px; height: 52px; padding: 0 20px;
  font-size: 15px; font-weight: 700; cursor: pointer; letter-spacing: 0.01em;
  transition: transform .15s, box-shadow .2s, opacity .2s;
  margin-top: 4px;
}
.fcw-btn--primary { background: var(--fcw-accent); color: #fff; box-shadow: 0 4px 14px rgba(230,57,70,.35); }
.fcw-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(230,57,70,.4); }
.fcw-btn--primary:active { transform: scale(.98); }
.fcw-btn--primary svg { width: 17px; height: 17px; }
.fcw-btn--primary.loading { opacity: .7; pointer-events: none; }
.fcw-btn--ghost { background: #f4f5f7; color: #555; margin-top: 8px; border-radius: 14px; }
.fcw-btn--ghost:hover { background: #eaecef; }
.fcw-privacy { font-size: 11.5px; color: #aaa; text-align: center; margin-top: 14px; line-height: 1.4; }
.fcw-privacy a { color: var(--fcw-accent); text-decoration: none; }
.fcw-privacy a:hover { text-decoration: underline; }

/* MESSAGES */
#fcw-screen-chat { overflow: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fcw-messages {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 20px 16px 10px;
  display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth;
}
.fcw-messages::-webkit-scrollbar { width: 4px; }
.fcw-messages::-webkit-scrollbar-track { background: transparent; }
.fcw-messages::-webkit-scrollbar-thumb { background: #e0e3e8; border-radius: 4px; }
.fcw-msg { max-width: 80%; animation: fcw-msg-in .25s var(--fcw-anim); }
.fcw-msg--visitor { align-self: flex-end; }
.fcw-msg--agent, .fcw-msg--system { align-self: flex-start; }
.fcw-msg-bubble { padding: 11px 16px; font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.fcw-msg--visitor .fcw-msg-bubble {
  background: var(--fcw-accent); color: #fff;
  border-radius: 18px 18px 4px 18px; box-shadow: 0 1px 4px rgba(0,0,0,.14);
}
.fcw-msg--agent .fcw-msg-bubble {
  background: var(--fcw-bubble); color: #1a1a2e;
  border-radius: 18px 18px 18px 4px; box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.fcw-msg--system .fcw-msg-bubble {
  background: transparent; color: #999; font-size: 12px; font-style: italic;
  text-align: center; max-width: 100%; padding: 4px 0; border-radius: 0; box-shadow: none;
}
.fcw-msg-meta { font-size: 10px; color: #bbb; margin-top: 4px; padding: 0 2px; opacity: 0.55; }
.fcw-msg--visitor .fcw-msg-meta { text-align: right; }
.fcw-typing-indicator { display: flex; align-items: center; gap: 4px; padding: 0 20px 8px; }
.fcw-typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: #ccc; animation: fcw-typing 1.2s infinite; }
.fcw-typing-indicator span:nth-child(2) { animation-delay: .2s; }
.fcw-typing-indicator span:nth-child(3) { animation-delay: .4s; }

/* COMPOSER */
.fcw-composer {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(0,0,0,.07); background: #fff;
}
.fcw-composer-input {
  flex: 1; border: 1.5px solid #e8ebef; border-radius: 14px;
  padding: 11px 14px; font-size: 13.5px; resize: none; outline: none;
  max-height: 120px; overflow-y: auto; line-height: 1.45;
  transition: border-color .2s, background .2s;
  color: #1a1a2e; font-family: var(--fcw-font); background: #f8f9fb;
}
.fcw-composer-input:focus { border-color: var(--fcw-accent); background: #fff; }
.fcw-composer-input::placeholder { color: #bbb; }
.fcw-send-btn {
  width: 44px; height: 44px; border-radius: 13px; background: var(--fcw-accent);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 3px 10px rgba(230,57,70,.3);
}
.fcw-send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(230,57,70,.4); }
.fcw-send-btn:active { transform: scale(.95); }
.fcw-send-btn:disabled { opacity: .4; pointer-events: none; }
.fcw-send-btn svg { width: 16px; height: 16px; }

/* FOOTER */
.fcw-chat-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 12px; border-top: 1px solid #f4f5f7;
}
.fcw-btn-text-link {
  font-size: 11px; font-weight: 700; color: #fff; background: #e63946;
  border: none; cursor: pointer; padding: 4px 12px; border-radius: 20px;
  letter-spacing: 0.01em; transition: background .2s, transform .15s;
  box-shadow: 0 2px 6px rgba(230,57,70,.3);
}
.fcw-btn-text-link:hover { background: #c1121f; transform: scale(1.04); }
.fcw-btn-text-link:active { transform: scale(.97); }
.fcw-poweredby {
  font-size: 10.5px; color: #111; font-weight: 600;
  letter-spacing: 0.01em; text-decoration: none; opacity: 0.4;
  transition: opacity .2s;
}
.fcw-poweredby:hover { opacity: 0.7; }

/* RATING */
#fcw-screen-rating { align-items: center; justify-content: center; padding: 40px 24px; text-align: center; }
.fcw-rating-icon { font-size: 48px; margin-bottom: 16px; display: block; }
.fcw-rating-title { font-size: 18px; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }
.fcw-rating-subtitle { font-size: 14px; color: #777; margin-bottom: 24px; }
.fcw-stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; }
.fcw-star { font-size: 32px; background: none; border: none; cursor: pointer; color: #ddd; transition: color .15s, transform .15s; padding: 4px; line-height: 1; }
.fcw-star:hover, .fcw-star.active { color: #f4c430; transform: scale(1.2); }
.fcw-rating-thanks { font-size: 15px; color: #2ecc71; font-weight: 600; margin-bottom: 16px; animation: fcw-msg-in .3s var(--fcw-anim); }

/* ANIMATIONS */
@keyframes fcw-pulse {
  0%,100% { box-shadow: 0 4px 14px rgba(0,0,0,.25), 0 0 0 0 rgba(230,57,70,.4); }
  50%      { box-shadow: 0 4px 14px rgba(0,0,0,.25), 0 0 0 10px rgba(230,57,70,0); }
}
@keyframes fcw-status-pulse { 0%,100% { opacity:1; } 50% { opacity:.6; } }
@keyframes fcw-msg-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes fcw-badge-in { from { transform:scale(0); } to { transform:scale(1); } }
@keyframes fcw-bounce { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-6px); } }
@keyframes fcw-typing { 0%,100% { transform:translateY(0); background:#ccc; } 50% { transform:translateY(-5px); background:#aaa; } }

/* MOBILE */
@media (max-width:480px) {
  .fcw-window { width:calc(100vw - 24px); max-height:calc(100dvh - 100px); right:0; left:0; margin:auto; }
  #fcw-widget.fcw-bottom-right, #fcw-widget.fcw-bottom-left { right:12px; left:12px; width:calc(100% - 24px); }
  .fcw-launcher { border-radius:50%; width:56px; height:56px; padding:0; justify-content:center; }
  .fcw-launcher-label { display:none; }
}

/* EMBEDDED */
.fcw-widget--embedded .fcw-launcher { display:none; }
.fcw-widget--embedded .fcw-window { position:relative; bottom:auto; right:auto; opacity:1; transform:none; pointer-events:all; box-shadow:var(--fcw-shadow); height:500px; border-radius:var(--fcw-radius); }
