/* ── SIIFWEB Chat Widget & Cookie Banner ── */

/* ── Cookie Banner ── */
#siif-cookie {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 800;
  background: #0B1622;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 1rem clamp(1.5rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.22,1,.36,1);
}
#siif-cookie.visible { transform: none }
.ck-text {
  font-size: .82rem;
  color: rgba(255,255,255,.6);
  line-height: 1.55;
  flex: 1;
  min-width: 220px;
}
.ck-text a { color: rgba(255,255,255,.8); text-decoration: underline }
.ck-text a:hover { color: #fff }
.ck-actions { display: flex; gap: .65rem; flex-shrink: 0; flex-wrap: wrap }
.ck-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .45rem 1.1rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.ck-btn--accept { background: #1264A8; color: #fff }
.ck-btn--accept:hover { background: #0D4F85 }
.ck-btn--decline { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7) }
.ck-btn--decline:hover { background: rgba(255,255,255,.14) }

/* ── Chat Widget ── */
#siif-chat-wrap {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 750;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: .85rem;
}

/* Floating button */
#siif-chat-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1264A8;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(18,100,168,.45);
  transition: background .25s, transform .25s, box-shadow .25s;
  flex-shrink: 0;
  position: relative;
}
#siif-chat-btn:hover {
  background: #0D4F85;
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(18,100,168,.55);
}
#siif-chat-btn .cb-icon { transition: opacity .2s, transform .2s }
#siif-chat-btn .cb-close { position: absolute; opacity: 0; transform: rotate(-90deg) }
#siif-chat-btn.open .cb-icon-chat { opacity: 0; transform: rotate(90deg) }
#siif-chat-btn.open .cb-close { opacity: 1; transform: none }
.cb-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(18,100,168,.3);
  animation: cb-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cb-pulse {
  0%, 100% { transform: scale(1); opacity: .5 }
  60% { transform: scale(1.35); opacity: 0 }
}
#siif-chat-btn.open .cb-pulse { display: none }

/* Notification badge */
.cb-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 18px; height: 18px;
  background: #EF4444;
  border-radius: 50%;
  border: 2px solid #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: opacity .2s, transform .2s;
}
.cb-badge.hidden { opacity: 0; transform: scale(.5) }

/* Chat panel */
#siif-chat-panel {
  width: 370px;
  max-height: min(560px, calc(100vh - 120px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(11,33,56,.18), 0 0 0 1px rgba(18,100,168,.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .25s cubic-bezier(.22,1,.36,1), transform .25s cubic-bezier(.22,1,.36,1);
}
#siif-chat-panel.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Panel header */
.sc-header {
  background: #1264A8;
  padding: .9rem 1rem .9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sc-header-info { display: flex; align-items: center; gap: .75rem }
.sc-avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sc-avatar svg { width: 20px; height: 20px }
.sc-name {
  font-family: 'Montserrat', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sc-status {
  font-size: .68rem;
  color: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .1rem;
}
.sc-status::before {
  content: '';
  width: 6px; height: 6px;
  background: #4ADE80;
  border-radius: 50%;
  flex-shrink: 0;
}
.sc-close {
  background: rgba(255,255,255,.12);
  border: none;
  border-radius: 6px;
  width: 30px; height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.8);
  transition: background .2s;
  flex-shrink: 0;
}
.sc-close:hover { background: rgba(255,255,255,.22) }

/* Phases */
.sc-phase { display: flex; flex-direction: column; flex: 1; overflow: hidden }
.sc-phase--hidden { display: none }

/* Info phase */
.sc-info-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem 0;
  overscroll-behavior: contain;
}
.sc-info-scroll::-webkit-scrollbar { width: 4px }
.sc-info-scroll::-webkit-scrollbar-track { background: transparent }
.sc-info-scroll::-webkit-scrollbar-thumb { background: rgba(18,100,168,.2); border-radius: 2px }
.sc-bot-bubble {
  background: #EAF3FB;
  border-radius: 0 12px 12px 12px;
  padding: .85rem 1rem;
  font-size: .88rem;
  color: #1B2B3C;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.sc-bot-bubble strong { color: #1264A8 }
.sc-info-cards { display: flex; flex-direction: column; gap: .65rem; margin-bottom: 1rem }
.sc-info-card {
  background: #F0F5FB;
  border: 1px solid #D8E4F0;
  border-radius: 10px;
  padding: .85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.sc-info-card-ico {
  width: 32px; height: 32px;
  background: #1264A8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sc-info-card-ico svg { width: 16px; height: 16px }
.sc-info-card-body {}
.sc-info-card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  color: #1B2B3C;
  line-height: 1.25;
  margin-bottom: .2rem;
}
.sc-info-card-desc {
  font-size: .76rem;
  color: #47637C;
  line-height: 1.5;
}
.sc-info-cta {
  padding: .85rem 1rem 1rem;
  flex-shrink: 0;
  border-top: 1px solid #D8E4F0;
}
.sc-start-btn {
  width: 100%;
  background: #1264A8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .75rem;
  font-family: 'Montserrat', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: background .2s;
}
.sc-start-btn:hover { background: #0D4F85 }

/* Chat phase */
.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  overscroll-behavior: contain;
}
.sc-messages::-webkit-scrollbar { width: 4px }
.sc-messages::-webkit-scrollbar-track { background: transparent }
.sc-messages::-webkit-scrollbar-thumb { background: rgba(18,100,168,.2); border-radius: 2px }

.sc-msg { display: flex; gap: .5rem; align-items: flex-end }
.sc-msg--bot { flex-direction: row }
.sc-msg--user { flex-direction: row-reverse }
.sc-msg-avatar {
  width: 26px; height: 26px;
  background: #EAF3FB;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sc-msg-avatar svg { width: 13px; height: 13px }
.sc-msg-text {
  max-width: 78%;
  padding: .65rem .85rem;
  border-radius: 12px;
  font-size: .84rem;
  line-height: 1.6;
}
.sc-msg--bot .sc-msg-text {
  background: #EAF3FB;
  color: #1B2B3C;
  border-radius: 0 12px 12px 12px;
}
.sc-msg--user .sc-msg-text {
  background: #1264A8;
  color: #fff;
  border-radius: 12px 0 12px 12px;
}
.sc-msg-text strong { font-weight: 600 }
.sc-msg--bot .sc-msg-text strong { color: #0D4F85 }

/* Typing indicator */
.sc-typing { display: flex; gap: 4px; align-items: center; padding: .6rem .85rem }
.sc-typing span {
  width: 6px; height: 6px;
  background: #7A9BB4;
  border-radius: 50%;
  animation: sc-blink 1.2s infinite;
}
.sc-typing span:nth-child(2) { animation-delay: .2s }
.sc-typing span:nth-child(3) { animation-delay: .4s }
@keyframes sc-blink {
  0%, 80%, 100% { opacity: .25; transform: scale(.85) }
  40% { opacity: 1; transform: scale(1) }
}

/* Quick replies */
.sc-quick {
  padding: .4rem 1rem .65rem;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  flex-shrink: 0;
}
.sc-quick-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: #1264A8;
  background: #EAF3FB;
  border: 1px solid rgba(18,100,168,.25);
  border-radius: 20px;
  padding: .3rem .75rem;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.sc-quick-btn:hover { background: #1264A8; color: #fff; border-color: #1264A8 }

/* WhatsApp CTA */
.sc-wa-cta {
  margin: .5rem 1rem;
  background: #DCF8C6;
  border: 1px solid rgba(37,211,102,.3);
  border-radius: 10px;
  padding: .7rem .85rem;
  display: flex;
  align-items: center;
  gap: .7rem;
}
.sc-wa-cta-text { font-size: .78rem; color: #1B2B3C; flex: 1; line-height: 1.45 }
.sc-wa-cta-text strong { color: #128C7E; display: block; margin-bottom: .1rem }
.sc-wa-link {
  font-family: 'Montserrat', sans-serif;
  font-size: .68rem;
  font-weight: 700;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .38rem .75rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s;
}
.sc-wa-link:hover { background: #128C7E }

/* Input area */
.sc-input-area {
  padding: .65rem .85rem .75rem;
  border-top: 1px solid #D8E4F0;
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}
.sc-input {
  flex: 1;
  border: 1.5px solid #D8E4F0;
  border-radius: 8px;
  padding: .55rem .85rem;
  font-family: 'Open Sans', sans-serif;
  font-size: .84rem;
  color: #1B2B3C;
  outline: none;
  transition: border-color .2s;
  resize: none;
  height: 38px;
}
.sc-input:focus { border-color: #1264A8 }
.sc-input::placeholder { color: #7A9BB4 }
.sc-send {
  width: 38px; height: 38px;
  background: #1264A8;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.sc-send:hover { background: #0D4F85 }
.sc-send:disabled { background: #D8E4F0; cursor: default }
.sc-send svg { color: #fff }

/* Powered by */
.sc-powered {
  text-align: center;
  padding: .4rem;
  font-size: .62rem;
  color: #7A9BB4;
  border-top: 1px solid #F0F5FB;
  flex-shrink: 0;
}

/* Mobile: bottom-sheet style */
@media (max-width: 760px) {
  #siif-chat-wrap {
    bottom: 1rem;
    right: 1rem;
  }
  #siif-chat-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 82vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(110%);
    box-shadow: 0 -4px 32px rgba(11,33,56,.18);
  }
  #siif-chat-panel.open {
    transform: none;
    opacity: 1;
  }
  /* Overlay behind panel on mobile */
  #siif-chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11,33,56,.35);
    z-index: 749;
    opacity: 0;
    transition: opacity .3s;
  }
  #siif-chat-overlay.visible {
    display: block;
    opacity: 1;
  }
}
