/* ITZ Digital Labs — AI features: chatbot, estimator, exit-intent, blog search, comparison, RTL */

/* ---------- Shared buttons ---------- */
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-muted);
}
.btn--ghost:hover { color: var(--text); border-color: var(--primary); }
.btn--sm { padding: 10px 16px; font-size: 0.9rem; }

/* ---------- Contact-bar estimate button ---------- */
.contact-bar__btn--estimate {
  border: none;
  cursor: pointer;
  font-family: inherit;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
}
.contact-bar__btn--estimate:hover { filter: brightness(1.08); }

/* ---------- Modal base ---------- */
.itz-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}
.itz-modal.is-open { display: flex; animation: itzFade 0.25s ease; }
.itz-modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  animation: itzPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.itz-modal__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}
.itz-modal__close:hover { background: var(--bg-card-hover); color: var(--text); }

@keyframes itzFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes itzPop { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- Estimator ---------- */
.itz-est__head { text-align: center; margin-bottom: 18px; }
.itz-est__badge,
.itz-exit__badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--gradient-subtle);
  border: 1px solid var(--border);
  color: var(--primary-light);
  margin-bottom: 12px;
}
.itz-est__head h2 { font-size: 1.5rem; margin-bottom: 6px; }
.itz-est__head p { color: var(--text-muted); font-size: 0.95rem; }
.itz-est__bar { height: 4px; background: var(--bg-card); border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.itz-est__progress { display: block; height: 100%; width: 25%; background: var(--gradient); transition: width 0.35s ease; }
.itz-est__q { font-size: 1.12rem; margin-bottom: 16px; }
.itz-est__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.itz-est__opt {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.itz-est__opt:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.itz-est__opt.is-on { border-color: var(--primary); background: var(--gradient-subtle); color: #fff; }
.itz-est__checks { display: grid; gap: 8px; margin-bottom: 18px; }
.itz-est__check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.92rem;
  transition: var(--transition);
}
.itz-est__check.is-on { border-color: var(--primary); background: var(--gradient-subtle); }
.itz-est__check input { width: 18px; height: 18px; accent-color: var(--primary); }
.itz-est__result {
  text-align: center;
  padding: 16px;
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.itz-est__result span { display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.itz-est__result strong { display: block; font-size: 1.7rem; font-weight: 800; margin: 4px 0; background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.itz-est__result em { font-style: normal; color: var(--text-muted); font-size: 0.88rem; }
.itz-est__result--big strong { font-size: 2.1rem; }
.itz-est__note { color: var(--text-muted); font-size: 0.9rem; text-align: center; margin-bottom: 16px; }
.itz-est__form { display: grid; gap: 10px; margin-bottom: 14px; }
.itz-est__form input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
}
.itz-est__form input:focus { outline: none; border-color: var(--primary); }
.itz-est__nav { display: flex; justify-content: space-between; gap: 10px; }
.itz-est__nav .btn { flex: 0 0 auto; }
.itz-est__nav .btn[data-next] { margin-left: auto; }

/* ---------- Exit intent ---------- */
.itz-exit__panel { text-align: center; max-width: 480px; }
.itz-exit__panel h2 { font-size: 1.6rem; margin-bottom: 10px; }
.itz-exit__panel > p { color: var(--text-muted); margin-bottom: 20px; }
.itz-exit__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.itz-exit__tiny { font-size: 0.8rem; color: var(--text-dim); }

/* ---------- Form field hints ---------- */
.itz-field-hint { display: block; margin-top: 6px; font-size: 0.8rem; color: #f87171; }
input.is-invalid { border-color: #f87171 !important; }

/* ---------- Chatbot ---------- */
.itz-chat { position: fixed; bottom: 24px; left: 24px; z-index: 1500; }
.itz-chat__launcher {
  position: relative;
  width: 60px; height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition);
}
.itz-chat__launcher:hover { transform: scale(1.06); }
.itz-chat__icon-close { display: none; }
.itz-chat.is-open .itz-chat__icon-open { display: none; }
.itz-chat.is-open .itz-chat__icon-close { display: block; }
.itz-chat__ping {
  position: absolute; top: 10px; right: 10px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--whatsapp);
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
  animation: itzPing 2s infinite;
}
.itz-chat.is-open .itz-chat__ping { display: none; }
@keyframes itzPing { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,0.6);} 70%{ box-shadow:0 0 0 12px rgba(37,211,102,0);} 100%{ box-shadow:0 0 0 0 rgba(37,211,102,0);} }

.itz-chat__panel {
  position: absolute;
  bottom: 76px; left: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  display: none;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.itz-chat.is-open .itz-chat__panel { display: flex; animation: itzPop 0.28s cubic-bezier(0.34,1.56,0.64,1); }
.itz-chat__header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: var(--gradient);
  color: #fff;
}
.itz-chat__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
}
.itz-chat__header strong { display: block; font-size: 0.98rem; }
.itz-chat__header span { font-size: 0.78rem; opacity: 0.85; }
.itz-chat__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.itz-chat__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.itz-chat__msg--bot { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.itz-chat__msg--user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.itz-chat__quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.itz-chat__chip {
  padding: 7px 12px;
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  background: transparent;
  color: var(--primary-light);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}
.itz-chat__chip:hover { background: var(--gradient-subtle); color: #fff; }
.itz-chat__cta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.itz-chat__typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; }
.itz-chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: itzBounce 1.2s infinite; }
.itz-chat__typing span:nth-child(2) { animation-delay: 0.2s; }
.itz-chat__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes itzBounce { 0%,60%,100%{ transform: translateY(0); opacity: 0.4;} 30%{ transform: translateY(-5px); opacity: 1;} }
.itz-chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.itz-chat__input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--text); font-size: 0.9rem; }
.itz-chat__input:focus { outline: none; border-color: var(--primary); }
.itz-chat__send { width: 42px; height: 42px; flex: 0 0 42px; border: none; border-radius: 50%; background: var(--gradient); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ---------- Blog conversational search ---------- */
.itz-search { max-width: 720px; margin: 0 auto 32px; }
.itz-search__box { display: flex; gap: 8px; }
.itz-search__input {
  flex: 1;
  padding: 15px 18px;
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
}
.itz-search__input:focus { outline: none; border-color: var(--primary); }
.itz-search__btn { padding: 0 24px; border: none; border-radius: 999px; background: var(--gradient); color: #fff; font-weight: 600; cursor: pointer; }
.itz-search__answer { margin-top: 16px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); display: none; }
.itz-search__answer.is-on { display: block; animation: itzFade 0.3s ease; }
.itz-search__answer h3 { font-size: 1.05rem; margin-bottom: 8px; }
.itz-search__answer p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 12px; }
.itz-search__links { display: flex; flex-direction: column; gap: 8px; }
.itz-search__links a { font-size: 0.92rem; }
.itz-search__cta { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- Blog quick-answer (AEO) ---------- */
.quick-answer {
  margin: 0 0 28px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--gradient-subtle);
}
.quick-answer strong { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary-light); margin-bottom: 6px; }
.quick-answer p { margin: 0; color: var(--text); font-size: 1rem; }

/* ---------- Comparison page ---------- */
.compare-table-wrap { overflow-x: auto; margin: 32px 0; }
.compare-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.compare-table th, .compare-table td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.94rem; }
.compare-table thead th { font-size: 1rem; }
.compare-table thead th:first-child { color: var(--text-muted); }
.compare-table .col-itz { background: var(--gradient-subtle); color: #fff; font-weight: 600; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.compare-table tbody th { color: var(--text-muted); font-weight: 500; }
.compare-yes { color: var(--whatsapp); font-weight: 700; }
.compare-no { color: var(--text-dim); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .itz-est__grid { grid-template-columns: 1fr; }
  .itz-modal__panel { padding: 24px 18px; }
  .itz-chat { bottom: 16px; left: 16px; }
  .itz-chat__launcher { width: 54px; height: 54px; }
  .itz-search__box { flex-direction: column; }
  .itz-search__btn { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .itz-modal.is-open, .itz-modal__panel, .itz-chat.is-open .itz-chat__panel,
  .itz-chat__ping, .itz-chat__typing span, .itz-search__answer.is-on { animation: none !important; }
}
