/* ============================================================
   divioseo_savia — Front widget : bulle flottante
   ============================================================ */

/* ---- Variables ---- */
:root {
  --savia-accent:        #2467e1;
  --savia-accent-dark:   #1c50b0;
  --savia-bg:            #ffffff;
  --savia-surface:       #f4f4f8;
  --savia-text:          #1a1a2e;
  --savia-text-muted:    #6b6b8a;
  --savia-bubble-user:   #2467e1;
  --savia-bubble-bot:    #ededf7;
  --savia-radius:        12px;
  --savia-shadow:        0 8px 32px rgba(0,0,0,.18);
  --savia-z:             9999;
}

/* ---- Launcher button ---- */
#divioseo-savia-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--savia-z);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--savia-accent);
  border: none;
  cursor: pointer;
  box-shadow: var(--savia-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .2s;
  outline: none;
}

#divioseo-savia-launcher:hover {
  background: var(--savia-accent-dark);
  transform: scale(1.07);
}

#divioseo-savia-launcher svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

/* ---- Panel ---- */
#divioseo-savia-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: var(--savia-z);
  width: 360px;
  max-height: 70vh;
  background: var(--savia-bg);
  border-radius: var(--savia-radius);
  box-shadow: var(--savia-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity .2s, transform .2s;
}

#divioseo-savia-panel.savia-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

/* ---- Panel header ---- */
#divioseo-savia-header {
  background: var(--savia-accent);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#divioseo-savia-header-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

#divioseo-savia-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  opacity: .85;
}

#divioseo-savia-close:hover { opacity: 1; }

/* ---- Messages area ---- */
#divioseo-savia-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--savia-surface);
}

/* ---- Bubbles ---- */
.savia-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: var(--savia-radius);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.savia-bubble-user {
  align-self: flex-end;
  background: var(--savia-bubble-user);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.savia-bubble-bot {
  align-self: flex-start;
  background: var(--savia-bubble-bot);
  color: var(--savia-text);
  border-bottom-left-radius: 3px;
}

.savia-bubble-rgpd {
  font-size: 11px;
  color: var(--savia-text-muted);
  background: transparent;
  padding: 2px 0 0;
  border-radius: 0;
  max-width: 100%;
}

/* ---- Loading indicator ---- */
.savia-loading {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  background: var(--savia-bubble-bot);
  border-radius: var(--savia-radius);
  border-bottom-left-radius: 3px;
}

.savia-loading span {
  width: 7px;
  height: 7px;
  background: var(--savia-accent);
  border-radius: 50%;
  animation: savia-bounce .9s infinite;
  opacity: .7;
}

.savia-loading span:nth-child(2) { animation-delay: .15s; }
.savia-loading span:nth-child(3) { animation-delay: .30s; }

@keyframes savia-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ---- Product cards grid ---- */
.savia-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.savia-card {
  width: 148px;
  background: #fff;
  border: 1px solid #e0e0ee;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--savia-text);
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s;
}

.savia-card:hover {
  box-shadow: 0 3px 12px rgba(36,103,225,.18);
}

.savia-card-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: var(--savia-surface);
}

.savia-card-img-placeholder {
  width: 100%;
  height: 100px;
  background: var(--savia-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--savia-text-muted);
  font-size: 11px;
}

.savia-card-body {
  padding: 7px 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.savia-card-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.savia-card-price {
  font-size: 12px;
  color: var(--savia-accent);
  font-weight: 700;
  margin-top: auto;
}

/* ---- Section title (articles, etc.) ---- */
.savia-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--savia-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
  margin-top: 4px;
}

/* ---- Product list (2 max + lien sélection) ---- */
.savia-product-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.savia-product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #e0e0ee;
  border-radius: 8px;
  text-decoration: none;
  color: var(--savia-text);
  transition: box-shadow .15s;
}

.savia-product-row:hover {
  box-shadow: 0 2px 10px rgba(36,103,225,.15);
}

.savia-product-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.savia-product-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--savia-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.savia-more-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--savia-accent);
  text-decoration: none;
}

.savia-more-link:hover {
  text-decoration: underline;
}

/* ---- Article cards (2 max, sur une ligne) ---- */
.savia-article-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 4px;
}

.savia-article-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 0;
  min-width: 0;
  background: var(--savia-bg);
  border: 1px solid #e0e0ee;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--savia-text);
  padding: 10px 12px;
  transition: box-shadow .15s;
}

.savia-article-card:hover {
  box-shadow: 0 3px 12px rgba(36,103,225,.18);
}

.savia-article-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--savia-surface);
  margin-bottom: 4px;
}

.savia-article-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--savia-accent);
}

.savia-article-excerpt {
  font-size: 12px;
  color: var(--savia-text-muted);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- Input row ---- */
#divioseo-savia-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--savia-bg);
  border-top: 1px solid #e5e5ee;
  flex-shrink: 0;
}

#divioseo-savia-input {
  flex: 1;
  border: 1px solid #d0d0e8;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  outline: none;
  background: var(--savia-surface);
  color: var(--savia-text);
  transition: border-color .2s;
}

#divioseo-savia-input:focus {
  border-color: var(--savia-accent);
}

#divioseo-savia-input:disabled {
  opacity: .5;
  cursor: not-allowed;
}

#divioseo-savia-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--savia-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  outline: none;
}

#divioseo-savia-send:hover:not(:disabled) { background: var(--savia-accent-dark); }
#divioseo-savia-send:disabled { opacity: .45; cursor: not-allowed; }

#divioseo-savia-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 420px) {
  #divioseo-savia-panel {
    right: 8px;
    bottom: 80px;
    width: calc(100vw - 16px);
  }

  #divioseo-savia-launcher {
    right: 12px;
    bottom: 16px;
  }
}
