/* Amanah Pay Chat Widget — luxury dark gold theme */
:root {
  --ap-gold:    #C9A84C;
  --ap-gold2:   #A07830;
  --ap-emerald: #2D7A4F;
  --ap-bg:      #0E0E0E;
  --ap-panel:   #141414;
  --ap-surface: #1A1A1A;
  --ap-border:  rgba(201, 168, 76, 0.18);
  --ap-muted:   #6B7280;
  --ap-shadow:  0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(201, 168, 76, 0.12);
  --ap-radius:  18px;
  --ap-font:    "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ── FAB ─────────────────────────────────────────────────────────────────── */
.ap-fab-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 2147483000;
  display: inline-block;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(201, 168, 76, 0.3);
  touch-action: manipulation;
}
.ap-fab {
  position: relative;
  z-index: 2147483000;
  font-family: var(--ap-font);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  cursor: pointer;
  padding: 11px 18px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #1A1A1A 0%, #111 100%);
  box-shadow: var(--ap-shadow);
  user-select: none;
  -webkit-tap-highlight-color: rgba(201, 168, 76, 0.3);
  touch-action: manipulation;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ap-fab:hover {
  border-color: rgba(201, 168, 76, 0.6);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(201,168,76,0.3);
}
.ap-fab img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  background: #111;
}
.ap-fab span {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, #C9A84C, #E8C97A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
.ap-panel {
  position: fixed;
  right: 20px;
  bottom: 76px;
  width: 370px;
  max-width: calc(100vw - 40px);
  height: 540px;
  max-height: calc(100vh - 120px);
  z-index: 2147482999;
  font-family: var(--ap-font);
  background: var(--ap-panel);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
  overflow: hidden;
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.ap-panel.ap-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.ap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(201,168,76,0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--ap-border);
}
.ap-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ap-brand img {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: contain;
  background: #111;
  border: 1px solid var(--ap-border);
}
.ap-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.ap-title b {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(90deg, #C9A84C, #E8C97A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ap-title small {
  color: var(--ap-muted);
  font-size: 11px;
  margin-top: 2px;
}
.ap-status {
  font-size: 10px;
  color: var(--ap-muted);
  margin-top: 2px;
}
.ap-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ap-muted);
  font-size: 17px;
  transition: background 0.15s, color 0.15s;
}
.ap-close:hover {
  background: rgba(201,168,76,0.08);
  color: #C9A84C;
}

/* ── Body / messages ─────────────────────────────────────────────────────── */
.ap-body {
  padding: 14px;
  height: 390px;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(600px 200px at 50% -20px, rgba(201,168,76,0.07), transparent 60%),
    radial-gradient(400px 160px at 80% 100px, rgba(45,122,79,0.05), transparent 60%),
    var(--ap-panel);
  scrollbar-width: thin;
  scrollbar-color: rgba(201,168,76,0.2) transparent;
}
.ap-body::-webkit-scrollbar { width: 4px; }
.ap-body::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 4px; }

.ap-row {
  display: flex;
  gap: 10px;
  margin: 10px 0;
  align-items: flex-start;
}
.ap-row.ap-row-user {
  justify-content: flex-end;
}
.ap-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.05));
  border: 1px solid var(--ap-border);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.ap-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.ap-bubble {
  max-width: 260px;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid rgba(201,168,76,0.12);
  background: var(--ap-surface);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  font-size: 13px;
  line-height: 1.45;
  color: #E5E5E5;
  word-break: break-word;
}
.ap-bubble.ap-user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(201,168,76,0.06));
  border-color: rgba(201,168,76,0.25);
  color: #F0E8D0;
}
.ap-meta {
  font-size: 10px;
  color: var(--ap-muted);
  margin-top: 6px;
}
.ap-links {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ap-links a {
  color: #C9A84C;
  text-decoration: none;
  font-size: 11px;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.ap-links a:hover { opacity: 1; text-decoration: underline; }

/* ── Footer / input ──────────────────────────────────────────────────────── */
.ap-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--ap-border);
  background: var(--ap-panel);
}
.ap-inputwrap {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(201,168,76,0.2);
  background: var(--ap-surface);
  transition: border-color 0.2s;
}
.ap-inputwrap:focus-within {
  border-color: rgba(201,168,76,0.5);
}
.ap-input {
  width: 100%;
  border: 0;
  outline: none;
  font-size: 13px;
  background: transparent;
  font-family: var(--ap-font);
  color: #E5E5E5;
}
.ap-input::placeholder { color: var(--ap-muted); }
.ap-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 0;
  cursor: pointer;
  border-radius: 11px;
  background: linear-gradient(135deg, #C9A84C, #A07830);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(201,168,76,0.3);
  transition: opacity 0.15s, transform 0.1s;
}
.ap-send:hover { transform: scale(1.05); }
.ap-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.ap-send svg { width: 16px; height: 16px; fill: #0E0E0E; }

.ap-footnote {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ap-muted);
  font-size: 11px;
}
.ap-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #2D7A4F;
  box-shadow: 0 0 0 3px rgba(45,122,79,0.2);
  flex-shrink: 0;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 460px) {
  .ap-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 72px;
  }
  .ap-fab-wrap { right: 12px; }
}

/* Hide during cookie consent banner */
body.cookie-consent-visible .ap-fab-wrap,
body.cookie-consent-visible .ap-panel {
  display: none !important;
}
