/* ============================================================
   WTS CONVERSION ENGINE — Complete UI System
   WhatsApp Float | Lead Popups | Exit Intent | Social Proof
   ============================================================ */

:root {
    --wts-wa-green: #25D366;
    --wts-popup-bg: #0d0d1e;
    --wts-popup-border: rgba(255,255,255,0.08);
    --wts-popup-text: #c8cdd5;
    --wts-popup-heading: #ffffff;
    --wts-popup-accent: #2D7DD2;
    --wts-popup-radius: 16px;
}

/* ============================================================
   1. WHATSAPP FLOATING BUTTON
   ============================================================ */
.wts-wa-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}
/* When chatbot exists, push WhatsApp up above it */
body:has(.wts-chatbot-toggle) .wts-wa-float {
    bottom: 92px;
}

.wts-wa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    background: var(--wts-wa-green);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0,0,0,0.2);
    text-decoration: none !important;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    animation: wtsWaBounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 1s both;
}
.wts-wa-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.5), 0 4px 12px rgba(0,0,0,0.3);
}
.wts-wa-btn svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }

/* Pulse ring */
.wts-wa-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--wts-wa-green);
    animation: wtsWaPulse 2s ease-out infinite;
    pointer-events: none;
}

/* Tooltip bubble */
.wts-wa-tooltip {
    background: #fff;
    color: #1a1a2e;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    animation: wtsTooltipIn 0.4s ease 5s both;
    display: flex;
    align-items: center;
    gap: 8px;
}
.wts-wa-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.05);
}
.wts-wa-tooltip-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
    padding: 0 0 0 4px;
    line-height: 1;
}
.wts-wa-tooltip-close:hover { color: #333; }

@keyframes wtsWaBounceIn {
    0% { opacity: 0; transform: scale(0.3) translateY(40px); }
    60% { transform: scale(1.1) translateY(-4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes wtsWaPulse {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.6); }
}
@keyframes wtsTooltipIn {
    0% { opacity: 0; transform: translateY(8px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   2. LEAD POPUP — Service-specific inquiry form
   ============================================================ */
.wts-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.wts-popup-overlay.active { opacity: 1; visibility: visible; }

.wts-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 580px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--wts-popup-bg);
    border: 1px solid var(--wts-popup-border);
    border-radius: var(--wts-popup-radius);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}
.wts-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Popup header */
.wts-popup-header {
    padding: 28px 28px 0;
    text-align: center;
    position: relative;
}
.wts-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: #8892a4;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}
.wts-popup-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.wts-popup-svc-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(45,125,210,0.15), rgba(0,212,255,0.08));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #2D7DD2;
    margin-bottom: 14px;
    border: 1px solid rgba(45,125,210,0.2);
}
.wts-popup-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--wts-popup-heading);
    margin: 0 0 6px;
    line-height: 1.3;
}
.wts-popup-subtitle {
    font-size: 13px;
    color: #8892a4;
    margin: 0 0 4px;
    line-height: 1.5;
}
.wts-popup-trust {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.wts-popup-trust span {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Popup form */
.wts-popup-form {
    padding: 20px 28px 28px;
}
/* Side-by-side field rows */
.wts-popup-row {
    display: flex;
    gap: 14px;
}
.wts-popup-row .wts-popup-field {
    flex: 1;
    min-width: 0;
}
.wts-popup-field {
    margin-bottom: 14px;
}
.wts-popup-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8892a4;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wts-popup-field input,
.wts-popup-field select,
.wts-popup-field textarea {
    width: 100%;
    padding: 11px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
}
.wts-popup-field input::placeholder,
.wts-popup-field textarea::placeholder {
    color: #4a5568;
}
.wts-popup-field input:focus,
.wts-popup-field select:focus,
.wts-popup-field textarea:focus {
    border-color: rgba(45,125,210,0.5);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 0 3px rgba(45,125,210,0.1);
}
.wts-popup-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238892a4' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    text-overflow: ellipsis;
    min-height: 46px;
}
.wts-popup-field select option {
    background: #1a1a2e;
    color: #fff;
    padding: 10px;
}
.wts-popup-field textarea { resize: vertical; min-height: 60px; }

/* Math challenge row */
.wts-popup-math {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.wts-popup-math-label {
    font-size: 13px;
    color: #8892a4;
    white-space: nowrap;
    font-weight: 600;
}
.wts-popup-math input {
    width: 70px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    text-align: center;
    font-weight: 700;
    outline: none;
    transition: all 0.2s;
}
.wts-popup-math input:focus {
    border-color: rgba(45,125,210,0.5);
    box-shadow: 0 0 0 3px rgba(45,125,210,0.1);
}

/* Submit button */
.wts-popup-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2D7DD2, #00d4ff);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    margin-top: 4px;
}
.wts-popup-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(45,125,210,0.4);
}
.wts-popup-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.wts-popup-submit .wts-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wtsSpin 0.6s linear infinite;
    margin: 0 auto;
}
.wts-popup-submit.loading .wts-btn-text { display: none; }
.wts-popup-submit.loading .wts-spinner { display: block; }

/* Honeypot — invisible to humans */
.wts-hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* Error message */
.wts-popup-error {
    background: rgba(214,54,56,0.12);
    border: 1px solid rgba(214,54,56,0.3);
    color: #ff6b6b;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
    text-align: center;
}
.wts-popup-error.show { display: block; animation: wtsShake 0.4s ease; }

/* Success state */
.wts-popup-success {
    text-align: center;
    padding: 40px 28px;
}
.wts-popup-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37,211,102,0.15), rgba(45,125,210,0.1));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 18px;
    animation: wtsSuccessPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wts-popup-success h3 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 10px;
}
.wts-popup-success p {
    font-size: 14px;
    color: #8892a4;
    line-height: 1.6;
    margin: 0 0 24px;
}
.wts-popup-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: var(--wts-wa-green);
    color: #fff !important;
    border-radius: 12px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(37,211,102,0.3);
}
.wts-popup-wa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,211,102,0.4);
}
.wts-popup-wa-btn svg { width: 22px; height: 22px; }
.wts-popup-success-close {
    display: block;
    margin-top: 16px;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
    transition: color 0.2s;
}
.wts-popup-success-close:hover { color: #fff; }

@keyframes wtsSuccessPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
@keyframes wtsShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
@keyframes wtsSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   3. EXIT-INTENT POPUP
   ============================================================ */
.wts-exit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    z-index: 10010;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.wts-exit-overlay.active { opacity: 1; visibility: visible; }

.wts-exit-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 440px;
    max-width: 92vw;
    background: var(--wts-popup-bg);
    border: 1px solid var(--wts-popup-border);
    border-radius: var(--wts-popup-radius);
    z-index: 10011;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    text-align: center;
    padding: 36px 32px;
    overflow: hidden;
}
.wts-exit-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}
.wts-exit-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2D7DD2, #00d4ff, #7c3aed);
}
.wts-exit-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: #8892a4;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.wts-exit-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.wts-exit-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}
.wts-exit-popup h2 {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.2;
}
.wts-exit-popup p {
    font-size: 14px;
    color: #8892a4;
    line-height: 1.7;
    margin: 0 0 22px;
}
.wts-exit-form {
    display: flex;
    gap: 8px;
}
.wts-exit-form input[type="email"] {
    flex: 1;
    padding: 13px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}
.wts-exit-form input:focus {
    border-color: rgba(45,125,210,0.5);
    box-shadow: 0 0 0 3px rgba(45,125,210,0.1);
}
.wts-exit-form button {
    padding: 13px 24px;
    background: linear-gradient(135deg, #2D7DD2, #00d4ff);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}
.wts-exit-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(45,125,210,0.4);
}
.wts-exit-skip {
    display: block;
    margin-top: 14px;
    color: #4a5568;
    font-size: 12px;
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.2s;
}
.wts-exit-skip:hover { color: #8892a4; }

/* ============================================================
   4. SOCIAL PROOF TOAST
   ============================================================ */
.wts-proof-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9980;
    max-width: 340px;
    opacity: 0;
    transform: translateY(20px) translateX(-20px);
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
.wts-proof-toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) translateX(0);
    pointer-events: auto;
}
.wts-proof-toast-inner {
    background: rgba(14,14,30,0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    position: relative;
}
.wts-proof-toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}
.wts-proof-toast-text {
    font-size: 13px;
    color: #c8cdd5;
    line-height: 1.4;
    font-weight: 500;
}
.wts-proof-toast-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}
.wts-proof-toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: #4a5568;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    line-height: 1;
    transition: color 0.2s;
}
.wts-proof-toast-close:hover { color: #fff; }

/* ============================================================
   5. RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    /* WhatsApp float */
    .wts-wa-float { bottom: 16px; right: 16px; }
    .wts-wa-btn { width: 50px; height: 50px; }
    .wts-wa-btn img, .wts-wa-btn i { font-size: 22px; width: 22px; height: 22px; }
    .wts-wa-tooltip { display: none; }

    /* Popup */
    .wts-popup { 
        width: 100%; max-width: 100vw; 
        border-radius: 16px 16px 0 0; 
        top: auto; bottom: 0; 
        transform: translate(-50%, 0) translateY(100%); 
        max-height: 90vh;
        overflow-y: auto;
    }
    .wts-popup.active { transform: translate(-50%, 0) translateY(0); }
    .wts-popup-header { padding: 18px 16px 0; }
    .wts-popup-title { font-size: 18px; }
    .wts-popup-subtitle { font-size: 13px; }
    .wts-popup-form { padding: 14px 16px 20px; }
    .wts-popup-form input, .wts-popup-form select, .wts-popup-form textarea { 
        font-size: 14px; padding: 11px 12px; 
    }
    .wts-popup-row { flex-direction: column; gap: 0; }
    .wts-popup-close { width: 30px; height: 30px; font-size: 16px; }
    .wts-popup-svc-icon { width: 40px; height: 40px; font-size: 18px; }

    /* Exit intent */
    .wts-exit-overlay .wts-exit-popup { 
        width: calc(100% - 24px); 
        max-width: 100%; 
        padding: 24px 18px; 
        border-radius: 16px;
    }
    .wts-exit-title { font-size: 20px; }
    .wts-exit-subtitle { font-size: 13px; }
    .wts-exit-form { flex-direction: column; gap: 10px; }
    .wts-exit-form input { font-size: 14px; padding: 12px; }
    .wts-exit-form button { font-size: 14px; padding: 12px; width: 100%; }

    /* Social proof toast */
    .wts-proof-toast { left: 10px; right: 10px; max-width: none; bottom: 80px; }
    .wts-proof-toast-content { font-size: 13px; padding: 12px 14px; gap: 10px; }
    .wts-proof-toast-close { font-size: 16px; }
    .wts-proof-avatar { width: 34px; height: 34px; font-size: 14px; }
}
