/* ═══════════════════════════════════════════════════════════════
   KaKo Chat — Widget CSS v4.0
   Author: Njapa Brice Diotreph
═══════════════════════════════════════════════════════════════ */

:root {
  --gc-color:        #c9a96e;
  --gc-color-dark:   #a8883f;
  --gc-bg:           #ffffff;
  --gc-bg-light:     #f8f5f0;
  --gc-text:         #2d2d2d;
  --gc-text-muted:   #888;
  --gc-border:       #e8e2d8;
  --gc-msg-client:   #fff;
  --gc-msg-agent:    #c9a96e;
  --gc-shadow:       0 8px 32px rgba(0,0,0,.18);
  --gc-radius:       16px;
  --gc-z:            99999;
  --gc-w:            360px;
  --gc-h:            520px;
}

#gc-widget, #gc-widget * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.gc-widget {
  position: fixed; bottom: 24px; z-index: var(--gc-z);
}
.gc-widget--right { right: 24px; }
.gc-widget--left  { left:  24px; }

.gc-bubble {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--gc-color); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(201,169,110,.5);
  transition: transform .2s, box-shadow .2s;
  position: relative; outline: none;
}
.gc-bubble:hover  { transform: scale(1.08); box-shadow: 0 6px 28px rgba(201,169,110,.65); }
.gc-bubble:active { transform: scale(.96); }

.gc-badge {
  position: absolute; top: -4px; right: -4px;
  background: #e74c3c; color: #fff; border-radius: 50%;
  min-width: 22px; height: 22px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; padding: 0 4px; pointer-events: none;
}

.gc-panel {
  position: absolute; bottom: 76px;
  width: var(--gc-w); max-height: var(--gc-h);
  background: var(--gc-bg); border-radius: var(--gc-radius);
  box-shadow: var(--gc-shadow); display: flex; flex-direction: column;
  overflow: hidden; animation: gc-slide-up .25s ease;
  border: 1px solid var(--gc-border);
}
.gc-widget--right .gc-panel { right: 0; }
.gc-widget--left  .gc-panel { left:  0; }

@keyframes gc-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.gc-panel-header {
  background: var(--gc-color); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.gc-header-left { display: flex; align-items: center; gap: 10px; }
.gc-header-avatar {
  font-size: 28px; width: 42px; height: 42px;
  background: rgba(255,255,255,.2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gc-header-name {
  color: #fff; font-weight: 700; font-size: 14px;
  max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.gc-lang-switch {
  display: flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,.15); border-radius: 20px; padding: 3px 8px; margin: 0 6px; flex-shrink: 0;
}
.gc-lang-btn {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 11px; font-weight: 700; cursor: pointer;
  padding: 2px 5px; border-radius: 12px; transition: background .15s, color .15s; line-height: 1;
}
.gc-lang-btn:hover  { color: #fff; }
.gc-lang-btn.active { background: rgba(255,255,255,.25); color: #fff; }
.gc-lang-sep { color: rgba(255,255,255,.4); font-size: 11px; }

.gc-header-status {
  color: rgba(255,255,255,.85); font-size: 12px;
  display: flex; align-items: center; gap: 5px;
}
.gc-status-dot {
  width: 8px; height: 8px; background: #2ecc71; border-radius: 50%;
  display: inline-block; box-shadow: 0 0 0 2px rgba(46,204,113,.3);
  animation: gc-pulse 2s infinite;
}
.gc-status-dot.offline { background: #888; animation: none; box-shadow: none; }
@keyframes gc-pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(46,204,113,.3); }
  50%      { box-shadow: 0 0 0 5px rgba(46,204,113,.1); }
}

.gc-icon-btn {
  background: none; border: none; color: rgba(255,255,255,.8); cursor: pointer;
  padding: 4px; border-radius: 50%; display: flex; align-items: center;
  transition: background .15s, color .15s;
}
.gc-icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

.gc-screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Setup screen */
.gc-screen--setup { padding: 20px; gap: 16px; overflow-y: auto; }
.gc-welcome-box { text-align: center; padding: 12px 0; }
.gc-welcome-emoji { font-size: 44px; }
.gc-welcome-title { margin: 8px 0 6px; font-size: 18px; font-weight: 700; color: var(--gc-text); }
.gc-welcome-msg   { color: var(--gc-text-muted); font-size: 14px; margin: 0; }
.gc-setup-form { display: flex; flex-direction: column; gap: 12px; }
.gc-field { display: flex; flex-direction: column; gap: 4px; }
.gc-field label { font-size: 13px; font-weight: 600; color: var(--gc-text); }
.gc-required { color: #e74c3c; }
.gc-opt { color: var(--gc-text-muted); font-weight: 400; font-size: 12px; }
.gc-input {
  padding: 10px 14px; border: 1.5px solid var(--gc-border);
  border-radius: 10px; font-size: 14px; outline: none;
  transition: border-color .2s; background: var(--gc-bg-light);
}
.gc-input:focus { border-color: var(--gc-color); background: #fff; }

.gc-btn-start {
  background: var(--gc-color); color: #fff; border: none;
  border-radius: 10px; padding: 12px 20px; font-size: 15px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 6px; transition: background .2s, transform .1s; margin-top: 4px;
}
.gc-btn-start:hover  { background: var(--gc-color-dark); }
.gc-btn-start:active { transform: scale(.98); }
.gc-btn-start:disabled { opacity: .6; cursor: not-allowed; }

/* Chat screen */
.gc-screen--chat { overflow: hidden; }
.gc-messages-list {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--gc-bg-light); scroll-behavior: smooth;
}
.gc-messages-list::-webkit-scrollbar { width: 4px; }
.gc-messages-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Bulles messages */
.gc-msg { display: flex; flex-direction: column; max-width: 82%; }
.gc-msg--client { align-self: flex-end;   align-items: flex-end; }
.gc-msg--agent  { align-self: flex-start; align-items: flex-start; }
.gc-msg--system { align-self: center; align-items: center; max-width: 90%; }

.gc-msg-bubble {
  padding: 9px 14px; border-radius: 18px; font-size: 14px;
  word-break: break-word; white-space: pre-wrap; position: relative;
}
.gc-msg--client .gc-msg-bubble { background: var(--gc-color); color: #fff; border-bottom-right-radius: 4px; }
.gc-msg--agent  .gc-msg-bubble { background: var(--gc-msg-client); color: var(--gc-text); border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.gc-msg--system .gc-msg-bubble { background: rgba(0,0,0,.06); color: var(--gc-text-muted); border-radius: 8px; font-style: italic; font-size: 12px; text-align: center; padding: 6px 14px; }

.gc-msg-time { font-size: 10px; color: var(--gc-text-muted); margin-top: 3px; padding: 0 2px; }

/* Fichiers */
.gc-file-img  { max-width: 200px; max-height: 160px; border-radius: 8px; display: block; cursor: pointer; }
.gc-file-link { color: inherit; text-decoration: underline; word-break: break-all; }

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

/* Typing bar */
.gc-typing-bar {
  padding: 6px 14px; font-size: 12px; color: var(--gc-text-muted);
  display: flex; align-items: center; gap: 8px;
  background: var(--gc-bg-light); border-top: 1px solid var(--gc-border);
}
.gc-typing-dots { display: flex; gap: 3px; align-items: center; }
.gc-typing-dots span { width: 6px; height: 6px; background: var(--gc-color); border-radius: 50%; animation: gc-bounce 1.2s infinite; }
.gc-typing-dots span:nth-child(2) { animation-delay: .2s; }
.gc-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes gc-bounce { 0%,80%,100% { transform: scale(.8); opacity: .6; } 40% { transform: scale(1.2); opacity: 1; } }

/* Input row */
.gc-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; background: var(--gc-bg);
  border-top: 1px solid var(--gc-border); flex-shrink: 0;
}

/* Bouton pièce jointe */
.gc-attach-btn {
  width: 38px; height: 38px; background: none;
  border: 1.5px solid var(--gc-border); border-radius: 50%;
  color: var(--gc-text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s; flex-shrink: 0;
}
.gc-attach-btn:hover { background: var(--gc-bg-light); color: var(--gc-color); border-color: var(--gc-color); }

.gc-msg-textarea {
  flex: 1; border: 1.5px solid var(--gc-border); border-radius: 20px;
  padding: 9px 14px; font-size: 14px; resize: none; outline: none;
  max-height: 120px; overflow-y: auto; background: var(--gc-bg-light);
  transition: border-color .2s; font-family: inherit;
}
.gc-msg-textarea:focus { border-color: var(--gc-color); background: #fff; }

.gc-send-btn {
  width: 42px; height: 42px; background: var(--gc-color); border: none;
  border-radius: 50%; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .1s; flex-shrink: 0;
}
.gc-send-btn:hover:not(:disabled) { background: var(--gc-color-dark); }
.gc-send-btn:active  { transform: scale(.92); }
.gc-send-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Closed screen */
.gc-screen--closed {
  align-items: center; justify-content: center;
  text-align: center; padding: 30px 20px; background: var(--gc-bg-light);
}
.gc-closed-box h3 { margin: 12px 0 8px; font-size: 18px; color: var(--gc-text); }
.gc-closed-box p  { color: var(--gc-text-muted); font-size: 14px; }

/* Loading */
.gc-loading-msgs { display: flex; align-items: center; justify-content: center; padding: 30px; }
.gc-spinner {
  width: 28px; height: 28px; border: 3px solid var(--gc-border); border-top-color: var(--gc-color);
  border-radius: 50%; animation: gc-spin .7s linear infinite;
}
@keyframes gc-spin { to { transform: rotate(360deg); } }

/* No access */
.gc-no-access { text-align: center; padding: 40px 20px; color: #666; }
.gc-btn-login {
  display: inline-block; margin-top: 12px; background: var(--gc-color);
  color: #fff; padding: 10px 24px; border-radius: 8px; text-decoration: none; font-weight: 600;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .gc-panel {
    position: fixed !important; bottom: 0 !important;
    left: 0 !important; right: 0 !important;
    width: 100% !important; max-height: 90vh !important;
    border-radius: var(--gc-radius) var(--gc-radius) 0 0 !important;
  }
}

/* ── Appel audio ── */
.gc-call-btn {
  width: 38px; height: 38px; background: none;
  border: 1.5px solid var(--gc-border); border-radius: 50%;
  color: var(--gc-text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, border-color .2s; flex-shrink: 0;
}
.gc-call-btn:hover:not(:disabled) { background: #e8f8ee; color: #2ecc71; border-color: #2ecc71; }
.gc-call-btn.calling { background: #fff8e1; color: #f39c12; border-color: #f39c12; animation: gc-pulse 1s infinite; }
.gc-call-btn:disabled { opacity: .4; cursor: not-allowed; }

.gc-call-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; background: #e8f8ee;
  border-top: 1px solid #b8e6c8; flex-shrink: 0;
}
.gc-call-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #27ae60; font-weight: 600; }
.gc-call-dot {
  width: 8px; height: 8px; background: #2ecc71; border-radius: 50%;
  display: inline-block; animation: gc-pulse 1.2s infinite;
}
.gc-call-ctrl { display: flex; gap: 6px; align-items: center; }
.gc-call-ctrl-btn {
  background: rgba(0,0,0,.06); border: none; font-size: 18px; cursor: pointer;
  padding: 4px 7px; border-radius: 8px; line-height: 1; transition: background .15s;
}
.gc-call-ctrl-btn:hover { background: rgba(0,0,0,.12); }
.gc-call-ctrl-btn--end {
  background: #e74c3c; border-radius: 50%;
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.gc-call-ctrl-btn--end:hover { background: #c0392b; }

/* ── Logo entreprise dans l'en-tête ── */
.gc-header-avatar {
  font-size: 20px; font-weight: 700; width: 42px; height: 42px;
  background: rgba(255,255,255,.25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  overflow: hidden;
}

/* ── Logo dans le setup screen ── */
.gc-welcome-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.gc-welcome-initial {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gc-color); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}

/* ── Bouton Appeler la réception ── */
.gc-call-reception-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #f0f8f0; color: #27ae60; border: 1.5px solid #2ecc71;
  border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .2s;
}
.gc-call-reception-btn:hover { background: #d5f5d5; }

/* ── Bouton Passer (skip) ── */
.gc-btn-skip {
  background: none; border: none; color: var(--gc-text-muted); font-size: 13px;
  cursor: pointer; text-decoration: underline; padding: 4px;
}

/* ── Écran évaluation ── */
.gc-screen--rating {
  align-items: center; justify-content: center;
  text-align: center; padding: 30px 20px; background: var(--gc-bg-light);
}
.gc-rating-box h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--gc-text); }
.gc-stars { display: flex; gap: 6px; justify-content: center; margin: 4px 0; }
.gc-star {
  background: none; border: none; font-size: 32px; color: #ddd;
  cursor: pointer; transition: color .15s, transform .1s; padding: 2px;
}
.gc-star:hover, .gc-star.active { color: #f1c40f; }
.gc-star:hover { transform: scale(1.15); }

/* ── Accusé de réception (✓✓) ── */
.gc-read-tick {
  font-size: 10px; margin-left: 4px;
  color: rgba(255,255,255,.7);
}
.gc-msg--client .gc-read-tick { color: rgba(255,255,255,.7); }
.gc-msg--agent  .gc-read-tick { color: var(--gc-text-muted); }
