/* ═══════════════════════════════════════════
   D'LOGIA — DILO Chat Widget
   chat.css
═══════════════════════════════════════════ */

/* ── Floating button ── */
#chat-btn {
  position: fixed;
  bottom: 28px;
  right: 74px;
  z-index: 300;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(108,99,255,0.5);
  transition: background var(--t-fast), transform var(--t-fast);
  animation: chat-pulse 3s ease-in-out infinite;
}
#chat-btn:hover { background: var(--accentH); transform: scale(1.08); animation: none; }
#chat-btn svg { transition: transform 0.2s ease; }
#chat-btn.open svg.icon-chat { display: none; }
#chat-btn.open svg.icon-close { display: block; }
#chat-btn svg.icon-close { display: none; }

@keyframes chat-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(108,99,255,0.5); }
  50%      { box-shadow: 0 0 0 10px rgba(108,99,255,0); }
}

/* Notification dot */
#chat-btn .notif {
  position: absolute;
  top: 2px; right: 2px;
  width: 12px; height: 12px;
  background: var(--teal);
  border: 2px solid var(--bg);
  border-radius: 50%;
  animation: notif-pop 0.3s ease 2s both;
}
@keyframes notif-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Chat window ── */
#chat-window {
  position: fixed;
  bottom: 96px;
  right: 74px;
  z-index: 299;
  width: 400px;
  height: 620px;
  background: var(--bg2);
  border: 1px solid var(--borderH);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(20px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
}
#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Iframe ── */
#chat-iframe {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 0;
}

/* ── MODAL — Add review ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9,9,14,0.82);
  backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#modal-overlay.open { opacity: 1; pointer-events: all; }

#modal {
  background: var(--bg2);
  border: 1px solid var(--borderH);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 480px;
  max-width: calc(100vw - 32px);
  transform: scale(0.94) translateY(16px);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
#modal-overlay.open #modal { transform: scale(1) translateY(0); }

.modal-title {
  font-family: var(--fd);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

.modal-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-field {
  font-family: var(--fb);
  font-size: 14px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast);
  width: 100%;
}
.form-field:focus { border-color: var(--accent); }
.form-field::placeholder { color: var(--dim); }
textarea.form-field { resize: vertical; min-height: 90px; }

.star-picker { display: flex; gap: 4px; margin-bottom: 4px; }
.star-pick {
  font-size: 22px;
  cursor: pointer;
  color: var(--border);
  transition: color var(--t-fast), transform var(--t-fast);
}
.star-pick.active, .star-pick:hover { color: var(--amber); transform: scale(1.15); }

.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-cancel {
  flex: 1;
  font-size: 14px;
  padding: 11px;
  background: transparent;
  border: 1px solid var(--borderH);
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.modal-cancel:hover { border-color: var(--borderH); color: var(--text); }
.modal-submit {
  flex: 2;
  font-size: 14px;
  font-weight: 500;
  padding: 11px;
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  color: #fff;
  cursor: pointer;
  transition: background var(--t-fast);
}
.modal-submit:hover { background: var(--accentH); }

@media (max-width: 768px) {
  #chat-btn {
    right: 20px;
    bottom: 20px;
    width: 62px;
    height: 62px;
    box-shadow: 0 4px 20px rgba(108,99,255,0.45);
  }
  #chat-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 120px);
    right: 12px;
    left: 12px;
    bottom: 96px;
    border-radius: 16px;
  }
}
