/*
 * Customer support call. Uses the PayHero tokens from desk.css.
 * The in-call stage stays navy in both themes, like the login hero.
 */

body.customer,
body.customer *,
body.customer *::before,
body.customer *::after {
  box-sizing: border-box;
}

body.customer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

body.customer.overflow-hidden {
  overflow: hidden;
}

body.customer .hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.customer-wrap {
  width: min(480px, 100%);
  margin: auto;
  padding: 32px 16px;
}

.customer-card {
  overflow: clip;
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.customer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--divider);
}

.customer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.customer-kicker {
  margin: 0;
  color: var(--link);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.customer-title {
  margin: 0;
  color: var(--ink-strong);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.customer-body {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.customer-status,
.customer-presence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.customer-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.customer-status {
  flex-shrink: 0;
}

.customer-presence {
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 600;
}

.customer-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--faint);
}

.customer-status[data-status="connecting"],
.customer-status[data-status="closed"],
.customer-presence[data-tone="wait"],
.customer-presence[data-tone="closed"],
.customer-presence[data-tone="queue"] {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.customer-status[data-status="ringing"],
.customer-status[data-status="connected"],
.customer-presence[data-tone="live"] {
  background: var(--success-bg);
  color: var(--success-text);
}

.customer-status[data-status="ended"],
.customer-presence[data-tone="ended"] {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.customer-status[data-status="connecting"] .customer-dot,
.customer-status[data-status="closed"] .customer-dot,
.customer-presence[data-tone="wait"] .customer-dot,
.customer-presence[data-tone="closed"] .customer-dot,
.customer-presence[data-tone="queue"] .customer-dot {
  background: var(--warning-text);
}

.customer-status[data-status="ringing"] .customer-dot,
.customer-status[data-status="connected"] .customer-dot,
.customer-presence[data-tone="live"] .customer-dot {
  background: var(--green);
}

.customer-status[data-status="ended"] .customer-dot,
.customer-presence[data-tone="ended"] .customer-dot {
  background: var(--danger-text);
}

.customer-status[data-status="ringing"] .customer-dot,
.customer-presence[data-pulse="1"] .customer-dot {
  animation: customer-pulse 1.3s ease-out infinite;
}

@keyframes customer-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

.customer-kicker-label {
  margin: 0;
  color: var(--link);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-panel h2,
.customer-copy h2 {
  margin: 4px 0 0;
  color: var(--ink-strong);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.customer-copy p,
.customer-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.customer-panel .customer-actions,
.customer-panel > .customer-field,
.customer-panel > .customer-btn {
  margin-top: 14px;
}

#rating-status {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
}

#recaptcha-slot {
  width: 304px;
  max-width: 100%;
  line-height: 0;
}

#recaptcha-slot iframe {
  display: block;
  max-width: 100%;
}

.customer-audio-el {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.customer-panel {
  padding: 16px;
  border-radius: 18px;
  background: var(--inset);
  border: 1px solid var(--line);
}

.customer-panel.is-warning {
  background: var(--warning-bg);
  border-color: transparent;
}

.customer-panel.is-warning .customer-kicker-label,
.customer-panel.is-warning h2,
.customer-panel.is-warning strong {
  color: var(--warning-text);
}

.customer-panel.is-warning p {
  color: var(--text-2);
}

.customer-alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--danger-line);
  border-radius: 16px;
  background: var(--danger-bg);
  color: var(--danger-strong);
  font-size: 13.5px;
  font-weight: 600;
}

.customer-alert p {
  margin: 0;
}

.customer-alert button {
  border: 0;
  background: transparent;
  color: var(--danger-text);
  font: inherit;
  cursor: pointer;
}

.customer-steps {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.customer-steps-track {
  display: flex;
  flex: 1;
  gap: 6px;
}

.customer-steps-track i {
  height: 4px;
  flex: 1;
  border-radius: 999px;
  background: var(--track);
}

.customer-steps-track i[data-state="on"] {
  background: var(--green);
}

.customer-steps p {
  margin: 0;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-field {
  display: block;
}

.customer-field span,
.customer-choices legend {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
}

.customer-field input,
.customer-field textarea,
.customer-stage input {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: 14px;
  background: var(--inset);
  color: var(--ink);
  font: 500 15px/1.4 var(--font);
  padding: 12px 14px;
}

.customer-field textarea {
  resize: vertical;
}

.customer-field input::placeholder,
.customer-field textarea::placeholder {
  color: var(--placeholder);
}

.customer-field input:focus,
.customer-field textarea:focus,
.customer-stage input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: var(--ring-focus);
}

.customer-choices {
  border: 0;
  margin: 0;
  padding: 0;
}

.customer-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.customer-choice {
  display: block;
  padding: 12px;
  border: 1px solid var(--input-line);
  border-radius: 14px;
  background: var(--inset);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.customer-choice:has(:checked) {
  border-color: var(--green);
  background: var(--tint-green-bg);
  color: var(--ink);
  font-weight: 800;
}

.customer-choice:has(:focus-visible) {
  box-shadow: var(--ring-focus);
}

.customer-stack {
  display: grid;
  gap: 16px;
}

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

.customer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: 700 14px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.customer-btn svg {
  width: 18px;
  height: 18px;
}

.customer-btn.is-block {
  width: 100%;
}

.customer-btn.is-grow {
  flex: 1;
}

.customer-btn.is-primary {
  border-color: transparent;
  background: var(--green);
  color: var(--navy);
  box-shadow: 0 12px 24px rgba(248, 168, 0, 0.28);
}

.customer-btn.is-primary:hover {
  background: var(--green-dark);
}

.customer-btn.is-danger {
  border-color: transparent;
  background: #e11d48;
  color: #fff;
}

.customer-btn.is-danger:hover {
  background: #be123c;
}

.customer-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
}

.customer-recap,
.customer-summary,
.customer-audio {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--inset);
}

.customer-recap p,
.customer-summary p {
  margin: 0;
}

.customer-recap [data-recap-name],
.customer-summary-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.customer-muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.customer-summary-kicker {
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-audio-head,
.customer-audio-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-audio h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.customer-pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.customer-pill.is-live {
  background: var(--success-bg);
  color: var(--success-text);
}

.customer-pill.is-speaking {
  background: var(--info-bg);
  color: var(--info-text);
}

.customer-meter {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
  margin-top: 12px;
}

.customer-meter i {
  width: 6px;
  height: 100%;
  border-radius: 999px;
  background: var(--meter);
  transform-origin: bottom;
}

.customer-meter i.is-hot {
  background: var(--green);
}

#ticket-text {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.customer-stars {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.rating-star {
  width: 44px;
  height: 44px;
  border: 1px solid var(--input-line);
  border-radius: 14px;
  background: var(--card);
  color: var(--faint);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.rating-star.is-on,
.rating-star:hover,
.rating-star:focus-visible {
  border-color: transparent;
  background: var(--warning-bg);
  color: var(--star);
}

.customer-rating.is-open {
  animation: customer-rise 0.4s ease;
}

@keyframes customer-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.customer-foot {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.customer-foot a {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
}

.customer-foot a:hover {
  text-decoration: underline;
}

.customer-missing {
  margin: 0;
  color: var(--danger-text);
  font-size: 13px;
  font-weight: 600;
}

/* In-call stage: navy in both themes. */
.customer-stage {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  color: #fff;
  background: var(--navy);
}

.customer-stage-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 0%, rgba(0, 170, 133, 0.28), transparent 36%),
    radial-gradient(circle at 0% 100%, rgba(29, 159, 220, 0.18), transparent 32%),
    var(--navy);
}

.customer-stage-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

.customer-stage-top,
.customer-stage-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.customer-stage-hero {
  flex: 1;
  justify-content: center;
  min-height: 0;
  padding: 24px 0;
}

.customer-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(0, 170, 133, 0.4);
  border-radius: 999px;
  background: rgba(0, 170, 133, 0.18);
  color: #7ddec8;
}

.customer-live-badge[data-state="connecting"] {
  border-color: rgba(255, 176, 32, 0.45);
  background: rgba(255, 176, 32, 0.16);
  color: #ffb020;
}

.customer-live-badge .customer-dot {
  background: currentColor;
}

.customer-live-badge span:last-child {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.customer-clock {
  margin: 10px 0 0;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.customer-reconnecting {
  margin: 4px 0 0;
  color: #ffb020;
  font-size: 13px;
  font-weight: 700;
}

.customer-avatar {
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  border: 2.5px solid rgba(0, 170, 133, 0.6);
  border-radius: 50%;
  background: #1e352d;
  color: #fff;
  font-size: 38px;
  font-weight: 800;
  box-shadow: 0 0 20px rgba(0, 170, 133, 0.25);
}

.customer-avatar.is-speaking {
  box-shadow: 0 0 0 6px rgba(0, 170, 133, 0.35), 0 0 24px rgba(0, 170, 133, 0.4);
}

.customer-stage h2 {
  margin: 18px 0 0;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
}

.customer-type {
  margin: 8px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 700;
}

.customer-type:empty {
  display: none;
}

.customer-reason {
  display: flex;
  gap: 10px;
  width: min(100%, 28rem);
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.customer-reason svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: #7ddec8;
}

.customer-reason p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.customer-live-error {
  width: min(100%, 28rem);
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 138, 138, 0.7);
  border-radius: 12px;
  background: rgba(255, 75, 75, 0.12);
  color: #ffb4b4;
  font-size: 13px;
  text-align: center;
}

.customer-pad {
  width: 100%;
  padding: 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.05);
}

.customer-pad-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-evenly;
}

.customer-pad-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.customer-pad-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.customer-pad-icon svg {
  width: 28px;
  height: 28px;
}

.customer-pad-icon.is-on[data-tone="green"] {
  border-color: var(--green);
  background: var(--green);
  color: var(--navy);
}

.customer-pad-icon.is-on[data-tone="danger"] {
  border-color: #ff4b4b;
  background: #ff4b4b;
}

.customer-pad-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
}

.customer-pad-label.is-on[data-tone="green"] {
  color: #7ddec8;
  font-weight: 800;
}

.customer-pad-label.is-on[data-tone="danger"] {
  color: #ffb4b4;
  font-weight: 800;
}

.customer-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff4b4b;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.customer-hangup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 28px auto 0;
  border: 0;
  border-radius: 50%;
  background: #ff4b4b;
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 75, 75, 0.4);
  cursor: pointer;
}

.customer-hangup svg {
  width: 32px;
  height: 32px;
}

.customer-dialog {
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
}

.customer-dialog.flex,
.customer-dialog:not(.hidden) {
  display: flex;
}

.customer-dialog-card {
  width: min(100%, 22rem);
  padding: 20px;
  border-radius: 20px;
  background: #1c2536;
  color: #f4f7fb;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.customer-dialog-card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.customer-dialog-card p {
  margin: 8px 0 0;
  color: #a9b6c9;
  font-size: 14px;
}

.customer-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.customer-dialog-actions button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: transparent;
  color: #d7e0ec;
  font: 700 14px/1 var(--font);
  cursor: pointer;
}

.customer-dialog-actions .is-danger {
  background: #ff4b4b;
  color: #fff;
}

.customer-chat {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: #0e1420;
}

.customer-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}

.customer-chat-head h2 {
  margin: 0;
  color: #fff;
  font-size: 16px;
}

.customer-chat-head p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.customer-chat-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

#chat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px;
}

#chat-log [data-chat-empty] {
  margin: auto;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  text-align: center;
}

#chat-log [data-chat-msg] {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

#chat-log .self-end {
  align-self: flex-end;
  align-items: flex-end;
}

#chat-log .self-start {
  align-self: flex-start;
  align-items: flex-start;
}

#chat-log [data-chat-msg] p {
  margin: 0;
}

#chat-log [data-chat-msg] p:first-child {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
}

#chat-log .self-end p:first-child {
  color: #f8a800;
}

#chat-log .self-start p:first-child {
  color: rgba(255, 255, 255, 0.5);
}

#chat-log [data-chat-msg] p:last-child {
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
}

#chat-log .self-end p:last-child {
  background: var(--green);
  color: var(--navy);
}

#chat-log .self-start p:last-child {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.customer-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 20px 24px;
}

.customer-chat-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 500 16px/1.3 var(--font);
  padding: 12px 14px;
}

.customer-chat-form input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.customer-chat-form input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--green);
}

.customer-chat-form button {
  border: 0;
  border-radius: 16px;
  background: var(--green);
  color: var(--navy);
  font: 700 14px/1 var(--font);
  padding: 0 16px;
  cursor: pointer;
}

.customer-chat-form button:disabled {
  opacity: 0.6;
}

.customer-line-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .customer-rating.is-open,
  .customer-status[data-status="ringing"] .customer-dot,
  .customer-presence[data-pulse="1"] .customer-dot {
    animation: none;
  }
}
