/* ===== PCSC ChatKit Widget UI (clean) ===== */

/* Brand colors (header + button) */
:root {
  --pcsc-accent-1: #2563eb;
  --pcsc-accent-2: #06b6d4;
}

/* Root launcher position */
.pcsc-chatkit-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: inherit;
}

/* Launcher button */
.pcsc-chatkit-root .pcsc-chatkit-btn {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: 0 !important;
  padding: 0 !important;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(135deg, var(--pcsc-accent-1), var(--pcsc-accent-2)) !important;
  color: #ffffff !important;

  box-shadow: 0 14px 35px rgba(0,0,0,0.22), 0 0 0 4px rgba(255,255,255,0.85);
}

.pcsc-chatkit-root .pcsc-chatkit-btn svg,
.pcsc-chatkit-root .pcsc-chatkit-btn svg * {
  stroke: currentColor !important;
}

/* Panel */
.pcsc-chatkit-root .pcsc-chatkit-panel {
  position: fixed;
  right: 18px;
  bottom: 90px;

  width: min(390px, calc(100vw - 36px));
  height: var(--pcsc-chat-height, 650px);
  max-height: calc(100vh - 130px);

  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 22px 70px rgba(0,0,0,0.28);

  overflow: hidden;
  display: none;
}

.pcsc-chatkit-root .pcsc-chatkit-panel.is-open {
  display: block;
}

/* Header */
.pcsc-chatkit-root .pcsc-chatkit-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 12px 0 14px;

  background: linear-gradient(135deg, var(--pcsc-accent-1), var(--pcsc-accent-2)) !important;
  color: #ffffff !important;

  border-bottom: 1px solid rgba(255,255,255,0.18);
}

.pcsc-chatkit-root .pcsc-chatkit-title {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Close button (pure black bg, white X) */
.pcsc-chatkit-root .pcsc-chatkit-close {
  width: 34px;
  height: 34px;

  border: 0 !important;
  background: #000000 !important;
  color: #ffffff !important;

  cursor: pointer;
  font-size: 24px;
  line-height: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;
}

/* Body */
.pcsc-chatkit-root .pcsc-chatkit-body {
  position: relative;
  height: calc(100% - 48px);
  background: #ffffff;
}

/* Loading overlay */
.pcsc-chatkit-root .pcsc-chatkit-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  font-weight: 500;
  color: #111827;

  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);

  z-index: 2;
}

/* Mobile / iPad portrait support */
@media (max-width: 820px) {
  .pcsc-chatkit-root {
    right: 10px;
    bottom: 14px;
  }

  .pcsc-chatkit-root .pcsc-chatkit-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 80px;

    /* iOS dynamic viewport behavior */
    top: 12px;
    height: auto !important;
    max-height: none !important;
  }

  .pcsc-chatkit-root .pcsc-chatkit-body {
    height: calc(100dvh - 12px - 80px - 48px) !important;
  }
}

/* Force body + web component to fill the panel */
.pcsc-chatkit-root .pcsc-chatkit-body {
  height: calc(100% - 48px) !important;
}

.pcsc-chatkit-root openai-chatkit {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 300px !important;
}

/* ===== iOS/Mobile FINAL OVERRIDE (keep at very bottom) ===== */
@media (max-width: 1024px) {
  .pcsc-chatkit-root .pcsc-chatkit-header {
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
    color: #ffffff !important;
  }

  .pcsc-chatkit-root .pcsc-chatkit-title {
    color: #ffffff !important;
  }
}

@media (max-width: 1024px) {
  div.pcsc-chatkit-root div.pcsc-chatkit-panel div.pcsc-chatkit-header {
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
  }
  div.pcsc-chatkit-root div.pcsc-chatkit-panel div.pcsc-chatkit-header .pcsc-chatkit-title {
    color: #fff !important;
  }
}

