/* GINA GPSINA Support Widget — branded for gpsina.com */
:root {
  --gina-navy: #0b3c5d;
  --gina-navy-dark: #082c45;
  --gina-secondary: #2f7fa3;
  --gina-cyan: #45b8e7;
  --gina-accent: #f28a2e;
  --gina-accent-hover: #df7820;
  --gina-blue: #0b3c5d;
  --gina-blue-dark: #082c45;
  --gina-bg: #f5f8fc;
  --gina-panel: #ffffff;
  --gina-text: #1f2a37;
  --gina-muted: #5b6b81;
  --gina-border: #dbe5f1;
  --gina-bot-bubble: #eef4fb;
  --gina-user-bubble: #0b3c5d;
  --gina-shadow: 0 12px 40px rgba(15, 35, 64, 0.18);
  --gina-radius: 16px;
  --gina-z: 2147483000;
  --gina-font: Inter, Poppins, "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

#gina-chat-root,
#gina-chat-root * {
  box-sizing: border-box;
}

#gina-chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--gina-z);
  font-family: var(--gina-font);
  color: var(--gina-text);
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  /* KK 2026-10-07h (tap bug): the root box must never take taps. Only the launcher, the bubble
     and the OPEN panel receive pointer events. */
  pointer-events: none;
}

#gina-chat-root .gina-launcher-wrap > * {
  pointer-events: auto;
}

/* Closed panel: out of the layout flow (so the root shrinks to the launcher), invisible and
   click-through. */
#gina-chat-root .gina-panel:not(.gina-open) {
  position: absolute;
  right: 0;
  bottom: 0;
  visibility: hidden;
  pointer-events: none;
}

#gina-chat-root .gina-panel.gina-open {
  pointer-events: auto;
}

/* ── Launcher FAB (pill) ── */
.gina-launcher-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.gina-launcher {
  position: relative;
  height: 56px;
  min-width: 56px;
  padding: 0 18px 0 8px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--gina-navy), var(--gina-navy-dark));
  color: #fff;
  box-shadow: var(--gina-shadow), 0 0 0 0 rgba(69, 184, 231, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: gina-launcher-in 0.45s ease-out both, gina-pulse 2.8s ease-in-out 0.8s infinite;
}

.gina-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 36px rgba(15, 35, 64, 0.28);
  background: linear-gradient(145deg, var(--gina-secondary), var(--gina-navy));
}

.gina-launcher:active {
  transform: translateY(0) scale(0.98);
}

.gina-launcher:focus-visible {
  outline: 3px solid rgba(69, 184, 231, 0.65);
  outline-offset: 3px;
}

.gina-launcher[aria-expanded="true"] {
  animation: none;
}

.gina-launcher-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.gina-launcher-avatar img,
.gina-launcher-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 18%;
  display: block;
}

.gina-launcher-label {
  white-space: nowrap;
  padding-right: 4px;
}

.gina-launcher-status {
  position: absolute;
  top: 6px;
  left: 36px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(11, 60, 93, 0.15);
}

/* Greeting teaser bubble */
.gina-teaser {
  max-width: min(280px, calc(100vw - 48px));
  background: #fff;
  color: var(--gina-text);
  border: 1px solid var(--gina-border);
  border-radius: 14px;
  padding: 12px 36px 12px 14px;
  box-shadow: var(--gina-shadow);
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  animation: gina-teaser-in 0.35s ease-out both;
}

.gina-teaser::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid var(--gina-border);
  border-bottom: 1px solid var(--gina-border);
  transform: rotate(45deg);
}

.gina-teaser-title {
  font-weight: 700;
  color: var(--gina-navy);
  margin-bottom: 2px;
  font-size: 13px;
}

.gina-teaser-dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--gina-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gina-teaser-dismiss:hover {
  background: var(--gina-bg);
  color: var(--gina-text);
}

.gina-teaser-dismiss:focus-visible {
  outline: 2px solid var(--gina-cyan);
  outline-offset: 1px;
}

.gina-hidden {
  display: none !important;
}

@keyframes gina-launcher-in {
  from { opacity: 0; transform: translateY(12px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gina-pulse {
  0%, 100% { box-shadow: var(--gina-shadow), 0 0 0 0 rgba(69, 184, 231, 0.4); }
  50% { box-shadow: var(--gina-shadow), 0 0 0 10px rgba(69, 184, 231, 0); }
}

@keyframes gina-teaser-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .gina-launcher {
    animation: none;
  }
  .gina-teaser {
    animation: none;
  }
  .gina-panel {
    transition: none !important;
  }
  .gina-typing span {
    animation: none !important;
  }
}

/* ── Panel ── */
.gina-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 100px));
  background: var(--gina-panel);
  border-radius: var(--gina-radius);
  box-shadow: var(--gina-shadow);
  border: 1px solid var(--gina-border);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.gina-panel.gina-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.gina-header {
  background: linear-gradient(135deg, var(--gina-navy), var(--gina-secondary));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gina-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gina-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.gina-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 18%;
  display: block;
}

.gina-header-title {
  font-weight: 700;
  font-size: 15px;
}

.gina-header-sub {
  font-size: 12px;
  opacity: 0.92;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gina-header-sub::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
  flex-shrink: 0;
}

.gina-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.gina-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.gina-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gina-messages {
  flex: 1;
  min-height: 0; /* allow flex child to shrink so overflow-y scrolls */
  overflow-y: auto;
  padding: 14px;
  background: var(--gina-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.gina-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.gina-msg-bot {
  align-self: flex-start;
  background: var(--gina-bot-bubble);
  color: var(--gina-text);
  border-bottom-left-radius: 4px;
}

.gina-msg-user {
  align-self: flex-end;
  background: var(--gina-user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.gina-typing {
  align-self: flex-start;
  display: none;
  gap: 4px;
  padding: 10px 14px;
  background: var(--gina-bot-bubble);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.gina-typing.gina-show {
  display: inline-flex;
}

.gina-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gina-muted);
  animation: gina-bounce 1.2s infinite ease-in-out;
}

.gina-typing span:nth-child(2) { animation-delay: 0.15s; }
.gina-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes gina-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.gina-composer {
  display: flex;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: none;
  background: #fff;
  align-items: flex-end;
}

.gina-input {
  flex: 1;
  border: 1px solid var(--gina-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: var(--gina-font);
  resize: none;
  min-height: 42px;
  max-height: 100px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
  color: var(--gina-text);
  background: #fff;
  caret-color: var(--gina-navy);
}

.gina-input:focus {
  border-color: var(--gina-secondary);
  box-shadow: 0 0 0 3px rgba(47, 127, 163, 0.18);
}

.gina-send {
  border: none;
  border-radius: 12px;
  background: var(--gina-accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 0;
  cursor: pointer;
  width: 42px;
  height: 42px;
  min-width: 42px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(242, 138, 46, 0.28);
}

.gina-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.gina-send:hover:not(:disabled) {
  background: var(--gina-accent-hover);
}

.gina-send:focus-visible {
  outline: 3px solid rgba(242, 138, 46, 0.45);
  outline-offset: 2px;
}

.gina-footer-note {
  font-size: 11px;
  color: var(--gina-muted);
  text-align: center;
  padding: 0 12px 8px;
  background: #fff;
}

@media (max-width: 480px) {
  #gina-chat-root {
    right: 12px;
    bottom: 12px;
  }
  .gina-panel {
    width: calc(100vw - 24px);
    height: min(70vh, calc(100vh - 88px));
  }
  .gina-launcher-label {
    display: none;
  }
  .gina-launcher {
    width: 56px;
    padding: 0;
    justify-content: center;
  }
  .gina-launcher-status {
    left: 38px;
    top: 4px;
  }
}

.gina-msg-wrap {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  gap: 6px;
}

.gina-msg-wrap-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.gina-msg-wrap-user {
  align-self: flex-end;
  align-items: flex-end;
}

.gina-msg-wrap .gina-msg {
  max-width: 100%;
}

.gina-sticker {
  width: 140px;
  max-width: 160px;
  height: auto;
  border-radius: 12px;
  display: block;
  object-fit: contain;
}

.gina-msg-wrap-sticker {
  gap: 0;
}

.gina-msg-wrap-sticker .gina-sticker {
  margin-bottom: 2px;
}

.gina-input,
.gina-msg {
  font-family: var(--gina-font);
  unicode-bidi: plaintext;
  word-break: break-word;
}

/* ── Composer polish + voice ── */
.gina-composer-wrap {
  background: #fff;
  border-top: 1px solid var(--gina-border);
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.gina-lang-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 8px 12px 0;
  overflow: visible;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.gina-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--gina-border);
  border-radius: 999px;
  overflow: hidden;
  background: #f8fafc;
}

.gina-lang-btn {
  border: none;
  background: transparent;
  color: var(--gina-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--gina-font);
  padding: 4px 10px;
  cursor: pointer;
  line-height: 1.2;
  min-width: 36px;
}

.gina-lang-btn.gina-lang-active {
  background: var(--gina-navy);
  color: #fff;
}

.gina-lang-btn:focus-visible {
  outline: 2px solid var(--gina-cyan);
  outline-offset: 1px;
  z-index: 1;
}

.gina-input-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  border: 1px solid var(--gina-border);
  border-radius: 12px;
  background: #fff;
  padding: 0 4px 0 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gina-input-shell:focus-within {
  border-color: var(--gina-secondary);
  box-shadow: 0 0 0 3px rgba(47, 127, 163, 0.18);
}

.gina-input-shell .gina-input {
  flex: 1;
  min-width: 0;
  border: none;
  box-shadow: none !important;
  border-radius: 12px;
  padding: 10px 8px 10px 12px;
  min-height: 42px;
  max-height: 100px;
  resize: none;
  overflow-y: auto;
  line-height: 1.35;
}

.gina-input-shell .gina-input:focus {
  border: none;
  box-shadow: none !important;
}

.gina-mic {
  width: 36px;
  height: 36px;
  margin: 3px 3px 3px 0;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--gina-navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.gina-mic:hover {
  background: var(--gina-bg);
  color: var(--gina-secondary);
}

.gina-mic.gina-mic-unsupported {
  opacity: 0.55;
  color: var(--gina-muted);
}

.gina-mic.gina-mic-unsupported:hover {
  background: var(--gina-bg);
  color: var(--gina-muted);
}

.gina-mic:focus-visible {
  outline: 3px solid rgba(69, 184, 231, 0.55);
  outline-offset: 1px;
}

.gina-mic.gina-mic-listening {
  background: #fee2e2;
  color: #dc2626;
  animation: gina-mic-pulse 1.2s ease-in-out infinite;
}

.gina-input-listening .gina-input-shell,
.gina-input-shell:has(.gina-input.gina-input-listening) {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.gina-input.gina-input-listening {
  /* marker class used by JS */
}

@keyframes gina-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .gina-mic.gina-mic-listening { animation: none; }
}

.gina-voice-error {
  display: none;
  font-size: 11px;
  color: #b91c1c;
  padding: 0 12px 8px;
  line-height: 1.35;
}

.gina-voice-error.gina-show {
  display: block;
}

@media (max-width: 480px) {
  .gina-lang-btn {
    min-width: 32px;
    padding: 4px 8px;
    font-size: 10px;
  }
  .gina-send {
    width: 42px;
    height: 42px;
  }
}

.gina-input-shell.gina-shell-listening {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Pending voice recording (ready to Send) */
.gina-pending-voice {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.22);
  font-size: 13px;
  color: var(--gina-text, #0f172a);
}
.gina-pending-voice.gina-show { display: flex; }
.gina-pending-voice-label { flex: 1; min-width: 0; }
.gina-pending-edit {
  border: none;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  text-decoration: underline;
}
.gina-pending-edit:hover { color: #1d4ed8; }
.gina-pending-clear {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.gina-pending-clear:hover { color: #0f172a; }
.gina-msg-voice {
  font-style: italic;
  opacity: 0.95;
}

/* ── Soft welcome / lead sheet ── */
.gina-welcome-sheet {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(15, 35, 64, 0.45);
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  border-radius: inherit;
}
.gina-welcome-sheet.gina-show {
  display: flex;
}
.gina-welcome-card {
  width: 100%;
  max-height: 92%;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 12px 32px rgba(15, 35, 64, 0.22);
}
.gina-welcome-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gina-navy);
  margin-bottom: 4px;
}
.gina-welcome-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--gina-muted);
  line-height: 1.4;
}
.gina-welcome-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gina-text);
  margin-bottom: 8px;
}
.gina-welcome-label input {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--gina-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gina-text);
  background: #fff;
}
.gina-welcome-label input:focus {
  outline: 2px solid var(--gina-cyan);
  outline-offset: 1px;
  border-color: var(--gina-secondary);
}
.gina-welcome-privacy,
.gina-privacy-line {
  font-size: 11px;
  color: var(--gina-muted);
  line-height: 1.35;
  margin: 4px 0 8px;
}
.gina-footer-note .gina-privacy-line {
  margin: 0 0 4px;
}
.gina-privacy-link {
  color: inherit;
  text-decoration: underline;
}
.gina-privacy-link:hover,
.gina-privacy-link:focus-visible {
  color: var(--gina-secondary);
}
.gina-welcome-error {
  display: none;
  font-size: 12px;
  color: #b91c1c;
  margin-bottom: 8px;
}
.gina-welcome-error.gina-show {
  display: block;
}
.gina-welcome-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.gina-welcome-skip,
.gina-welcome-continue {
  flex: 1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.gina-welcome-skip {
  border: 1px solid var(--gina-border);
  background: #fff;
  color: var(--gina-muted);
}
.gina-welcome-skip:hover {
  background: #f8fafc;
}
.gina-welcome-continue {
  border: none;
  background: linear-gradient(145deg, var(--gina-navy), var(--gina-navy-dark));
  color: #fff;
}
.gina-welcome-continue:hover {
  background: linear-gradient(145deg, var(--gina-secondary), var(--gina-navy));
}

/* Soft nudge bar */
.gina-soft-nudge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  font-size: 12px;
  color: #92400e;
}
.gina-soft-nudge-text {
  flex: 1 1 140px;
  line-height: 1.35;
}
.gina-soft-nudge-add,
.gina-soft-nudge-dismiss {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 6px;
}
.gina-soft-nudge-add {
  color: var(--gina-navy);
  text-decoration: underline;
}
.gina-soft-nudge-dismiss {
  color: #92400e;
  opacity: 0.85;
}

/* KK 2026-10-07h: mobile "Need help?" bubble = small pill beside the launcher (no body text),
   so it does not cover page buttons; JS auto-hides it after a few seconds / on scroll. */
@media (max-width: 480px) {
  #gina-chat-root .gina-launcher-wrap {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  #gina-chat-root .gina-teaser {
    max-width: 150px;
    padding: 7px 28px 7px 12px;
    border-radius: 999px;
    font-size: 12px;
  }
  #gina-chat-root .gina-teaser-title {
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
  }
  #gina-chat-root .gina-teaser-text {
    display: none;
  }
  #gina-chat-root .gina-teaser::after {
    right: -6px;
    bottom: auto;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border-bottom: none;
    border-top: 1px solid var(--gina-border);
  }
  #gina-chat-root .gina-teaser-dismiss {
    top: 50%;
    right: 3px;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    font-size: 15px;
  }
}

