/* ════════════════════════════════════════════════════════
   ALGERIA JOB SUMMIT · CHATBOT WIDGET CSS
   Design: Dark gold glassmorphism · 2025 SaaS style
   Fonts: Clash Display (titles) + Instrument Sans (body)
════════════════════════════════════════════════════════ */

/* ── Google Fonts (fallback if not loaded by parent page) ── */
@import url('https://fonts.googleapis.com/css2?family=Clash+Display:wght@500;600;700&family=Instrument+Sans:wght@300;400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
  --cb-gold:        #FF6600;
  --cb-gold-light:  #23aeee;
  --cb-gold-pale:   rgba(76, 172, 201, 0.12);
  --cb-dark:        #0D1117;
  --cb-dark2:       #161B24;
  --cb-dark3:       #1E2533;
  --cb-border:      rgba(201,168,76,0.18);
  --cb-border-hov:  rgba(201,168,76,0.38);
  --cb-text:        #E2E8F0;
  --cb-muted:       #8896A9;
  --cb-radius:      1.2rem;
  --cb-shadow:      0 24px 64px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.35);
  --cb-w:           380px;
  --cb-h:           580px;
}

/* ════════════ FLOATING TRIGGER BUTTON ════════════ */
.cb-trigger {
  position: fixed;
    bottom: 0.75rem;
    left: 0.75rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: .6rem;
  background: #FF6600;
  color: #fff !important;
  border: none;
  border-radius: 50px;
  padding: .7rem 1.3rem .7rem .85rem;
  cursor: pointer;
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .02em;
  box-shadow: 0 8px 32px rgba(201,168,76,0.35), 0 2px 8px rgba(0,0,0,0.4);
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  outline: none;
}
.cb-trigger:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 40px rgba(201,168,76,0.45), 0 2px 8px rgba(0,0,0,0.4);
}
.cb-trigger:active { transform: scale(.97); }

.cb-trigger-icon {
  width: 36px; height: 36px;
  background: rgba(0,0,0,0.18);
  color:#fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .2s;
}
.cb-trigger.is-open .cb-trigger-icon { transform: rotate(180deg); }
.cb-trigger-label { white-space: nowrap; color:#fff}

/* Pulse ring */
.cb-trigger::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50px;
  border: 2px solid rgba(76, 109, 201, 0.45);
  animation: cb-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes cb-pulse {
  0%   { opacity: .8; transform: scale(1); }
  70%  { opacity: 0; transform: scale(1.18); }
  100% { opacity: 0; transform: scale(1.18); }
}
.cb-trigger.is-open::after { animation: none; }

/* ════════════ CHAT WINDOW ════════════ */
.cb-window {
  position: fixed;
  bottom: calc(1.75rem + 60px + .75rem);
  left: 1.75rem;
  z-index: 9998;
  width: var(--cb-w);
  height: var(--cb-h);
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 120px);
  display: flex;
  flex-direction: column;
  border-radius: var(--cb-radius);
  overflow: hidden;
  background: #fff;
  color:#262626;
  border: 1px solid var(--cb-border);
  box-shadow: var(--cb-shadow);
  /* Hidden state */
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(.96);
  transform-origin: bottom right;
  transition: opacity .28s cubic-bezier(.4,0,.2,1),
              transform .3s cubic-bezier(.34,1.4,.64,1);
}
.cb-window.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── Noise texture overlay ── */
.cb-window::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: .5;
}

/* ════════════ HEADER ════════════ */
.cb-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem .9rem;
  background: linear-gradient(180deg, rgba(201,168,76,.12) 0%, transparent 100%);
  border-bottom: 1px solid var(--cb-border);
  flex-shrink: 0;
}
.cb-header-left { display: flex; align-items: center; gap: .75rem; }

.cb-avatar-bot {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #FF6600;
  border: 1.5px solid rgba(76, 151, 201, 0.35);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.cb-header-name {
  font-family: 'Clash Display', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #262626;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.cb-verified {
  color: var(--cb-gold);
  font-size: .75rem;
}
.cb-header-status {
  font-size: .76rem;
  color: var(--cb-muted);
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .15rem;
}
.cb-status-dot {
  width: 7px; height: 7px;
  background: #34D399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px rgba(52,211,153,.6);
  animation: cb-blink 2.5s ease-in-out infinite;
}
@keyframes cb-blink {
  0%,100% { opacity: 1; } 50% { opacity: .5; }
}

.cb-header-actions { display: flex; gap: .4rem; }
.cb-hbtn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--cb-border);
  background: rgba(255,255,255,.04);
  color: var(--cb-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cb-hbtn:hover { background: rgba(201,168,76,.1); color: var(--cb-gold-light); }

/* ════════════ MESSAGES AREA ════════════ */
.cb-messages {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  scroll-behavior: smooth;
}
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb {
  background: rgba(201,168,76,.2);
  border-radius: 4px;
}
.cb-messages::-webkit-scrollbar-thumb:hover { background: rgba(201,168,76,.4); }

/* ── Date separator ── */
.cb-date-sep {
  text-align: center;
  font-size: .72rem;
  color: var(--cb-muted);
  position: relative;
  margin: .2rem 0;
}
.cb-date-sep::before, .cb-date-sep::after {
  content: '';
  position: absolute;
  top: 50%; width: 28%;
  height: 1px;
  background: var(--cb-border);
}
.cb-date-sep::before { left: 0; }
.cb-date-sep::after { right: 0; }

/* ── Message row ── */
.cb-msg-row {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  animation: cb-msg-in .3s cubic-bezier(.4,0,.2,1) both;
}
@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cb-msg-row.user { flex-direction: row-reverse; }

.cb-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
}
.cb-msg-row.bot .cb-msg-avatar {
  background: linear-gradient(135deg, rgba(201,168,76,.2), rgba(201,168,76,.06));
  border: 1px solid rgba(201,168,76,.25);
  color: var(--cb-gold-light);
}
.cb-msg-row.user .cb-msg-avatar {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--cb-muted);
}

/* ── Bubble ── */
.cb-bubble {
  max-width: 82%;
  padding: .72rem 1rem;
  border-radius: 1.1rem;
  font-size: .875rem;
  line-height: 1.65;
  font-family: 'Instrument Sans', sans-serif;
  word-break: break-word;
}
.cb-msg-row.bot .cb-bubble {
  background: var(--cb-dark3);
  border: 1px solid var(--cb-border);
  color: var(--cb-text);
  border-bottom-left-radius: .3rem;
}
.cb-msg-row.user .cb-bubble {
  background: #FF6600;
  color: #fff;
  font-weight: 500;
  border-bottom-right-radius: .3rem;
  border: none;
}
.cb-bubble-time {
  font-size: .68rem;
  color: var(--cb-muted);
  margin-top: .35rem;
  display: block;
  text-align: right;
}
.cb-msg-row.bot .cb-bubble-time { text-align: left; }

/* ── Typing indicator ── */
.cb-typing-row { display: flex; gap: .6rem; align-items: flex-end; }
.cb-typing-bubble {
  background: var(--cb-dark3);
  border: 1px solid var(--cb-border);
  border-radius: 1.1rem;
  border-bottom-left-radius: .3rem;
  padding: .85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.cb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cb-gold);
  animation: cb-dots .9s ease-in-out infinite;
}
.cb-dot:nth-child(2) { animation-delay: .18s; }
.cb-dot:nth-child(3) { animation-delay: .36s; }
@keyframes cb-dots {
  0%,60%,100% { transform: translateY(0); opacity: .5; }
  30%          { transform: translateY(-6px); opacity: 1; }
}

/* ════════════ QUICK SUGGESTIONS ════════════ */
.cb-suggestions {
  position: relative;
  z-index: 1;
  padding: .6rem .9rem .4rem;
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--cb-border);
  scrollbar-width: none;
}
.cb-suggestions::-webkit-scrollbar { display: none; }

.cb-chip {
  white-space: nowrap;
  background: rgba(201,168,76,.08);
  border: 1px solid rgba(201,168,76,.22);
  color: var(--cb-gold-light);
  font-family: 'Instrument Sans', sans-serif;
  font-size: .75rem;
  font-weight: 500;
  padding: .38rem .85rem;
  border-radius: 50px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
  flex-shrink: 0;
  outline: none;
}
.cb-chip:hover {
  background: rgba(201,168,76,.18);
  border-color: rgba(201,168,76,.45);
  transform: translateY(-1px);
}
.cb-chip:active { transform: scale(.97); }

/* ════════════ INPUT AREA ════════════ */
.cb-input-area {
  position: relative;
  z-index: 1;
  padding: .75rem 1rem 1rem;
  background: linear-gradient(0deg, rgba(201,168,76,.04) 0%, transparent 100%);
  border-top: 1px solid var(--cb-border);
  flex-shrink: 0;
}
.cb-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  background: var(--cb-dark3);
  border: 1px solid var(--cb-border);
  border-radius: .9rem;
  padding: .6rem .6rem .6rem .9rem;
  transition: border-color .2s;
}
.cb-input-wrapper:focus-within {
  border-color: rgba(201,168,76,.5);
  box-shadow: 0 0 0 3px rgba(201,168,76,.07);
}

#cb-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--cb-text);
  font-family: 'Instrument Sans', sans-serif;
  font-size: .87rem;
  line-height: 1.5;
  resize: none;
  max-height: 110px;
  scrollbar-width: none;
  padding: 0;
}
#cb-textarea::placeholder { color: var(--cb-muted); }
#cb-textarea::-webkit-scrollbar { display: none; }

.cb-send-btn {
  width: 36px; height: 36px;
  border-radius: .65rem;
  background: #FF6600;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity .2s, transform .2s;
}
.cb-send-btn:hover { opacity: .85; transform: scale(1.06); }
.cb-send-btn:active { transform: scale(.94); }
.cb-send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.cb-input-footer {
  text-align: center;
  font-size: .7rem;
  color: rgba(136,150,169,.5);
  margin-top: .55rem;
}
.cb-input-footer strong { color: rgba(201,168,76,.5); }

/* ════════════ WELCOME STATE ════════════ */
.cb-welcome {
  text-align: center;
  padding: 1.5rem .5rem;
}
.cb-welcome-icon {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201,168,76,.2), rgba(201,168,76,.06));
  border: 1.5px solid rgba(201,168,76,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.cb-welcome h3 {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: .5rem;
}
.cb-welcome p {
  font-size: .82rem;
  color: var(--cb-muted);
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto;
}

/* ════════════ RESPONSIVE ════════════ */
/* @media (max-width: 480px) {
  :root { --cb-w: calc(100vw - 1.5rem); --cb-h: 70dvh; }
  .cb-window { right: .75rem; bottom: calc(.75rem + 60px + .5rem); }
  .cb-trigger { right: .75rem; bottom: .75rem; }
} */

/* ════════════ ERROR STATE ════════════ */
.cb-error-bubble {
  background: rgba(239,68,68,.1) !important;
  border-color: rgba(239,68,68,.25) !important;
  color: #FCA5A5 !important;
}
