/* Prime WhatsApp — floating widget styles.
   Lives bottom-left by default; bottom-right if `position: right` is set.
   Brand colour is WhatsApp green (#25D366) for instant recognition. */

:root {
  --pwa-green:   #25D366;
  --pwa-green-h: #1ebe57;
  --pwa-dark:    #128C7E;
  --pwa-bg:      var(--surface2, #fffefb);
  --pwa-text:    var(--text, #101820);
  --pwa-muted:   var(--muted, #5a6270);
  --pwa-border:  var(--border, #c5bdb0);
  --pwa-radius:  1.25rem;
}

/* Launcher */
.pwa-launcher {
  position: fixed;
  bottom: 1.5rem;
  z-index: 9998;          /* one below Prime Chat (which uses 9999) */
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--pwa-green);
  color: #fff;
  border: 0;
  border-radius: 9999px;
  padding: .85rem 1.25rem .85rem 1rem;
  font-family: var(--body, system-ui, sans-serif);
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform .15s ease, background .15s ease;
}
.pwa-launcher.pwa-left  { left: 1.5rem; }
.pwa-launcher.pwa-right { right: 1.5rem; }
.pwa-launcher:hover { background: var(--pwa-green-h); transform: translateY(-2px); }
.pwa-launcher svg { width: 22px; height: 22px; }
.pwa-launcher[aria-expanded="true"] { display: none; }

/* Status dot */
.pwa-status {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #999;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}
.pwa-status.is-online { background: #50ff7a; animation: pwa-pulse 2s infinite; }
@keyframes pwa-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
  50%      { box-shadow: 0 0 0 4px rgba(80, 255, 122, .35); }
}

/* Panel */
.pwa-panel {
  position: fixed;
  bottom: 1.5rem;
  z-index: 9998;
  width: min(380px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  background: var(--pwa-bg);
  color: var(--pwa-text);
  border: 1px solid var(--pwa-border);
  border-radius: var(--pwa-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--body, system-ui, sans-serif);
}
.pwa-panel.pwa-left  { left: 1.5rem; }
.pwa-panel.pwa-right { right: 1.5rem; }
.pwa-panel.is-open   { display: flex; }

.pwa-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--pwa-border);
  display: flex;
  align-items: center;
  gap: .75rem;
  background: linear-gradient(135deg, var(--pwa-green) 0%, var(--pwa-dark) 100%);
  color: #fff;
}
.pwa-header-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .15);
  border-radius: 50%;
  flex-shrink: 0;
}
.pwa-header-icon svg { width: 20px; height: 20px; }
.pwa-header h3 {
  margin: 0;
  font-family: var(--display, Georgia, serif);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  flex: 1;
}
.pwa-header p {
  margin: .15rem 0 0;
  font-size: .68rem;
  color: rgba(255, 255, 255, .8);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.pwa-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: 0;
  display: grid; place-items: center;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}
.pwa-close:hover { background: rgba(255, 255, 255, .25); }

.pwa-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}

.pwa-greeting {
  display: flex;
  gap: .65rem;
  padding: .75rem .9rem;
  background: color-mix(in oklab, var(--pwa-green) 6%, var(--pwa-bg));
  border: 1px solid color-mix(in oklab, var(--pwa-green) 18%, transparent);
  border-radius: .8rem;
  border-bottom-left-radius: .25rem;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--pwa-text);
  margin-bottom: 1rem;
}
.pwa-greeting-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--pwa-muted);
  margin-bottom: .25rem;
}
.pwa-greeting-status .pwa-status { box-shadow: none; }

.pwa-field { display: block; margin-bottom: .85rem; }
.pwa-field label {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--pwa-muted);
  margin-bottom: .35rem;
  font-weight: 500;
}
.pwa-field input,
.pwa-field select,
.pwa-field textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--pwa-border);
  border-radius: .65rem;
  background: var(--pwa-bg);
  color: var(--pwa-text);
  font: inherit;
  font-size: .875rem;
  min-height: 42px;
}
.pwa-field textarea {
  min-height: 90px;
  resize: vertical;
}
.pwa-field input:focus,
.pwa-field select:focus,
.pwa-field textarea:focus {
  outline: none;
  border-color: var(--pwa-green);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--pwa-green) 18%, transparent);
}

.pwa-consent {
  font-size: .72rem;
  color: var(--pwa-muted);
  line-height: 1.5;
  margin: .25rem 0 .85rem;
}

.pwa-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .85rem 1rem;
  background: var(--pwa-green);
  color: #fff;
  border: 0;
  border-radius: .75rem;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s ease;
}
.pwa-submit:hover { background: var(--pwa-green-h); }
.pwa-submit:disabled { background: #999; cursor: not-allowed; }
.pwa-submit svg { width: 18px; height: 18px; }

/* No-WhatsApp fallback */
.pwa-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.pwa-fallback-link {
  display: block;
  width: 100%;
  margin-top: .6rem;
  padding: .35rem;
  background: none;
  border: 0;
  color: var(--pwa-muted);
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
}
.pwa-fallback-link:hover { color: var(--pwa-text); }
.pwa-fb-back { margin-top: .35rem; }
.pwa-fb-error {
  margin: 0 0 .5rem;
  color: #b81e29;
  font-size: .82rem;
}
.pwa-fb-success {
  padding: .85rem 1rem;
  background: #e7f7ee;
  border: 1px solid var(--pwa-green);
  border-radius: .75rem;
  color: var(--pwa-dark);
  font-size: .9rem;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .pwa-panel { left: .5rem !important; right: .5rem !important; bottom: .5rem; width: auto; }
  .pwa-launcher.pwa-left  { left:  .75rem; }
  .pwa-launcher.pwa-right { right: .75rem; }
}
