/* =========================================
   KIMIT REAL ESTATE — WIDGET STYLES
   Agente: Kimit | Sin pantallas de API Key
   Paleta: Dorado #C9A84C | Negro #0D0D0D
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --gold: #C9A84C;
  --gold-light: #E8D5A3;
  --gold-dark: #9A7A32;
  --gold-gradient: linear-gradient(135deg, #C9A84C 0%, #E8D5A3 50%, #C9A84C 100%);
  --dark: #0D0D0D;
  --dark-surface: #1A1A1A;
  --dark-card: #222222;
  --dark-border: #2E2E2E;
  --dark-input: #2A2A2A;
  --white: #FFFFFF;
  --white-dim: rgba(255,255,255,0.7);
  --white-faint: rgba(255,255,255,0.1);
  --green-wa: #25D366;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-gold: 0 8px 32px rgba(201, 168, 76, 0.3);
  --shadow-dark: 0 20px 60px rgba(0,0,0,0.6);
  --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

#kimit-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: var(--font);
}

#kimit-bubble {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--gold-gradient);
  background-size: 200% 200%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
  transition: var(--transition);
  position: relative;
  animation: bubblePulse 3s ease-in-out infinite;
}

#kimit-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(201, 168, 76, 0.5);
}

#kimit-bubble svg {
  width: 28px;
  height: 28px;
  fill: var(--dark);
  transition: var(--transition);
}

#kimit-bubble .bubble-close {
  display: none;
  font-size: 22px;
  color: var(--dark);
  font-weight: 700;
  line-height: 1;
}

#kimit-bubble.open svg {
  display: none;
}

#kimit-bubble.open .bubble-close {
  display: block;
}

#kimit-bubble::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: 0;
  animation: pingRing 3s ease-out infinite;
}

@keyframes bubblePulse {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes pingRing {
  0% { transform: scale(1); opacity: 0.6; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { opacity: 0; }
}

#kimit-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #E53935;
  border-radius: 50%;
  border: 2px solid var(--dark);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  font-weight: 700;
}

#kimit-badge.show {
  display: flex;
}

#kimit-panel {
  position: absolute;
  bottom: 78px;
  right: 0;
  width: 380px;
  height: 570px;
  background: var(--dark-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--dark-border);
}

#kimit-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

#kimit-header {
  background: linear-gradient(135deg, #141414 0%, #1E1A0E 50%, #141414 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  flex-shrink: 0;
  position: relative;
}

#kimit-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: var(--gold-gradient);
  opacity: 0.5;
}

#kimit-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}

.kimit-header-info {
  flex: 1;
  min-width: 0;
}

.kimit-agent-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.kimit-agency-name {
  font-size: 11.5px;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.kimit-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.kimit-status-dot {
  width: 7px;
  height: 7px;
  background: #4CAF50;
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}

.kimit-status-text {
  font-size: 11px;
  color: var(--white-dim);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

#kimit-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#kimit-messages::-webkit-scrollbar {
  width: 4px;
}

#kimit-messages::-webkit-scrollbar-thumb {
  background: var(--dark-border);
  border-radius: 4px;
}

.kimit-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
  animation: msgFadeIn 0.3s ease forwards;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.kimit-msg.user {
  flex-direction: row-reverse;
}

.kimit-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}

.kimit-msg-content {
  max-width: calc(100% - 50px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kimit-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.kimit-msg.bot .kimit-msg-bubble {
  background: var(--dark-card);
  color: var(--white);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--dark-border);
}

.kimit-msg.user .kimit-msg-bubble {
  background: var(--gold-gradient);
  color: var(--dark);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.kimit-msg-bubble strong {
  color: var(--gold-light);
  font-weight: 600;
}

.kimit-msg.user .kimit-msg-bubble strong {
  color: var(--dark);
}

.kimit-prop-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.kimit-prop-card {
  background: linear-gradient(135deg, #1E1A0E 0%, #1A1A1A 100%);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kimit-prop-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gold-gradient);
}

.kimit-prop-card:hover {
  border-color: rgba(201, 168, 76, 0.5);
  transform: translateX(2px);
}

.prop-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.prop-card-id {
  font-size: 10px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.prop-card-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.prop-card-badge.sale {
  background: rgba(201, 168, 76, 0.2);
  color: var(--gold);
}

.prop-card-badge.rent {
  background: rgba(76, 175, 80, 0.2);
  color: #4CAF50;
}

.prop-card-badge.offplan {
  background: rgba(33, 150, 243, 0.2);
  color: #64B5F6;
}

.prop-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
}

.prop-card-zone {
  font-size: 11.5px;
  color: var(--white-dim);
  margin-bottom: 6px;
}

.prop-card-specs {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
  color: var(--white-dim);
  margin-bottom: 8px;
}

.prop-card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

/* ---- Badge de Confirmación de Derivación (CRM Invisible) ---- */
.kimit-lead-confirmed {
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: #A5D6A7;
  display: flex;
  align-items: center;
  gap: 8px;
}

#kimit-typing {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 14px 8px;
}

#kimit-typing.show {
  display: flex;
}

.typing-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.typing-bubble {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  animation: typingDot 1.2s ease-in-out infinite;
  opacity: 0.5;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

#kimit-quick-actions {
  padding: 8px 14px 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.kimit-quick-btn {
  background: var(--white-faint);
  border: 1px solid var(--dark-border);
  border-radius: 20px;
  color: var(--white-dim);
  font-family: var(--font);
  font-size: 11.5px;
  padding: 5px 12px;
  cursor: pointer;
  transition: var(--transition);
}

.kimit-quick-btn:hover {
  background: rgba(201, 168, 76, 0.15);
  border-color: var(--gold);
  color: var(--gold-light);
}

#kimit-input-area {
  padding: 10px 14px 14px;
  background: var(--dark);
  border-top: 1px solid var(--dark-border);
}

.kimit-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#kimit-input {
  flex: 1;
  background: var(--dark-input);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  color: var(--white);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 10px 14px;
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
}

#kimit-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gold-gradient);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#kimit-send svg {
  width: 18px;
  height: 18px;
  fill: var(--dark);
}

.kimit-powered {
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  margin-top: 6px;
}

@media (max-width: 420px) {
  #kimit-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 120px);
    right: -10px;
  }
}
