/* ─── VAKO Lead Popup ─────────────────────────────────────────────────────── */
/* Brand: navy #01447B · orange #F15D22 · white #fff · font: Roboto           */

:root {
    --vlp-navy:         #01447B;
    --vlp-navy-dark:    #012f58;
    --vlp-orange:       #F15D22;
    --vlp-orange-dark:  #d44e18;
    --vlp-white:        #ffffff;
    --vlp-bg:           #f8fafc;
    --vlp-border:       #d1dde8;
    --vlp-text:         #1a2a3a;
    --vlp-text-muted:   #5a6e80;
    --vlp-radius:       10px;
    --vlp-shadow:       0 8px 40px rgba(1,68,123,0.22), 0 2px 8px rgba(0,0,0,0.10);
    --vlp-panel-width:  340px;
    --vlp-z:            99999;
    --vlp-slide-offset: 380px;    /* how far off-screen when hidden */
}

/* ── Wrapper ────────────────────────────────────────────────────────────────── */

/*
 * Default: display:none — popup is completely absent from rendering.
 * JS adds .vlp-init first (display:flex, off-screen, no transition),
 * then .vlp-visible in the next frame to trigger the slide-in animation.
 * This is the ONLY reliable way to guarantee the popup is invisible until
 * a trigger fires — no reliance on opacity or transform that can be overridden.
 */
#vlp-popup {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--vlp-z);
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--vlp-text);
}

/* Step 1: make element flex but keep it off-screen (no transition yet) */
#vlp-popup.vlp-init {
    display: flex;
    transform: translateX(var(--vlp-slide-offset));
    opacity: 0;
    pointer-events: none;
}

/* Step 2: animate in (transition added here, not on the base rule) */
#vlp-popup.vlp-visible {
    display: flex;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    transition: transform 0.42s cubic-bezier(0.34, 1.18, 0.64, 1),
                opacity   0.3s ease;
}

/* ── Pull tab ───────────────────────────────────────────────────────────────── */

.vlp-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--vlp-navy);
    color: var(--vlp-white);
    border: none;
    border-radius: var(--vlp-radius) var(--vlp-radius) 0 0;
    padding: 8px 16px 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: background 0.2s ease;
    order: 2; /* tab sits below the panel */
    align-self: flex-end;
}

.vlp-tab:hover,
.vlp-tab:focus-visible {
    background: var(--vlp-navy-dark);
    outline: none;
}

.vlp-tab-icon {
    display: flex;
    align-items: center;
}

/* Tab is hidden when panel is open */
.vlp-popup-open .vlp-tab {
    display: none;
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */

.vlp-panel {
    width: var(--vlp-panel-width);
    background: var(--vlp-white);
    border-radius: var(--vlp-radius) 0 0 var(--vlp-radius);
    box-shadow: var(--vlp-shadow);
    overflow: hidden;
    order: 1;

    /* Panel is collapsed until .vlp-popup-open */
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.4s cubic-bezier(0.34, 1.1, 0.64, 1),
                opacity    0.25s ease;
}

.vlp-popup-open .vlp-panel {
    max-height: 700px;
    opacity: 1;
    pointer-events: auto;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

.vlp-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    background: var(--vlp-navy);
    padding: 16px 16px 14px 18px;
}

.vlp-header-text {
    flex: 1;
}

.vlp-title {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    color: var(--vlp-white);
    letter-spacing: 0.01em;
}

.vlp-subtitle {
    margin: 0;
    font-size: 12.5px;
    color: rgba(255,255,255,0.72);
    line-height: 1.4;
}

/* Orange accent bar under header title */
.vlp-title::after {
    content: '';
    display: block;
    width: 28px;
    height: 2px;
    background: var(--vlp-orange);
    margin-top: 6px;
    border-radius: 1px;
}

.vlp-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.12);
    border: none;
    border-radius: 50%;
    color: var(--vlp-white);
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
    margin-top: 1px;
}

.vlp-close:hover,
.vlp-close:focus-visible {
    background: rgba(255,255,255,0.25);
    outline: none;
}

/* ── Form ───────────────────────────────────────────────────────────────────── */

.vlp-form {
    padding: 18px 18px 20px;
    background: var(--vlp-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vlp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vlp-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--vlp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.vlp-req {
    color: var(--vlp-orange);
    font-size: 13px;
}

.vlp-field input,
.vlp-field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--vlp-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--vlp-text);
    background: var(--vlp-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    outline: none;
    resize: vertical;
}

.vlp-field input:focus,
.vlp-field textarea:focus {
    border-color: var(--vlp-navy);
    box-shadow: 0 0 0 3px rgba(1,68,123,0.10);
}

.vlp-field input.vlp-error,
.vlp-field textarea.vlp-error {
    border-color: #e53e3e;
}

.vlp-field textarea {
    min-height: 72px;
}

/* Turnstile */
.vlp-turnstile {
    min-height: 65px;
}

.vlp-turnstile .cf-turnstile {
    transform: scale(0.9);
    transform-origin: left center;
}

/* ── Submit button ──────────────────────────────────────────────────────────── */

.vlp-submit {
    width: 100%;
    padding: 11px 20px;
    background: var(--vlp-orange);
    color: var(--vlp-white);
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.vlp-submit:hover {
    background: var(--vlp-orange-dark);
}

.vlp-submit:active {
    transform: translateY(1px);
}

.vlp-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Spinner */
.vlp-submit-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vlp-spin 0.65s linear infinite;
    flex-shrink: 0;
}

.vlp-submit.vlp-loading .vlp-submit-spinner {
    display: inline-block;
}

.vlp-submit.vlp-loading .vlp-submit-text {
    opacity: 0.7;
}

@keyframes vlp-spin {
    to { transform: rotate(360deg); }
}

/* ── Response message ───────────────────────────────────────────────────────── */

.vlp-response {
    display: none;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

.vlp-response.vlp-success {
    display: block;
    background: #eafaf1;
    color: #1a6638;
    border: 1px solid #a3e4bc;
}

.vlp-response.vlp-failure {
    display: block;
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* ── Shake animation (validation error) ─────────────────────────────────────── */

@keyframes vlp-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.vlp-shake {
    animation: vlp-shake 0.4s ease;
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    :root {
        --vlp-panel-width: calc(100vw - 24px);
        --vlp-slide-offset: 110vw;
    }

    #vlp-popup {
        bottom: 16px;
        right: 12px;
    }

    .vlp-panel {
        border-radius: var(--vlp-radius) 0 0 var(--vlp-radius);
    }

    .vlp-turnstile .cf-turnstile {
        transform: scale(0.82);
    }
}
