/* ---------- Asistente Montcastell-ai · widget (light premium) ---------- */
.mc-widget {
  position: fixed;
  right: clamp(0.75rem, 2vw, 1.5rem);
  bottom: clamp(0.75rem, 2vw, 1.5rem);
  width: min(420px, calc(100vw - 1.5rem));
  height: min(620px, calc(100vh - 1.5rem));
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  box-shadow:
    0 30px 80px -20px rgba(14, 13, 10, 0.35),
    0 0 0 1px rgba(182, 134, 74, 0.18);
  display: none;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
}
.mc-widget[data-open="true"] {
  display: flex;
  animation: mc-pop 0.25s ease-out;
}
@keyframes mc-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.mc-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg), var(--surface));
}
.mc-head-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.mc-head-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mc-head-text { flex: 1; min-width: 0; }
.mc-head-title {
  font-family: "Fraunces", serif;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.mc-head-sub {
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mc-head-sub .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 6px rgba(10, 10, 10, 0.35);
}
.mc-head-close {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.mc-head-close:hover {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}

.mc-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scroll-behavior: smooth;
  background: var(--bg);
}
.mc-msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 16px;
  font-size: 0.93rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mc-msg[data-role="assistant"] {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.mc-msg[data-role="user"] {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-bottom-right-radius: 6px;
}
.mc-msg[data-role="system"] {
  align-self: center;
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}
.mc-msg[data-pending="true"] { opacity: 0.75; }

.mc-voice-indicator {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: rgba(182, 134, 74, 0.12);
  color: var(--gold-deep);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mc-voice-indicator .bars { display: inline-flex; gap: 3px; }
.mc-voice-indicator .bars span {
  display: block;
  width: 3px; height: 14px;
  background: var(--gold);
  border-radius: 2px;
  animation: mc-bars 1s ease-in-out infinite;
}
.mc-voice-indicator .bars span:nth-child(2) { animation-delay: 0.15s; }
.mc-voice-indicator .bars span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mc-bars {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}

.mc-foot {
  border-top: 1px solid var(--line);
  padding: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
}
.mc-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font: inherit;
  font-size: 0.93rem;
  resize: none;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.mc-input::placeholder { color: var(--muted-2); }
.mc-input:focus {
  border-color: var(--ink);
  background: var(--surface);
}

.mc-btn {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  font-family: inherit;
}
.mc-btn:hover { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.mc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mc-btn svg { width: 18px; height: 18px; }

.mc-btn-mic[data-active="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(182, 134, 74, 0.18);
}
.mc-btn-mic[data-active="true"]:hover {
  background: var(--gold-deep);
  border-color: var(--gold-deep);
}

.mc-error {
  margin: 0 1rem 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: #fbe9e7;
  border: 1px solid #f3b5ad;
  color: #8a2a1a;
  font-size: 0.83rem;
}

audio.mc-audio { display: none; }
