/* ── Container ────────────────────────────────────────────────────── */

.zenode-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Toggle button ────────────────────────────────────────────────── */

.zenode-chat__toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1d4ed8;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.zenode-chat__toggle:hover {
  background: #1e40af;
  transform: scale(1.05);
}

.zenode-chat__icon-close {
  display: none;
}

.zenode-chat--open .zenode-chat__icon-open  { display: none; }
.zenode-chat--open .zenode-chat__icon-close { display: block; }

/* ── Panel ────────────────────────────────────────────────────────── */

.zenode-chat__panel {
  width: 450px;
  height: 600px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Animate in/out */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.zenode-chat__panel:not([hidden]) {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Full-screen expanded */
.zenode-chat--expanded .zenode-chat__panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  z-index: 10000;
}

/* ── Panel header ─────────────────────────────────────────────────── */

.zenode-chat__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1d4ed8;
  color: #fff;
  flex-shrink: 0;
}

.zenode-chat__panel-title {
  font-weight: 600;
  font-size: 15px;
}

.zenode-chat__panel-actions {
  display: flex;
  gap: 8px;
}

.zenode-chat__btn-expand,
.zenode-chat__btn-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.zenode-chat__btn-expand:hover,
.zenode-chat__btn-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

/* Hide expand button when already full-screen */
.zenode-chat--expanded .zenode-chat__btn-expand { display: none; }

/* ── Auth error banner ────────────────────────────────────────────── */

.zenode-chat__auth-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  font-size: 12px;
  color: #b91c1c;
  flex-shrink: 0;
}

.zenode-chat__auth-error-icon {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1.4;
}

.zenode-chat__auth-error-text {
  flex: 1;
  line-height: 1.4;
}

.zenode-chat__auth-error-dismiss {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #b91c1c;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}

.zenode-chat__auth-error-dismiss:hover {
  opacity: 1;
}

/* ── iframe wrapper ───────────────────────────────────────────────── */

.zenode-chat__iframe-wrap {
  flex: 1;
  overflow: hidden;
}

.zenode-chat__iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Mobile ───────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .zenode-chat {
    bottom: 16px;
    right: 16px;
  }

  .zenode-chat__panel {
    width: calc(100vw - 32px);
    height: 70vh;
  }
}
