/* AI clone chat overlay — loaded separately so it cannot ride a stale style.css cache */

.clone-fab:not(.is-visible) {
  display: none !important;
}

.clone-panel[hidden],
.clone-backdrop[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.clone-fab {
  position: fixed !important;
  right: max(1.25rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 210;
  display: none;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.15rem 0.85rem 0.95rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(90deg, #4338ca 0%, #4f46e5 45%, #7c3aed 100%);
  box-shadow: 0 8px 28px rgba(79, 70, 229, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.clone-fab.is-visible {
  display: inline-flex !important;
}
.clone-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(79, 70, 229, 0.55);
}
.clone-fab i { font-size: 1rem; }
.clone-fab-label { letter-spacing: 0.2px; }

.clone-backdrop {
  position: fixed !important;
  inset: 0;
  z-index: 219;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.clone-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.clone-panel {
  position: fixed !important;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  width: min(400px, 100vw);
  height: 100%;
  height: 100dvh;
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  color-scheme: dark;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.4);
  transform: translateX(110%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  overflow: hidden;
  font-family: Inter, system-ui, sans-serif;
}
.clone-panel.is-open {
  transform: translateX(0);
  pointer-events: auto;
}

.clone-panel button {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}

.clone-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1rem 1rem 1.15rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.22), transparent);
  flex-shrink: 0;
}
.clone-avatar {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(167, 139, 250, 0.65);
  flex-shrink: 0;
}
.clone-header-text { flex: 1; min-width: 0; }
.clone-header-text h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.clone-header-text p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.65);
}
.clone-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.clone-close:hover { background: rgba(255, 255, 255, 0.14); }

.clone-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.clone-msg {
  max-width: 92%;
  padding: 0.75rem 0.95rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  animation: cloneMsgIn 0.28s ease both;
}
.clone-msg a { color: #c4b5fd; text-decoration: underline; }
.clone-msg a:hover { color: #fff; }
.clone-msg strong { color: inherit; font-weight: 600; }
.clone-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-bottom-left-radius: 6px;
}
.clone-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.clone-msg.bot p { margin: 0; }
.clone-msg.bot p + p { margin-top: 0.55rem; }

.clone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.clone-chip {
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: rgba(79, 70, 229, 0.22);
  color: #e0e7ff;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
}
.clone-chip:hover {
  background: rgba(79, 70, 229, 0.45);
  border-color: rgba(167, 139, 250, 0.75);
}

.clone-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 0.35rem 0.15rem;
}
.clone-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a5b4fc;
  animation: cloneDot 1s infinite ease-in-out;
}
.clone-typing span:nth-child(2) { animation-delay: 0.15s; }
.clone-typing span:nth-child(3) { animation-delay: 0.3s; }

.clone-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b1220;
  flex-shrink: 0;
}
.clone-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  appearance: none;
}
.clone-form input::placeholder { color: rgba(226, 232, 240, 0.4); }
.clone-form input:focus {
  border-color: rgba(129, 140, 248, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25);
}
.clone-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
}
.clone-send:hover { background: #7c3aed; }
.clone-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes cloneMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes cloneDot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

body.clone-open { overflow: hidden; }

@media (max-width: 480px) {
  .clone-fab-label { display: none; }
  .clone-fab.is-visible {
    padding: 0.9rem;
    width: 52px;
    height: 52px;
    justify-content: center;
  }
  .clone-panel {
    width: 100vw;
  }
}
