/* Panah support chat — Telegram-inspired, matches mobile SupportChatOverlay */

/* Author display rules must not override the hidden attribute. */
.psc-root [hidden] {
  display: none !important;
}

:root {
  --psc-header: #5288c1;
  --psc-header-text: #ffffff;
  --psc-chat-bg: #e6ebee;
  --psc-in: #ffffff;
  --psc-out: #effdde;
  --psc-accent: #3390ec;
  --psc-accent-dark: #168acd;
  --psc-text: #222222;
  --psc-muted: #8b98a5;
  --psc-composer: #f4f4f5;
  --psc-online: #4dcd5e;
  --psc-shadow: rgba(0, 0, 0, 0.08);
  --psc-danger: #c62828;
  --psc-font: "Mahboubeh Mehravar", "IRAN Rounded", Tahoma, sans-serif;
}

.psc-fab {
  position: fixed;
  z-index: 99980;
  left: 16px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--psc-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(51, 144, 236, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.psc-fab:hover {
  background: var(--psc-accent-dark);
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(51, 144, 236, 0.5);
}

.psc-fab:active {
  transform: scale(0.96);
}

.psc-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.psc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #f23c34;
  color: #fff;
  font: 700 11px/20px var(--psc-font);
  text-align: center;
}

.psc-root[data-open="1"] .psc-fab {
  display: none;
}

.psc-fab-box {
  position: fixed;
  z-index: 99979;
  left: 82px;
  bottom: 22px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--psc-text);
  padding: 10px 14px 9px;
  min-width: 190px;
  max-width: 230px;
  cursor: pointer;
  text-align: right;
  box-shadow: 0 10px 26px rgba(22, 48, 74, 0.14);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.psc-fab-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(22, 48, 74, 0.18);
}

.psc-fab-box-title {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #1d456c;
  line-height: 1.35;
}

.psc-fab-box-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #5d7083;
  line-height: 1.4;
}

.psc-fab-box::before {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 16px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
}

.psc-root[data-open="1"] .psc-fab-box {
  display: none;
}

.psc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.psc-root[data-open="1"] .psc-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.psc-panel {
  position: fixed;
  z-index: 99991;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(88vh, 720px);
  max-width: 420px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  background: var(--psc-chat-bg);
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: var(--psc-font);
  color: var(--psc-text);
}

.psc-root[data-open="1"] .psc-panel {
  transform: translateY(0);
}

@media (min-width: 560px) {
  .psc-panel {
    left: 16px;
    right: auto;
    bottom: 16px;
    height: min(640px, calc(100vh - 32px));
    border-radius: 20px;
    margin-inline: 0;
  }

  .psc-fab {
    bottom: 24px;
  }

  .psc-fab-box {
    bottom: 26px;
  }
}

.psc-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 12px;
  background: var(--psc-header);
  color: var(--psc-header-text);
  direction: ltr; /* close left, title truly centered */
}

.psc-header-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 0;
  line-height: 0;
}

.psc-header-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.psc-header-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.psc-header-center {
  flex: 1;
  text-align: center;
  direction: rtl;
  min-width: 0;
}

.psc-header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.psc-header-sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 13px;
  opacity: 0.9;
}

.psc-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--psc-online);
  box-shadow: 0 0 0 2px rgba(77, 205, 94, 0.25);
}

.psc-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.psc-chat-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.psc-chat-shell[hidden] {
  display: none !important;
}

.psc-auth {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.psc-auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.psc-auth-hint {
  margin: 0 0 8px;
  color: var(--psc-muted);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
}

.psc-form-grid {
  display: grid;
  gap: 10px;
}

.psc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.psc-field-label {
  font-size: 13px;
  color: #5d7083;
  padding-inline: 4px;
}

.psc-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d9e2e9;
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  color: var(--psc-text);
  outline: none;
}

.psc-input:focus {
  border-color: var(--psc-accent);
  box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.18);
}

.psc-input--otp {
  letter-spacing: 0.35em;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}

.psc-error {
  margin: 0;
  color: var(--psc-danger);
  font-size: 13px;
  text-align: center;
}

.psc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--psc-accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.psc-btn:hover:not(:disabled) {
  background: var(--psc-accent-dark);
}

.psc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.psc-link {
  border: 0;
  background: transparent;
  color: var(--psc-accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
  text-align: center;
}

.psc-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: psc-spin 0.7s linear infinite;
}

.psc-spinner--accent {
  border-color: rgba(51, 144, 236, 0.25);
  border-top-color: var(--psc-accent);
  margin: 28px auto 0;
}

@keyframes psc-spin {
  to {
    transform: rotate(360deg);
  }
}

.psc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
  direction: ltr; /* keep sent=right / received=left regardless of page RTL */
}

.psc-empty {
  margin: auto;
  padding: 32px 20px;
  color: var(--psc-muted);
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
  direction: rtl;
}

.psc-bubble {
  max-width: 82%;
  padding: 8px 12px 6px;
  border-radius: 14px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
  word-break: break-word;
  direction: rtl;
}

.psc-bubble--in {
  align-self: flex-start; /* left = received */
  background: var(--psc-in);
  border-bottom-left-radius: 4px;
}

.psc-bubble--out {
  align-self: flex-end; /* right = sent */
  background: var(--psc-out);
  border-bottom-right-radius: 4px;
}

.psc-bubble-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  text-align: right;
}

.psc-bubble-time {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--psc-muted);
  text-align: left;
  direction: ltr;
}

.psc-bubble--out .psc-bubble-time {
  text-align: right;
}

.psc-attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(51, 144, 236, 0.1);
  color: var(--psc-accent);
  font-size: 13px;
  text-decoration: none;
  max-width: 100%;
}

.psc-attach-block {
  margin-top: 6px;
}

.psc-attach-actions {
  margin-top: 4px;
}

.psc-attach-download {
  border: 0;
  background: rgba(51, 144, 236, 0.12);
  color: #1f6fb8;
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.psc-attach img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  margin-top: 6px;
  object-fit: cover;
}

.psc-attach-img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  margin-top: 6px;
  object-fit: cover;
}

.psc-attach-audio {
  display: block;
  width: min(250px, 100%);
  margin-top: 6px;
}

.psc-typing {
  min-height: 24px;
  padding: 4px 16px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--psc-muted);
  font-size: 13px;
}

.psc-typing[hidden] {
  display: none !important;
}

.psc-typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--psc-muted);
  animation: psc-bounce 1.2s infinite;
}

.psc-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.psc-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes psc-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-4px);
  }
}

.psc-closed {
  padding: 10px 14px;
  background: var(--psc-composer);
  color: var(--psc-muted);
  font-size: 13px;
  text-align: center;
}

.psc-composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px;
  background: var(--psc-composer);
  border-top: 1px solid #d9e2e9;
  direction: ltr; /* attach left, send right — icon points correctly */
}

.psc-composer-icon,
.psc-send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 0;
}

.psc-composer-icon {
  background: transparent;
  color: var(--psc-muted);
}

.psc-attach-btn {
  width: auto;
  min-width: 40px;
  border-radius: 20px;
  padding: 0 10px;
  gap: 6px;
  color: #4f6478;
}

.psc-attach-label {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-block;
}

.psc-voice-btn[data-recording="1"] {
  color: #e53935;
}

.psc-composer-icon svg,
.psc-send svg {
  width: 22px;
  height: 22px;
  display: block;
}

.psc-composer-icon svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.psc-send {
  background: var(--psc-accent);
  color: #fff;
}

.psc-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.psc-send svg {
  fill: currentColor;
  /* plane naturally points right toward send direction */
  transform: none;
}

.psc-composer-input {
  flex: 1;
  min-height: 40px;
  max-height: 100px;
  resize: none;
  border: 0;
  border-radius: 20px;
  background: #fff;
  padding: 10px 16px;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  outline: none;
  direction: rtl;
  text-align: right;
}

.psc-composer-input:focus {
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.25);
}

.psc-hidden-file {
  display: none;
}

body.psc-open {
  overflow: hidden;
}

@media (max-width: 559px) {
  .panaah-tests-page .psc-fab {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .psc-fab-box {
    left: 82px;
    right: 14px;
    min-width: 0;
    max-width: none;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .psc-attach-btn {
    padding: 0 8px;
    gap: 4px;
  }
}
