/* ==========================================================================
   GATEKEEPER — Agile Visa conversational concierge widget
   Theme-locked to /style.css (dark navy + teal accent)
   ========================================================================== */

.gk-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--accent-teal, #64ffda);
    color: var(--bg-navy, #0a192f);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 34px rgba(100, 255, 218, 0.35), 0 5px 15px rgba(0, 0, 0, 0.45);
    z-index: 9990;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
    font-family: 'Inter', sans-serif;
    overflow: visible;            /* let the waving 👋 extend beyond the circle */
    padding: 0;
    /* Constant breathing — always alive, never distracting */
    animation: gkBreathe 2.6s ease-in-out infinite;
}

/* Founder photo — circular crop, fills the launcher. Hidden if it 404s. */
.gk-launcher-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 25%;  /* favours face over background */
    display: block;
    border: 4px solid var(--accent-teal, #64ffda);
    box-shadow: inset 0 0 0 1px rgba(10, 25, 47, 0.4);
    background: var(--bg-light-navy, #112240);
}
.gk-launcher-photo.gk-photo-failed { display: none; }

/* When the photo is showing, hide the chat-bubble SVG (it's the fallback only) */
.gk-launcher.gk-launcher-photo-mode .gk-launcher-icon { display: none; }
/* When the photo failed, the SVG fallback shows and we restore the solid bg */
.gk-launcher:not(.gk-launcher-photo-mode) { background: var(--accent-teal, #64ffda); }

/* The waving hand emoji — sits at lower-right of the photo, hand pivoting at the wrist */
.gk-wave-emoji {
    position: absolute;
    bottom: -8px;
    right: -10px;
    font-size: 42px;
    line-height: 1;
    transform-origin: 65% 85%;   /* wrist pivot */
    animation: gkWaveHand 2.8s ease-in-out infinite;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
    pointer-events: none;
    z-index: 3;
    user-select: none;
}
@keyframes gkWaveHand {
    0%, 55%, 100% { transform: rotate(0deg); }
    8%  { transform: rotate(-28deg); }
    16% { transform: rotate(22deg); }
    24% { transform: rotate(-24deg); }
    32% { transform: rotate(18deg); }
    40% { transform: rotate(-12deg); }
    48% { transform: rotate(6deg); }
}
@keyframes gkBreathe {
    0%, 100% { transform: scale(1); box-shadow: 0 12px 30px rgba(100, 255, 218, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4); }
    50% { transform: scale(1.06); box-shadow: 0 16px 42px rgba(100, 255, 218, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4); }
}
.gk-launcher:hover { transform: translateY(-3px) scale(1.08); box-shadow: 0 18px 44px rgba(100, 255, 218, 0.6); animation-play-state: paused; }
.gk-launcher:focus-visible { outline: 3px solid var(--accent-gold, #ffd700); outline-offset: 3px; }
.gk-launcher svg, .gk-launcher .gk-launcher-icon { width: 46px; height: 46px; fill: currentColor; transition: transform 0.3s; }

/* Expanding ring — radar-style attention beacon (two staggered rings) */
.gk-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent-teal, #64ffda);
    opacity: 0;
    animation: gkPulseRing 2.4s ease-out infinite;
    pointer-events: none;
    z-index: 0;
}
.gk-pulse-ring-2 { animation-delay: 1.2s; }
@keyframes gkPulseRing {
    0% { transform: scale(1); opacity: 0.75; }
    100% { transform: scale(2); opacity: 0; }
}

/* Periodic dramatic wave — every 8s the icon waves like a hand */
@keyframes gkWave {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-18deg) scale(1.1); }
    20% { transform: rotate(16deg) scale(1.1); }
    30% { transform: rotate(-14deg) scale(1.08); }
    40% { transform: rotate(12deg) scale(1.08); }
    50% { transform: rotate(-8deg) scale(1.04); }
    60% { transform: rotate(6deg) scale(1.04); }
    70% { transform: rotate(0deg) scale(1); }
}
.gk-launcher.gk-attention .gk-launcher-icon {
    animation: gkWave 1.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: 50% 50%;
}
.gk-launcher .gk-pulse {
    position: absolute;
    top: -5px; right: -5px;
    width: 18px; height: 18px;
    background: var(--accent-gold, #ffd700);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    animation: gkPulse 2s infinite;
}
@keyframes gkPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { box-shadow: 0 0 0 12px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}
.gk-launcher.gk-hidden { opacity: 0; pointer-events: none; transform: scale(0.7); }

/* AUTO-HIDE while scrolling — fades + shrinks so it doesn't overlap content. Restores on scroll-stop. */
.gk-launcher.gk-scroll-hide { opacity: 0.18; transform: scale(0.55); pointer-events: none; transition: opacity 0.3s, transform 0.3s; }
.gk-launcher.gk-scroll-hide .gk-wave-emoji { animation-play-state: paused; }
.gk-launcher.gk-scroll-hide .gk-pulse-ring { animation-play-state: paused; }

/* Voice play-fallback button — shown when autoplay was blocked */
.gk-voice-fallback {
    position: fixed;
    bottom: 188px; right: 38px;
    z-index: 9991;
    background: var(--accent-teal, #64ffda);
    color: var(--bg-navy, #0a192f);
    border: none;
    padding: 10px 14px;
    border-radius: 22px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(100, 255, 218, 0.4);
    display: flex; align-items: center; gap: 8px;
    animation: gkFallbackPop 0.4s ease-out;
}
.gk-voice-fallback:hover { transform: translateY(-2px); }
.gk-voice-fallback.gk-hide { display: none; }
@keyframes gkFallbackPop {
    0% { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}
@media (max-width: 600px) {
    .gk-voice-fallback { bottom: 240px; right: 24px; }
}

.gk-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 640px;
    max-height: calc(100vh - 60px);
    background: var(--bg-light-navy, #112240);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    border-top: 3px solid var(--accent-teal, #64ffda);
    border-radius: 14px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    z-index: 10010;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    color: var(--text-platinum, #e6f1ff);
}
.gk-panel.gk-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.gk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: var(--bg-navy, #0a192f);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    flex-shrink: 0;
}
.gk-brand { display: flex; align-items: center; gap: 12px; }
.gk-brand-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-teal, #64ffda), #4cdbb9);
    display: flex; align-items: center; justify-content: center;
    color: var(--bg-navy, #0a192f);
    font-weight: 800;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(100, 255, 218, 0.3);
    overflow: hidden;
    position: relative;
}
.gk-brand-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 25%;
    display: block;
}
.gk-brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-platinum, #e6f1ff);
    line-height: 1.1;
}
.gk-brand-sub {
    font-size: 0.7rem;
    color: var(--accent-teal, #64ffda);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-top: 2px;
    display: flex; align-items: center; gap: 6px;
}
.gk-status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
}
.gk-header-actions { display: flex; align-items: center; gap: 8px; }
.gk-start-over {
    background: transparent;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    color: var(--text-slate, #a8b2d1);
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.2s;
    letter-spacing: 0.3px;
}
.gk-start-over:hover {
    color: var(--accent-teal, #64ffda);
    border-color: var(--accent-teal, #64ffda);
    background: rgba(100, 255, 218, 0.08);
}
.gk-close {
    background: none;
    border: none;
    color: var(--text-slate, #a8b2d1);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 6px;
    transition: 0.2s;
}
.gk-close:hover { color: var(--accent-teal, #64ffda); background: rgba(100, 255, 218, 0.08); }

.gk-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 255, 218, 0.3) transparent;
}
.gk-body::-webkit-scrollbar { width: 6px; }
.gk-body::-webkit-scrollbar-thumb { background: rgba(100, 255, 218, 0.3); border-radius: 3px; }

.gk-msg {
    max-width: 88%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-platinum, #e6f1ff);
    word-wrap: break-word;
    animation: gkFadeIn 0.3s ease-out;
}
@keyframes gkFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.gk-msg.gk-bot {
    align-self: flex-start;
    background: rgba(100, 255, 218, 0.06);
    border: 1px solid rgba(100, 255, 218, 0.15);
    border-bottom-left-radius: 4px;
}
.gk-msg.gk-user {
    align-self: flex-end;
    background: var(--accent-teal, #64ffda);
    color: var(--bg-navy, #0a192f);
    border-bottom-right-radius: 4px;
    font-weight: 600;
}
.gk-msg.gk-system {
    align-self: center;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--accent-gold, #ffd700);
    font-size: 0.8rem;
    text-align: center;
    max-width: 100%;
}

.gk-typing {
    align-self: flex-start;
    background: rgba(100, 255, 218, 0.06);
    border: 1px solid rgba(100, 255, 218, 0.15);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 14px 18px;
    display: inline-flex;
    gap: 5px;
}
.gk-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent-teal, #64ffda);
    opacity: 0.5;
    animation: gkBounce 1.2s infinite;
}
.gk-typing span:nth-child(2) { animation-delay: 0.15s; }
.gk-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes gkBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Compact wrap-grid — pills size to content so multiple options fit per row */
.gk-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
    margin-bottom: 6px;
    align-self: stretch;
    animation: gkFadeIn 0.3s ease-out;
}
.gk-option {
    display: inline-flex;
    align-items: center;
    text-align: center;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--accent-teal, #64ffda);
    color: var(--accent-teal, #64ffda);
    border-radius: 18px;
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: normal;
    flex: 0 1 auto;
    min-width: 0;
}
.gk-option:hover, .gk-option:focus-visible {
    background: var(--accent-teal, #64ffda);
    color: var(--bg-navy, #0a192f);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.25);
    outline: none;
}
.gk-option.gk-option-handoff {
    background: rgba(100, 255, 218, 0.1);
    font-weight: 700;
    border-width: 1.5px;
}
.gk-option.gk-option-secondary {
    border-color: var(--border, rgba(255, 255, 255, 0.2));
    color: var(--text-slate, #a8b2d1);
    font-weight: 500;
    font-size: 0.78rem;
    padding: 6px 12px;
}
.gk-option.gk-option-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-platinum, #e6f1ff);
    border-color: var(--text-slate, #a8b2d1);
}
.gk-options-disabled .gk-option {
    pointer-events: none;
    opacity: 0.5;
    border-color: var(--border, rgba(255, 255, 255, 0.1));
    color: var(--text-slate, #a8b2d1);
    background: transparent;
}

/* Individual button dim — used for pure-URL handoff clicks (e.g. WhatsApp).
   The rest of the block stays clickable; only this one shows it was already used. */
.gk-option.gk-option-used {
    opacity: 0.6;
    background: rgba(100, 255, 218, 0.14);
    color: var(--accent-teal, #64ffda);
}
.gk-option.gk-option-used:hover {
    opacity: 1;
    background: rgba(100, 255, 218, 0.22);
}

.gk-capture {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
    align-self: stretch;
    animation: gkFadeIn 0.3s ease-out;
}
.gk-field-label {
    font-size: 0.72rem;
    color: var(--text-slate, #a8b2d1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: -4px;
}
.gk-input, .gk-textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    color: #fff;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    box-sizing: border-box;
    transition: 0.2s;
    resize: none;
}
.gk-textarea { min-height: 84px; resize: vertical; }
.gk-input:focus, .gk-textarea:focus {
    outline: none;
    border-color: var(--accent-teal, #64ffda);
    background: rgba(10, 25, 47, 0.7);
    box-shadow: 0 0 0 3px rgba(100, 255, 218, 0.12);
}
.gk-input.gk-invalid, .gk-textarea.gk-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

/* Inline validation error message — sits directly under the input */
.gk-field-error {
    font-size: 0.74rem;
    color: #f87171;
    margin-top: -4px;
    margin-bottom: 4px;
    font-weight: 500;
    line-height: 1.3;
    animation: gkFadeIn 0.2s ease-out;
}
.gk-submit {
    width: 100%;
    padding: 13px;
    background: var(--accent-teal, #64ffda);
    color: var(--bg-navy, #0a192f);
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: 0.2s;
}
.gk-submit:hover:not(:disabled) {
    background: #4cdbb9;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(100, 255, 218, 0.3);
}
.gk-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.gk-honeypot {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    opacity: 0 !important;
    width: 1px !important; height: 1px !important;
    pointer-events: none;
}

.gk-capture-secondary {
    margin-top: 4px;
    text-align: center;
}
.gk-text-link {
    background: none;
    border: none;
    color: var(--text-slate, #a8b2d1);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: underline;
    padding: 4px 8px;
    transition: 0.2s;
}
.gk-text-link:hover { color: var(--accent-teal, #64ffda); }

.gk-footer-hint {
    padding: 8px 22px 12px 22px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-slate, #a8b2d1);
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}
.gk-footer-hint a {
    color: var(--accent-teal, #64ffda);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}
.gk-footer-hint a:hover { text-decoration: underline; }

/* --- PEEK BUBBLE — attention-getter that floats above the launcher --- */
.gk-peek {
    position: fixed;
    bottom: 110px;
    right: 30px;
    max-width: 280px;
    background: linear-gradient(135deg, var(--accent-teal, #64ffda), #4cdbb9);
    color: var(--bg-navy, #0a192f);
    padding: 14px 38px 14px 16px;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 14px 40px rgba(100, 255, 218, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 9989;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px) scale(0.85);
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', sans-serif;
}
.gk-peek::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 28px;
    width: 14px; height: 14px;
    background: #4cdbb9;
    transform: rotate(45deg);
    border-radius: 2px;
}
.gk-peek.gk-peek-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: gkPeekBob 2.6s ease-in-out infinite 0.6s;
}
@keyframes gkPeekBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
.gk-peek-text {
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--bg-navy, #0a192f);
}
.gk-peek-cta {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #0a4a3f;
}
.gk-peek-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: rgba(10, 25, 47, 0.15);
    border: none;
    color: var(--bg-navy, #0a192f);
    width: 22px; height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
    padding: 0;
}
.gk-peek-close:hover { background: rgba(10, 25, 47, 0.3); }

/* --- MOBILE --- */
@media (max-width: 600px) {
    .gk-launcher {
        bottom: 130px;
        right: 16px;
        width: 84px; height: 84px;
    }
    .gk-launcher svg, .gk-launcher .gk-launcher-icon { width: 34px; height: 34px; }
    .gk-wave-emoji { font-size: 32px; bottom: -5px; right: -8px; }
    .gk-peek {
        bottom: 225px;
        right: 16px;
        max-width: calc(100vw - 32px);
    }
    .gk-panel {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
        border-top: 3px solid var(--accent-teal, #64ffda);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gk-panel, .gk-launcher, .gk-msg, .gk-options, .gk-capture, .gk-typing span,
    .gk-peek, .gk-launcher .gk-launcher-icon { transition: none !important; animation: none !important; }
    .gk-launcher .gk-pulse { animation: none !important; }
}
