/* =============================================================
   Click & Contact Widget — widget.css
   ============================================================= */

:root {
  --ccw-color: #2563eb;
  --ccw-color-dark: #1d4ed8;
  --ccw-radius: 16px;
  --ccw-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  --ccw-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Wrapper ------------------------------------------------ */
.ccw-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  font-family: var(--ccw-font);
  font-size: 15px;
}

/* ---- Bubble ------------------------------------------------- */
.ccw-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ccw-color);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  margin-left: auto;
  color: #fff;
}

.ccw-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
}

.ccw-bubble svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
  transition: opacity .2s;
}

.ccw-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 50%;
}

.ccw-bubble-close {
  position: absolute;
  font-size: 18px;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  line-height: 1;
}

.ccw-widget.is-open .ccw-bubble svg,
.ccw-widget.is-open .ccw-logo { opacity: 0; }
.ccw-widget.is-open .ccw-bubble-close { opacity: 1; }

/* ---- Panel -------------------------------------------------- */
.ccw-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  background: #fff;
  border-radius: var(--ccw-radius);
  box-shadow: var(--ccw-shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.ccw-widget.is-open .ccw-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---- Panel Header ------------------------------------------- */
.ccw-panel-header {
  background: var(--ccw-color);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ccw-panel-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .3px;
}

/* ---- Panel Body --------------------------------------------- */
.ccw-panel-body {
  padding: 20px;
  max-height: 480px;
  overflow-y: auto;
}

/* ---- Steps -------------------------------------------------- */
.ccw-step { animation: ccw-fade-in .2s ease; }

@keyframes ccw-fade-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0);   }
}

/* ---- Question ----------------------------------------------- */
.ccw-question {
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 14px;
  line-height: 1.4;
}
.ccw-question em { font-weight: 400; color: #94a3b8; font-size: .9em; }

/* ---- Checkboxes --------------------------------------------- */
.ccw-options { margin-bottom: 14px; }

.ccw-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  color: #374151;
}

.ccw-checkbox-label input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--ccw-color);
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- Fields ------------------------------------------------- */
.ccw-field { margin-bottom: 12px; }

.ccw-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.ccw-req { color: #ef4444; }

.ccw-field input[type=text],
.ccw-field input[type=email],
.ccw-field input[type=tel],
.ccw-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-family: var(--ccw-font);
  font-size: 14px;
  color: #1e293b;
  transition: border-color .2s;
  outline: none;
  resize: vertical;
}

.ccw-field input:focus,
.ccw-field textarea:focus {
  border-color: var(--ccw-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ccw-color) 15%, transparent);
}

/* ---- Contact choices ---------------------------------------- */
.ccw-contact-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.ccw-choice-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  font-size: 14px;
  color: #374151;
}

.ccw-choice-label:hover { border-color: var(--ccw-color); background: #f0f4ff; }
.ccw-choice-label input[type=radio] { accent-color: var(--ccw-color); }
.ccw-choice-label:has(input:checked) {
  border-color: var(--ccw-color);
  background: color-mix(in srgb, var(--ccw-color) 8%, #fff);
  font-weight: 600;
}

/* ---- Call number ------------------------------------------- */
.ccw-call-number { margin-bottom: 16px; text-align: center; }
.ccw-phone-link {
  display: inline-block;
  background: #f0fdf4;
  color: #16a34a;
  border: 1.5px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s;
}
.ccw-phone-link:hover { background: #dcfce7; }

/* ---- Buttons ------------------------------------------------ */
.ccw-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--ccw-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--ccw-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.ccw-btn:hover { background: var(--ccw-color-dark); transform: translateY(-1px); }
.ccw-btn:active { transform: translateY(0); }

.ccw-btn-outline {
  background: transparent;
  color: var(--ccw-color);
  border: 1.5px solid var(--ccw-color);
}
.ccw-btn-outline:hover { background: color-mix(in srgb, var(--ccw-color) 8%, transparent); }

.ccw-btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ---- Confirmation ------------------------------------------ */
.ccw-confirmation { text-align: center; padding: 20px 0; }

.ccw-check {
  width: 56px;
  height: 56px;
  background: #16a34a;
  color: #fff;
  border-radius: 50%;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: ccw-pop .3s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes ccw-pop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.ccw-confirm-msg { color: #374151; line-height: 1.6; }

/* ---- Loader ------------------------------------------------- */
.ccw-loader { text-align: center; padding: 20px; }

.ccw-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--ccw-color);
  border-radius: 50%;
  animation: ccw-spin .7s linear infinite;
}

@keyframes ccw-spin {
  to { transform: rotate(360deg); }
}

/* ---- Error -------------------------------------------------- */
.ccw-error-msg {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 10px;
}

/* ---- Responsive -------------------------------------------- */
@media (max-width: 420px) {
  .ccw-widget { bottom: 16px; right: 16px; }
  .ccw-panel  { width: calc(100vw - 32px); right: 0; }
}

/* =============================================================
   Progress bar
   ============================================================= */
.ccw-progress {
  background: #f1f5f9;
  padding: 8px 20px 6px;
  border-bottom: 1px solid #e2e8f0;
}

.ccw-progress-bar-track {
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.ccw-progress-bar {
  height: 100%;
  background: var(--ccw-color);
  border-radius: 4px;
  transition: width .35s ease;
}

.ccw-progress-steps {
  text-align: right;
}

.ccw-progress-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

/* =============================================================
   RGPD checkbox
   ============================================================= */
.ccw-rgpd-field {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
}

.ccw-rgpd-label {
  font-size: 12px !important;
  color: #64748b;
  align-items: flex-start !important;
  line-height: 1.5;
}

.ccw-rgpd-label input[type=checkbox] {
  margin-top: 2px;
  flex-shrink: 0;
}

.ccw-rgpd-label a {
  color: var(--ccw-color);
  text-decoration: underline;
}

/* =============================================================
   Position gauche / droite
   ============================================================= */
.ccw-pos-right {
  right: 28px;
  left: auto;
}
.ccw-pos-left {
  left: 28px;
  right: auto;
}
.ccw-pos-left .ccw-panel {
  right: auto;
  left: 0;
}

/* =============================================================
   Apparition différée
   ============================================================= */
.ccw-widget.ccw-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}
.ccw-widget.ccw-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity .4s ease, transform .4s ease;
}

/* =============================================================
   Message de bienvenue
   ============================================================= */
.ccw-welcome {
  position: absolute;
  bottom: 68px;
  right: 0;
  background: #fff;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  padding: 10px 14px;
  max-width: 220px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px) scale(.95);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
}
.ccw-pos-left .ccw-welcome {
  right: auto;
  left: 0;
  border-radius: 12px 12px 12px 4px;
}
.ccw-welcome.ccw-welcome-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.ccw-welcome-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.ccw-welcome-close:hover { color: #64748b; }

/* Petite flèche sous la bulle de bienvenue */
.ccw-welcome::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 18px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0,0,0,.08);
}
.ccw-pos-left .ccw-welcome::after {
  right: auto;
  left: 18px;
}

@media (max-width: 420px) {
  .ccw-pos-left  { left: 16px; }
  .ccw-pos-right { right: 16px; }
  .ccw-welcome   { max-width: 180px; font-size: 12px; }
}

/* =============================================================
   Champs personnalisés
   ============================================================= */
.ccw-custom-fields { margin-top: 4px; }

.ccw-cf-field { margin-bottom: 12px; }
.ccw-cf-field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.ccw-cf-field input[type=text],
.ccw-cf-field textarea,
.ccw-cf-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  transition: border-color .2s;
  box-sizing: border-box;
}
.ccw-cf-field input[type=text]:focus,
.ccw-cf-field textarea:focus,
.ccw-cf-field select:focus {
  outline: none;
  border-color: var(--ccw-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ccw-color) 15%, transparent);
}
.ccw-cf-field textarea { resize: vertical; min-height: 72px; }

.ccw-cf-choices { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }

/* File upload */
.ccw-cf-file-wrap { display: flex; flex-direction: column; gap: 6px; }
.ccw-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ccw-color);
  cursor: pointer;
  font-weight: 600;
  transition: background .2s, border-color .2s;
}
.ccw-file-btn:hover { background: #f0f4ff; border-color: var(--ccw-color); }
.ccw-file-btn input[type=file] { display: none; }
.ccw-file-name { font-size: 11px; color: #94a3b8; }
.ccw-file-progress {
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.ccw-file-bar {
  height: 100%;
  background: var(--ccw-color);
  border-radius: 4px;
  width: 0;
  transition: width .2s;
}

/* Powered by */
.ccw-powered-by {
    text-align: center;
    padding: 6px 0 2px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}
.ccw-powered-by a {
    font-size: 10px;
    color: #cbd5e1;
    text-decoration: none;
    transition: color .2s;
}
.ccw-powered-by a:hover {
    color: #94a3b8;
}

/* Mode inline (shortcode) */
.ccw-widget.ccw-inline {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    display: block !important;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}
.ccw-widget.ccw-inline .ccw-toggle-btn,
.ccw-widget.ccw-inline .ccw-welcome-bubble {
    display: none !important;
}
.ccw-widget.ccw-inline .ccw-panel {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    border-radius: 16px;
}
