/* Rankerd WhatsApp chat interface */
:root {
  --rk-wa-green: #25d366;
  --rk-wa-green-dark: #128c7e;
  --rk-wa-text: #0f172a;
  --rk-wa-muted: #64748b;
  --rk-wa-border: rgba(15, 23, 42, 0.12);
  --rk-wa-panel: rgba(255, 255, 255, 0.96);
  --rk-wa-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.rk-wa-widget {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  font-family: inherit;
  color: var(--rk-wa-text);
}

.rk-wa-widget * {
  box-sizing: border-box;
}

.rk-wa-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rk-wa-green), var(--rk-wa-green-dark));
  color: #fff;
  box-shadow: 0 18px 45px rgba(18, 140, 126, 0.34);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.rk-wa-toggle:hover,
.rk-wa-toggle:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(18, 140, 126, 0.42);
  filter: saturate(1.05);
}

.rk-wa-toggle:focus-visible,
.rk-wa-close:focus-visible,
.rk-wa-send:focus-visible,
.rk-wa-chip:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.3);
  outline-offset: 3px;
}

.rk-wa-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
}

.rk-wa-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.rk-wa-badge {
  position: absolute;
  top: -5px;
  right: -3px;
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
}

.rk-wa-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(360px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--rk-wa-border);
  border-radius: 26px;
  background: var(--rk-wa-panel);
  box-shadow: var(--rk-wa-shadow);
  backdrop-filter: blur(18px);
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.rk-wa-widget.is-open .rk-wa-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.rk-wa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.18), rgba(18, 140, 126, 0.13));
  border-bottom: 1px solid rgba(18, 140, 126, 0.14);
}

.rk-wa-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.rk-wa-avatar {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--rk-wa-green), var(--rk-wa-green-dark));
  color: #fff;
  box-shadow: 0 12px 28px rgba(18, 140, 126, 0.25);
  flex: 0 0 auto;
}

.rk-wa-title {
  margin: 0;
  color: var(--rk-wa-text);
  font-size: 16px;
  line-height: 1.18;
  font-weight: 900;
}

.rk-wa-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--rk-wa-muted);
  font-size: 12px;
  font-weight: 700;
}

.rk-wa-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rk-wa-green);
  box-shadow: 0 0 0 5px rgba(37, 211, 102, 0.13);
}

.rk-wa-close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--rk-wa-text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.rk-wa-body {
  padding: 18px;
}

.rk-wa-message {
  position: relative;
  margin: 0 0 16px;
  padding: 14px 15px;
  border: 1px solid rgba(18, 140, 126, 0.12);
  border-radius: 18px 18px 18px 6px;
  background: rgba(240, 253, 244, 0.92);
  color: #12493f;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
}

.rk-wa-label {
  display: block;
  margin-bottom: 8px;
  color: var(--rk-wa-text);
  font-size: 13px;
  font-weight: 800;
}

.rk-wa-input {
  display: block;
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--rk-wa-border);
  border-radius: 18px;
  padding: 13px 14px;
  background: #fff;
  color: var(--rk-wa-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.rk-wa-input:focus {
  outline: 3px solid rgba(37, 211, 102, 0.18);
  border-color: rgba(37, 211, 102, 0.72);
}

.rk-wa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.rk-wa-chip {
  border: 1px solid rgba(18, 140, 126, 0.16);
  border-radius: 999px;
  background: rgba(240, 253, 244, 0.78);
  color: #0f766e;
  cursor: pointer;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.rk-wa-send {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--rk-wa-green), var(--rk-wa-green-dark));
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 14px 32px rgba(18, 140, 126, 0.26);
}

.rk-wa-send:hover {
  filter: saturate(1.05);
}

.rk-wa-note {
  margin: 10px 2px 0;
  color: var(--rk-wa-muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 520px) {
  .rk-wa-widget {
    right: 14px;
    bottom: 14px;
  }

  .rk-wa-panel {
    right: -2px;
    bottom: 72px;
    width: calc(100vw - 28px);
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    border-radius: 24px;
  }

  .rk-wa-toggle-label {
    display: none;
  }

  .rk-wa-toggle {
    width: 60px;
    height: 60px;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rk-wa-toggle,
  .rk-wa-panel {
    transition: none;
  }
}
