/* ── Eva Centered Chat Modal ── */

/* Overlay */
.eva-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  animation: evaFadeIn 0.3s ease;
}

.eva-overlay.active {
  display: block;
}

/* Modal container */
.eva-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 32px);
  background: var(--bg-card, #fff);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  z-index: 1001;
  flex-direction: column;
  overflow: hidden;
  animation: evaModalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.eva-modal.active {
  display: flex;
}

/* ── Top Section: Eva's avatar + intro ── */
.eva-top {
  text-align: center;
  padding: 28px 24px 16px;
  background: linear-gradient(180deg, var(--bg-page, #faf8f5) 0%, var(--bg-card, #fff) 100%);
  flex-shrink: 0;
  position: relative;
}

.eva-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted, #999);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
  transition: all 0.2s;
  z-index: 2;
}

.eva-close-btn:hover {
  background: var(--border-subtle, rgba(0,0,0,0.06));
  color: var(--text-primary, #2c2c2c);
}

.eva-avatar-wrap {
  display: inline-block;
  position: relative;
  margin-bottom: 8px;
}

.eva-avatar-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--accent, #a67c52);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 0 4px 16px rgba(166, 124, 82, 0.15);
}

.eva-avatar-ring img,
.eva-avatar-ring svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
}

.eva-status-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border: 2px solid #fff;
  border-radius: 50%;
}

.eva-top h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary, #2c2c2c);
  margin: 4px 0 2px;
}

.eva-top p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-muted, #888);
  margin: 0;
  font-weight: 400;
}

/* ── Messages area ── */
.eva-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-page, #faf8f5);
  scroll-behavior: smooth;
}

.eva-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  font-family: 'Inter', sans-serif;
  animation: evaMsgIn 0.3s ease;
  word-wrap: break-word;
  position: relative;
}

.eva-msg.bot {
  align-self: flex-start;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #2c2c2c);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.04));
}

.eva-msg.user {
  align-self: flex-end;
  background: var(--accent, #a67c52);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.eva-msg .eva-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.eva-msg .eva-typing span {
  width: 7px;
  height: 7px;
  background: var(--text-muted, #999);
  border-radius: 50%;
  animation: evaTypingBounce 1.4s infinite ease-in-out;
}

.eva-msg .eva-typing span:nth-child(2) { animation-delay: 0.2s; }
.eva-msg .eva-typing span:nth-child(3) { animation-delay: 0.4s; }

.eva-msg a {
  color: var(--accent, #a67c52);
  text-decoration: underline;
}

.eva-msg.user a {
  color: rgba(255,255,255,0.85);
}

/* ── Chips ── */
.eva-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}

.eva-chip {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1.5px solid var(--accent, #a67c52);
  background: transparent;
  color: var(--accent, #a67c52);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.eva-chip:hover {
  background: var(--accent, #a67c52);
  color: #fff;
}

/* ── Input area ── */
.eva-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
  flex-shrink: 0;
}

.eva-input {
  flex: 1;
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.1));
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--bg-page, #faf8f5);
  color: var(--text-primary, #2c2c2c);
  outline: none;
  transition: border-color 0.2s;
}

.eva-input:focus {
  border-color: var(--accent, #a67c52);
}

.eva-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent, #a67c52);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.eva-send:hover {
  background: var(--accent-hover, #8c6a44);
  transform: scale(1.05);
}

.eva-send:active {
  transform: scale(0.95);
}

.eva-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── Dark mode ── */
[data-theme="dark"] .eva-modal {
  background: #1e1e1b;
}

[data-theme="dark"] .eva-top {
  background: linear-gradient(180deg, #1a1a18 0%, #1e1e1b 100%);
}

[data-theme="dark"] .eva-avatar-ring {
  background: #262622;
  border-color: var(--accent, #c4a882);
}

[data-theme="dark"] .eva-top h2 {
  color: #e0ddd5;
}

[data-theme="dark"] .eva-msgs {
  background: #1a1a18;
}

[data-theme="dark"] .eva-msg.bot {
  background: #262622;
  color: #e0ddd5;
  border-color: rgba(255,255,255,0.04);
}

[data-theme="dark"] .eva-input {
  background: #262622;
  color: #e0ddd5;
  border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .eva-input:focus {
  border-color: var(--accent, #c4a882);
}

[data-theme="dark"] .eva-input-area {
  background: #1e1e1b;
  border-color: rgba(255,255,255,0.06);
}

/* ── Animations ── */
@keyframes evaFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes evaModalIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1) translateY(0); }
}

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

@keyframes evaTypingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ── Responsive ── */
@media (max-width: 540px) {
  .eva-modal {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
    animation: evaMobileIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .eva-modal.active {
    border-radius: 0;
  }

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

  .eva-avatar-ring {
    width: 72px;
    height: 72px;
  }

  .eva-top {
    padding: 20px 20px 12px;
  }

  .eva-top h2 {
    font-size: 18px;
  }

  .eva-msgs {
    padding: 10px 14px;
  }
}
