/* ============================================================
   KSHATRIYA EXIM - Premium WhatsApp Enquiry System
   Version: 2.0.0
   ============================================================ */

/* ============================================================
   FLOATING BUTTON
   ============================================================ */
.wa-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.wa-fab {
    position: relative;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #2BDC6F 0%, #1DA851 60%, #128C46 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(29, 168, 81, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wa-fab svg {
    width: 28px;
    height: 28px;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

.wa-fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 18px 42px rgba(29, 168, 81, 0.5);
}

.wa-fab:active {
    transform: scale(0.96);
}

.wa-fab__ping {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.45);
    animation: wa-ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
    pointer-events: none;
}

/* ============================================================
   FLOATING BUTTON STACK (public storefront)
   When a scroll-to-top control is present (guests use
   .ks-footer__totop, legacy pages use .scrollToTop), the
   WhatsApp FAB rises above it so all three float in a single
   clean column: Chatbot → WhatsApp → Scroll-to-top.
   Back-office panels have no scroll-to-top control, so they
   keep the corner position below.
   ============================================================ */
.ks-footer__totop ~ .wa-root,
.scrollToTop ~ .wa-root {
    bottom: 110px;   /* 26 (totop) + 68 (totop h) + 16 gap */
}

.wa-fab__pulse {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.4);
    animation: wa-pulse 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
    animation-delay: 1.1s;
    pointer-events: none;
}

@keyframes wa-ping {
    0% { transform: scale(0.55); opacity: 0.85; }
    70%, 100% { transform: scale(1.9); opacity: 0; }
}

@keyframes wa-pulse {
    0% { transform: scale(0.85); opacity: 0.7; }
    70%, 100% { transform: scale(1.35); opacity: 0; }
}

.wa-fab:focus-visible,
.wa-pop__close:focus-visible,
.wa-card:focus-visible,
.wa-back-btn:focus-visible,
.wa-next-btn:focus-visible,
.wa-type-card:focus-visible {
    outline: 3px solid rgba(232, 93, 4, 0.55);
    outline-offset: 2px;
}

/* ============================================================
   POPUP
   ============================================================ */
.wa-pop {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 40px);
    max-height: calc(100dvh - 96px);
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(22px) scale(0.94);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                visibility 0.35s;
    z-index: 3000;
}

.wa-root.is-open .wa-pop {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Popup header */
.wa-pop__head {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #FFFFFF;
    flex-shrink: 0;
}

.wa-pop__ava {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(232, 93, 4, 0.2);
    border: 1px solid rgba(232, 93, 4, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-pop__ava svg { width: 24px; height: 24px; }

.wa-pop__title { flex: 1; min-width: 0; }

.wa-pop__title strong {
    display: block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.wa-pop__title small {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    opacity: 0.85;
    margin-top: 2px;
}

.wa-pop__close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wa-pop__close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: rotate(90deg);
}

.wa-pop__close svg { width: 15px; height: 15px; }

/* Popup body */
.wa-pop__body {
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(232, 93, 4, 0.3) transparent;
    flex: 1;
    min-height: 280px;
    max-height: 420px;
}

.wa-pop__body::-webkit-scrollbar { width: 6px; }
.wa-pop__body::-webkit-scrollbar-track { background: transparent; }
.wa-pop__body::-webkit-scrollbar-thumb {
    background: rgba(232, 93, 4, 0.3);
    border-radius: 20px;
}

/* Steps */
.wa-step {
    display: none;
}

.wa-step.is-active {
    display: block;
    animation: wa-step-in 0.3s ease both;
}

@keyframes wa-step-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enquiry type cards grid */
.wa-types-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wa-type-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: 'Inter', system-ui, sans-serif;
}

.wa-type-card:hover {
    transform: translateY(-3px);
    border-color: rgba(232, 93, 4, 0.4);
    box-shadow: 0 12px 28px rgba(232, 93, 4, 0.12);
}

.wa-type-card:active { transform: scale(0.98); }

.wa-type-card__icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.1), rgba(232, 93, 4, 0.05));
}

.wa-type-card__text { flex: 1; min-width: 0; }

.wa-type-card__text strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.wa-type-card__text small {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.35;
}

.wa-type-card__arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #e8590c;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.wa-type-card:hover .wa-type-card__arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Form */
.wa-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wa-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wa-field label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.02em;
}

.wa-field label .req {
    color: #dc2626;
    margin-left: 2px;
}

.wa-field input,
.wa-field select,
.wa-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13.5px;
    color: #0f172a;
    transition: all 0.2s ease;
    outline: none;
}

.wa-field input:focus,
.wa-field select:focus,
.wa-field textarea:focus {
    border-color: rgba(232, 93, 4, 0.5);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.08);
}

.wa-field input::placeholder,
.wa-field textarea::placeholder {
    color: #94a3b8;
}

.wa-field textarea {
    resize: vertical;
    min-height: 80px;
}

.wa-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.wa-field--row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wa-field--error input,
.wa-field--error select,
.wa-field--error textarea {
    border-color: #dc2626;
    background: rgba(254, 226, 226, 0.5);
}

.wa-field__error {
    font-size: 11.5px;
    color: #dc2626;
    font-weight: 600;
    display: none;
}

.wa-field--error .wa-field__error {
    display: block;
}

/* Preview */
.wa-preview {
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    padding: 18px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.7;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
}

.wa-preview__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 10px;
    display: block;
}

/* Footer buttons */
.wa-pop__foot {
    flex-shrink: 0;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.wa-back-btn {
    padding: 10px 18px;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: #475569;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wa-back-btn:hover {
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
}

.wa-next-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8590c, #d97706);
    color: #FFFFFF;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(232, 93, 4, 0.3);
}

.wa-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(232, 93, 4, 0.4);
}

.wa-next-btn:active {
    transform: translateY(0);
}

.wa-next-btn--wa {
    background: linear-gradient(135deg, #25D366, #128C7E);
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.wa-next-btn--wa:hover {
    box-shadow: 0 8px 22px rgba(37, 211, 102, 0.4);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767px) {
    .wa-root { bottom: 16px; right: 14px; }
    .ks-footer__totop ~ .wa-root,
    .scrollToTop ~ .wa-root {
        bottom: 78px;   /* 16 (totop) + 52 (totop h) + 10 gap */
    }
    .wa-fab { width: 54px; height: 54px; }
    .wa-fab svg { width: 27px; height: 27px; }
    .wa-pop {
        bottom: 16px;
        right: 14px;
        width: calc(100vw - 28px);
        max-height: calc(100dvh - 84px);
    }

    .wa-types-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .wa-type-card {
        padding: 12px;
        gap: 10px;
    }

    .wa-type-card__icon {
        width: 36px;
        height: 36px;
        font-size: 17px;
        border-radius: 10px;
    }

    .wa-type-card__text strong {
        font-size: 12px;
    }

    .wa-type-card__text small {
        font-size: 10.5px;
    }

    .wa-field--row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .wa-pop__body {
        padding: 14px;
        max-height: 350px;
    }

    .wa-pop__foot {
        padding: 12px 14px;
        flex-direction: column;
    }

    .wa-back-btn,
    .wa-next-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .wa-pop { width: 360px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .wa-fab__ping,
    .wa-fab__pulse {
        animation: none;
    }
    .wa-pop,
    .wa-type-card,
    .wa-back-btn,
    .wa-next-btn {
        transition: none;
    }
    .wa-step.is-active {
        animation: none;
    }
}
