/* ===== Chatbot + Calculator Popup CSS (CA-06) ===== */

/* Calculator Popup */
.calc-popup-overlay {
  position: fixed; inset: 0; z-index: 1001;
  background: rgba(9,10,12,.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity .5s ease;
}
.calc-popup-overlay.active {
  display: flex;
  opacity: 1;
}
.calc-popup {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 36px 32px;
  max-width: 480px; width: 100%;
  text-align: center; position: relative;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px) scale(.96);
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .4s ease;
  opacity: 0;
}
.calc-popup-overlay.active .calc-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.calc-popup-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: var(--text-dim);
  font-size: 1.6rem; cursor: pointer; line-height: 1;
  padding: 4px 8px; transition: color .2s; font-family: var(--font-sans);
}
.calc-popup-close:hover { color: var(--text); }
.calc-popup-icon { font-size: 2.4rem; margin-bottom: 12px; }
.calc-popup-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 10px; line-height: 1.2; }
.calc-popup-title .accent { color: var(--accent); }
.calc-popup-desc { font-size: .85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 18px; }
.calc-popup-benefits { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.calc-popup-benefits span { font-size: .72rem; color: var(--text-dim); font-family: var(--font-mono); }
.calc-popup-cta { width: 100%; justify-content: center; text-decoration: none; font-size: .95rem; }
.calc-popup-dismiss {
  display: block; margin: 14px auto 0;
  background: none; border: none; color: var(--text-dim);
  font-size: .75rem; cursor: pointer; font-family: var(--font-mono);
  padding: 6px 12px; transition: color .2s;
}
.calc-popup-dismiss:hover { color: var(--text-muted); }
@media(max-width:480px){
  .calc-popup { padding: 28px 20px 24px; }
  .calc-popup-title { font-size: 1.1rem; }
  .calc-popup-benefits { flex-direction: column; align-items: center; gap: 4px; }
}

/* WhatsApp FAB — non-critical styles */
.whatsapp-fab:hover { transform: scale(1.1); box-shadow: 0 6px 30px rgba(255, 90, 54, 0.5); }
.wa-tooltip {
  position: absolute; right: 72px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; padding: 8px 16px; border-radius: 4px;
  background: var(--bg-card, #101114); border: 1px solid var(--border, rgba(232,234,237,.08));
  font-size: 0.8rem; opacity: 0; pointer-events: none; transition: all 0.3s;
  color: var(--text, #e8eaed);
}
.whatsapp-fab:hover .wa-tooltip { opacity: 1; }
@keyframes wa-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Chatbot Window */
.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 120px);
  max-width: calc(100vw - 48px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(9, 10, 12, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 90, 54, 0.18);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chatbot-window.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.chatbot-header {
  padding: 16px 20px;
  background: rgba(12, 14, 18, 0.7);
  border-bottom: 1px solid var(--border, rgba(232,234,237,.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chatbot-header-info { display: flex; align-items: center; gap: 12px; }
.chatbot-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-card, #101114);
  border: 1px solid rgba(255, 90, 54, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 12px rgba(255, 90, 54, 0.1);
}
.chatbot-name { font-size: 0.95rem; font-weight: 600; color: var(--text, #e8eaed); margin-bottom: 2px; }
.chatbot-status { font-size: 0.75rem; color: var(--text-dim, rgba(232,234,237,.28)); display: flex; align-items: center; gap: 6px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 8px #22c55e; display: inline-block; animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.chatbot-header-actions { display: flex; align-items: center; gap: 10px; }
.chatbot-action-btn {
  color: var(--text-dim, rgba(232,234,237,.28)); transition: all 0.3s;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
}
.chatbot-action-btn:hover { color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.chatbot-close-btn {
  background: none; border: none; color: var(--text-muted, rgba(232,234,237,.48));
  font-size: 1.5rem; cursor: pointer; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all 0.3s;
}
.chatbot-close-btn:hover { color: var(--text, #e8eaed); background: rgba(255, 255, 255, 0.05); }
.chatbot-body {
  flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  background: radial-gradient(circle at top right, rgba(255, 90, 54, 0.03), transparent 40%),
              rgba(6, 10, 16, 0.4);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.chatbot-body::-webkit-scrollbar { width: 5px; }
.chatbot-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
.message {
  max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 0.875rem; line-height: 1.45;
  animation: msg-slide 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
  word-wrap: break-word; white-space: pre-wrap;
}
@keyframes msg-slide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.message.incoming {
  align-self: flex-start;
  background: rgba(16, 18, 24, 0.85);
  border: 1px solid var(--border, rgba(232,234,237,.08));
  color: var(--text, #e8eaed);
  border-bottom-left-radius: 4px;
}
.message.incoming strong { color: #ff5a36; }
.message.outgoing {
  align-self: flex-end;
  background: linear-gradient(135deg, #ff5a36, #ff7353);
  color: #090a0c;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(255, 90, 54, 0.15);
}
.quick-replies { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; width: 100%; }
.quick-reply-btn {
  background: rgba(255, 90, 54, 0.08);
  border: 1px solid rgba(255, 90, 54, 0.25);
  border-radius: 8px;
  color: var(--text, #e8eaed);
  padding: 8px 12px; font-size: 0.8rem; text-align: left; cursor: pointer;
  transition: all 0.3s; font-weight: 500; font-family: var(--font-sans, 'Inter', sans-serif);
}
.quick-reply-btn:hover {
  background: #ff5a36; color: #090a0c; border-color: #ff5a36; transform: translateX(4px);
}
.typing-indicator-msg { padding: 12px 16px; min-width: 60px; display: flex; align-items: center; justify-content: center; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px; background: rgba(232, 234, 237, 0.4);
  border-radius: 50%; animation: typing-dot 1.4s infinite ease-in-out both;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing-dot { 0%, 80%, 100% { transform: scale(0); opacity: 0.3; } 40% { transform: scale(1); opacity: 1; } }
.chatbot-footer { padding: 14px 20px; background: rgba(12, 14, 18, 0.85); border-top: 1px solid var(--border, rgba(232,234,237,.08)); }
#chatbotForm { display: flex; gap: 8px; align-items: center; }
#chatbotInput {
  flex: 1; background: rgba(6, 10, 16, 0.5);
  border: 1px solid var(--border, rgba(232,234,237,.08));
  border-radius: 8px; padding: 10px 14px;
  color: var(--text, #e8eaed); font-size: 0.875rem;
  outline: none; transition: all 0.3s; font-family: var(--font-sans, 'Inter', sans-serif);
}
#chatbotInput:focus { border-color: #ff5a36; box-shadow: 0 0 0 2px rgba(255, 90, 54, 0.15); }
#chatbotInput::placeholder { color: var(--text-dim, rgba(232,234,237,.28)); }
.chatbot-send-btn {
  background: #ff5a36; border: none; color: #090a0c;
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.3s;
}
.chatbot-send-btn:hover { background: #ff7353; transform: scale(1.05); }
@keyframes confettiFall { 0% { opacity: 1; } 100% { opacity: 0; transform: translateY(100vh) rotate(720deg); } }
@media (max-width: 480px) {
  .whatsapp-fab { width: 52px; height: 52px; right: 16px; bottom: 16px; }
  .whatsapp-fab svg { width: 24px; height: 24px; }
  .wa-tooltip { display: none; }
  .chatbot-window {
    bottom: 0; right: 0; width: 100%; height: 100%;
    max-height: 100%; max-width: 100%; border-radius: 0; border: none;
  }
}

/* Override hidden attribute — CSS display:flex overrides UA display:none */
.chatbot-window[hidden] {
  display: none !important;
}
