/* ============================================================
   DomoMatch — Chat Widget CSS
   ============================================================ */

.domomatch-wrap {
  margin-top: 12px;
}

/* ---- Pulsante principale ---- */
.domomatch-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f97316;
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.domomatch-open-btn:hover {
  background: #ea6c0a;
  transform: translateY(-1px);
}
.domomatch-open-btn .material-icons {
  font-size: 1.1rem;
}

/* ---- Chat popup ---- */
.domomatch-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: domomatch-slide-in 0.2s ease;
}
@keyframes domomatch-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Header chat ---- */
.domomatch-chat-header {
  background: linear-gradient(135deg, #0057b8, #003d82);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.domomatch-bot-avatar { font-size: 1.4rem; }
.domomatch-bot-name   { font-weight: 600; flex: 1; }
.domomatch-close-btn  {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.2s;
}
.domomatch-close-btn:hover { background: rgba(255,255,255,0.15); }

/* ---- Area messaggi ---- */
.domomatch-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  max-height: 240px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.domomatch-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: domomatch-msg-in 0.2s ease;
}
@keyframes domomatch-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.domomatch-msg.bot {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.domomatch-msg.user {
  background: #0057b8;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ---- Step input area ---- */
.domomatch-step {
  padding: 14px 16px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
}

.domomatch-gdpr-box {
  background: #f0f7ff;
  border: 1px solid #bdd8f5;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.domomatch-gdpr-box input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}

.domomatch-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.875rem;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.2s;
}
.domomatch-input:focus { border-color: #0057b8; }

.domomatch-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.domomatch-input-row .domomatch-input {
  flex: 1;
  margin-bottom: 0;
}

/* ---- Pulsanti azione ---- */
.domomatch-btn-primary {
  background: #0057b8;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.domomatch-btn-primary:hover { background: #003d82; }

.domomatch-btn-secondary {
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.domomatch-btn-secondary:hover { background: #ea6c0a; }

.domomatch-btn-link {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 8px 4px;
  text-decoration: underline;
}

.domomatch-btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.domomatch-start-btn {
  width: 100%;
  padding: 10px;
}

/* ---- Tabella sconti qtà ---- */
.domomatch-qty-table {
  margin-top: 12px;
  background: #f0f7ff;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
}
.domomatch-qty-table table { width: 100%; margin-top: 4px; }
.domomatch-qty-table td { padding: 2px 6px; }

/* ---- Risultato finale ---- */
.domomatch-result-box {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 14px;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 10px;
}

.domomatch-code {
  display: inline-block;
  background: #0057b8;
  color: #fff;
  font-family: monospace;
  font-size: 1rem;
  padding: 4px 12px;
  border-radius: 4px;
  letter-spacing: 2px;
  margin: 4px 0;
}

/* ---- Lista offerte frontend ---- */
.domomatch-myoffers .domomatch-code-inline {
  background: #f0f4ff;
  border: 1px solid #c7d7fc;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #1e40af;
  letter-spacing: 1px;
}

/* ---- Loading spinner ---- */
.domomatch-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #0057b8;
  border-radius: 50%;
  animation: domomatch-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes domomatch-spin {
  to { transform: rotate(360deg); }
}

/* ---- Mobile ---- */
@media (max-width: 576px) {
  .domomatch-chat {
    bottom: 0;
    right: 0;
    width: 100vw;
    border-radius: 12px 12px 0 0;
  }
}

/* Pulsante carrello nel risultato negoziazione */
.domomatch-cart-btn {
  display: inline-block;
  margin: 8px 0 4px;
  padding: 10px 18px;
  background: #28a745;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
}
.domomatch-cart-btn:hover {
  background: #218838;
  color: #fff !important;
}

/* Pulsante carrello nel risultato negoziazione */
.domomatch-cart-btn {
  display: inline-block;
  margin: 8px 0 4px;
  padding: 10px 18px;
  background: #28a745;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  font-size: 15px;
}
.domomatch-cart-btn:hover { background: #218838; color: #fff !important; }

/* ---- Login prompt per utenti non loggati ---- */
.domomatch-login-prompt {
  padding: 12px 4px 4px;
}
.domomatch-login-text {
  font-size: 13px;
  color: #555;
  margin-bottom: 12px;
  line-height: 1.5;
}
.domomatch-login-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.domomatch-login-btn {
  display: block;
  text-align: center;
  padding: 10px;
  background: #0057b8;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
}
.domomatch-login-btn:hover { background: #003d82; color: #fff !important; }
.domomatch-reg-btn {
  display: block;
  text-align: center;
  padding: 9px;
  background: #fff;
  color: #0057b8 !important;
  border: 2px solid #0057b8;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}
.domomatch-reg-btn:hover { background: #f0f6ff; color: #003d82 !important; }
.domomatch-btn-installer {
  display: block;
  text-align: center;
  padding: 9px;
  background: #f97316;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  font-size: 13px;
}
.domomatch-btn-installer:hover { background: #ea6c0a; color: #fff !important; }

/* ---- Retention box ---- */
.domomatch-retention-box { padding: 4px 0; }
.domomatch-ret-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.domomatch-ret-btns .domomatch-btn-link { font-size: 12px; color: #888; text-decoration: underline; background: none; border: none; cursor: pointer; padding: 0; text-align: left; }

/* ---- Post-conferma & Toast ---- */
.domomatch-goto-cart-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: #2196f3;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}
.domomatch-goto-cart-btn:hover { background: #1976d2; }

.domomatch-more-products-btn {
  padding: 8px 14px;
  font-size: 13px;
}

.domomatch-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 99999;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.domomatch-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Nuovi step flusso negoziazione ---- */
.domomatch-btn-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.domomatch-input-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.domomatch-btn-link {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 0;
}
.domomatch-btn-link:hover { color: #374151; }
